Skip to content

Commit

Permalink
Add file '.spi.yml' to let SwiftPackageIndex.com host documentation. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajjon committed Mar 26, 2023
1 parent aaa0ae0 commit 169d06f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1
builder:
configs:
- documentation_targets: [K1]
11 changes: 8 additions & 3 deletions Sources/K1/Support/FFI/API/ECDSA/FFI+ECDSA.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ extension K1.ECDSA.SigningOptions.NonceFunction {
_: 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.
) -> Int32 /* Returns: 1 if a nonce was successfully generated. 0 will cause signing to fail. */ in

SecureBytes(count: Curve.Field.byteCount).withUnsafeBytes {
nonce32?.assign(from: $0.baseAddress!.assumingMemoryBound(to: UInt8.self), count: $0.count)
}
let count = Curve.Field.byteCount
let secureBytes = SecureBytes(count: count)

#if swift(>=5.8)
nonce32?.update(from: secureBytes.bytes, count: count)
#else
nonce32?.assign(from: secureBytes.bytes, count: count)
#endif

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

0 comments on commit 169d06f

Please sign in to comment.