Skip to content

Commit 169d06f

Browse files
authored
Add file '.spi.yml' to let SwiftPackageIndex.com host documentation. (#31)
1 parent aaa0ae0 commit 169d06f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.spi.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets: [K1]

Sources/K1/Support/FFI/API/ECDSA/FFI+ECDSA.swift

+8-3
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,14 @@ extension K1.ECDSA.SigningOptions.NonceFunction {
8585
_: UInt32 // In: how many iterations we have tried to find a nonce. This will almost always be 0, but different attempt values are required to result in a different nonce.
8686
) -> Int32 /* Returns: 1 if a nonce was successfully generated. 0 will cause signing to fail. */ in
8787

88-
SecureBytes(count: Curve.Field.byteCount).withUnsafeBytes {
89-
nonce32?.assign(from: $0.baseAddress!.assumingMemoryBound(to: UInt8.self), count: $0.count)
90-
}
88+
let count = Curve.Field.byteCount
89+
let secureBytes = SecureBytes(count: count)
90+
91+
#if swift(>=5.8)
92+
nonce32?.update(from: secureBytes.bytes, count: count)
93+
#else
94+
nonce32?.assign(from: secureBytes.bytes, count: count)
95+
#endif
9196

9297
// Returns: 1 if a nonce was successfully generated. 0 will cause signing to fail.
9398
return 1

0 commit comments

Comments
 (0)