feat: updates

This commit is contained in:
2025-04-29 01:07:47 +08:00
parent b7750f190b
commit 35ba0eb61c

View File

@@ -244,7 +244,7 @@ struct ComputeSecureEnclaveP256EcsignResponse: Codable {
struct ComputeSecureEnclaveP256EcdhResponse: Codable { struct ComputeSecureEnclaveP256EcdhResponse: Codable {
var success: Bool var success: Bool
var shared_secret: String var shared_secret_hex: String
} }
struct ExternalSpecResponse: Codable { struct ExternalSpecResponse: Codable {
@@ -437,9 +437,18 @@ func computeSecureEnclaveP256Ecdh(request: ComputeP256EcdhRequest) -> ComputeSec
let sharedSecret = try p.sharedSecretFromKeyAgreement( let sharedSecret = try p.sharedSecretFromKeyAgreement(
with: ephemeralPublicKey) with: ephemeralPublicKey)
var shared_secret_hex: String
if sharedSecret.description.starts(with: "SharedSecret: ") {
let str = sharedSecret.description
let startIndex = str.index(str.startIndex, offsetBy: "SharedSecret: ".count)
shared_secret_hex = String(str[startIndex...])
} else {
shared_secret_hex = sharedSecret.description
}
return ComputeSecureEnclaveP256EcdhResponse( return ComputeSecureEnclaveP256EcdhResponse(
success: true, success: true,
shared_secret: sharedSecret.description shared_secret_hex: shared_secret_hex
) )
} catch { } catch {
exitError("\(error)") exitError("\(error)")