File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,18 @@ public struct Web3Signer {
2323 keystore: T ,
2424 account: EthereumAddress ,
2525 password: String ,
26+ useHash: Bool = true ,
2627 useExtraEntropy: Bool = false ) throws -> Data ? {
2728 var privateKey = try keystore. UNSAFE_getPrivateKeyData ( password: password, account: account)
2829 defer { Data . zero ( & privateKey) }
29- guard let hash = Utilities . hashPersonalMessage ( personalMessage) else { return nil }
30- let ( compressedSignature, _) = SECP256K1 . signForRecovery ( hash: hash,
30+ var data : Data
31+ if useHash {
32+ guard let hash = Utilities . hashPersonalMessage ( personalMessage) else { return nil }
33+ data = hash
34+ } else {
35+ data = personalMessage
36+ }
37+ let ( compressedSignature, _) = SECP256K1 . signForRecovery ( hash: data,
3138 privateKey: privateKey,
3239 useExtraEntropy: useExtraEntropy)
3340 return compressedSignature
You can’t perform that action at this time.
0 commit comments