Skip to content

Commit

Permalink
Merge pull request #286 from tangem/IOS-3604_add_schnorr
Browse files Browse the repository at this point in the history
  • Loading branch information
tureck1y authored May 15, 2023
2 parents 057dc40 + c8c63b7 commit 4d94be8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions TangemSdk/TangemSdk/Common/Card/EllipticCurve.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ public enum EllipticCurve: String, StringCodable, CaseIterable {
case bls12381_G2
case bls12381_G2_AUG
case bls12381_G2_POP
case bip0340
}
16 changes: 8 additions & 8 deletions TangemSdk/TangemSdk/Crypto/CryptoUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public enum CryptoUtils {
let sig = try P256.Signing.ECDSASignature(rawRepresentation: signature)

return pubKey.isValidSignature(sig, for: message)
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP:
// TODO: Add support for BLS keys.
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP, .bip0340:
// TODO: implement
throw TangemSdkError.unsupportedCurve
}
}
Expand All @@ -73,8 +73,8 @@ public enum CryptoUtils {
case .secp256r1:
let key = try? P256.Signing.PrivateKey(rawRepresentation: privateKey)
return key != nil
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP:
// TODO: Add support for BLS keys.
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP, .bip0340:
// TODO: implement
throw TangemSdkError.unsupportedCurve
}
}
Expand All @@ -90,8 +90,8 @@ public enum CryptoUtils {
case .secp256r1:
let key = try P256.Signing.PrivateKey(rawRepresentation: privateKey)
return key.publicKey.rawRepresentation
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP:
// TODO: Add support for BLS keys.
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP, .bip0340:
// TODO: implement
throw TangemSdkError.unsupportedCurve
}
}
Expand Down Expand Up @@ -121,8 +121,8 @@ public enum CryptoUtils {
let pubKey = try P256.Signing.PublicKey(x963Representation: publicKey)
let sig = try P256.Signing.ECDSASignature(rawRepresentation: signature)
return pubKey.isValidSignature(sig, for: CustomSha256Digest(hash: hash))
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP:
// TODO: Add support for BLS keys.
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP, .bip0340:
// TODO: implement
throw TangemSdkError.unsupportedCurve
}
}
Expand Down
3 changes: 3 additions & 0 deletions TangemSdk/TangemSdk/Crypto/HDWallet/BIP32/BIP32.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ fileprivate extension EllipticCurve {
case .bls12381_G2, .bls12381_G2_AUG, .bls12381_G2_POP:
// https://eips.ethereum.org/EIPS/eip-2333#derive_master_sk
fatalError("not applicable for this curve")
case .bip0340:
// TODO: https://tangem.atlassian.net/browse/IOS-3606
fatalError("not applicable for this curve")
}
}
}

0 comments on commit 4d94be8

Please sign in to comment.