Skip to content

Commit e1b0306

Browse files
Merge pull request #481 from mloit/fix-random-init
2 parents e6f526e + 17d7321 commit e1b0306

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Sources/web3swift/Convenience/Data+Extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public extension Data {
6666
let result = data.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) -> Int32? in
6767
if let bodyAddress = body.baseAddress, body.count > 0 {
6868
let pointer = bodyAddress.assumingMemoryBound(to: UInt8.self)
69-
return SecRandomCopyBytes(kSecRandomDefault, 32, pointer)
69+
return SecRandomCopyBytes(kSecRandomDefault, length, pointer)
7070
} else {
7171
return nil
7272
}

Sources/web3swift/Convenience/SECP256k1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ extension SECP256K1 {
343343
let result = data.withUnsafeMutableBytes { (mutableRBBytes) -> Int32? in
344344
if let mutableRBytes = mutableRBBytes.baseAddress, mutableRBBytes.count > 0 {
345345
let mutableBytes = mutableRBytes.assumingMemoryBound(to: UInt8.self)
346-
return SecRandomCopyBytes(kSecRandomDefault, 32, mutableBytes)
346+
return SecRandomCopyBytes(kSecRandomDefault, length, mutableBytes)
347347
} else {
348348
return nil
349349
}

Sources/web3swift/KeystoreManager/EthereumKeystoreV3.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class EthereumKeystoreV3: AbstractKeystore {
9696
if (keyData == nil) {
9797
throw AbstractKeystoreError.encryptionError("Encryption without key data")
9898
}
99-
let saltLen = 32;
99+
let saltLen = 32
100100
guard let saltData = Data.randomBytes(length: saltLen) else {
101101
throw AbstractKeystoreError.noEntropyError
102102
}

0 commit comments

Comments
 (0)