File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,18 @@ public struct Web3Signer {
23
23
keystore: T ,
24
24
account: EthereumAddress ,
25
25
password: String ,
26
+ useHash: Bool = true ,
26
27
useExtraEntropy: Bool = false ) throws -> Data ? {
27
28
var privateKey = try keystore. UNSAFE_getPrivateKeyData ( password: password, account: account)
28
29
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,
31
38
privateKey: privateKey,
32
39
useExtraEntropy: useExtraEntropy)
33
40
return compressedSignature
You can’t perform that action at this time.
0 commit comments