Skip to content

Commit

Permalink
Merge pull request #7 from yupengyang/main
Browse files Browse the repository at this point in the history
fix: generateKeyPair result type error && throw error when signing failed
  • Loading branch information
anggaaryas authored Sep 7, 2022
2 parents d4ffcde + f870712 commit e470944
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ios/Classes/SECore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,19 @@ class SECore : SECoreProtocol {

do{
secKey = try getSecKey(tag: tag, password: password)!
} catch{
} catch {
throw error
}


var error: Unmanaged<CFError>?
guard let signData = SecKeyCreateSignature(
secKey,
SecKeyAlgorithm.ecdsaSignatureMessageX962SHA256,
message as CFData, nil) else {
return nil
message as CFData, &error) else {
if let e = error {
throw e.takeUnretainedValue() as Error
}
throw CustomError.runtimeError("Can't sign data")
} //2

let signedData = signData as Data
Expand Down

0 comments on commit e470944

Please sign in to comment.