Skip to content

Commit 5ca135b

Browse files
chore: formatting in Web3+Signing.swift
1 parent 5f38e99 commit 5ca135b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

Sources/web3swift/Web3/Web3+Signing.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Created by Alex Vlasov.
33
// Copyright © 2018 Alex Vlasov. All rights reserved.
44
//
5-
// Refactor to support EIP-2718 Enveloping by Mark Loit 2022
5+
// Refactor to support EIP-2718 Enveloping by Mark Loit 2022
66

77
import Foundation
88
import BigInt
@@ -27,7 +27,9 @@ public struct Web3Signer {
2727
var privateKey = try keystore.UNSAFE_getPrivateKeyData(password: password, account: account)
2828
defer { Data.zero(&privateKey) }
2929
guard let hash = Utilities.hashPersonalMessage(personalMessage) else { return nil }
30-
let (compressedSignature, _) = SECP256K1.signForRecovery(hash: hash, privateKey: privateKey, useExtraEntropy: useExtraEntropy)
30+
let (compressedSignature, _) = SECP256K1.signForRecovery(hash: hash,
31+
privateKey: privateKey,
32+
useExtraEntropy: useExtraEntropy)
3133
return compressedSignature
3234
}
3335

@@ -38,15 +40,15 @@ public struct Web3Signer {
3840
password: String? = nil,
3941
chainId: BigUInt? = nil) throws -> Data {
4042

41-
let domainSeparator: EIP712DomainHashable = EIP712Domain(chainId: chainId, verifyingContract: verifyingContract)
42-
43-
let password = password ?? ""
43+
let domainSeparator: EIP712Hashable = EIP712Domain(chainId: chainId, verifyingContract: verifyingContract)
4444
let hash = try eip712encode(domainSeparator: domainSeparator, message: eip712Hashable)
45-
46-
guard let signature = try Web3Signer.signPersonalMessage(hash, keystore: keystore, account: account, password: password) else {
45+
guard let signature = try Web3Signer.signPersonalMessage(hash,
46+
keystore: keystore,
47+
account: account,
48+
password: password ?? "")
49+
else {
4750
throw Web3Error.dataError
4851
}
49-
5052
return signature
5153
}
5254
}

0 commit comments

Comments
 (0)