Instance Method
signature(message:auxiliaryRand:strict:)
Generates a Schnorr signature over an arbitrary-length message using secp256k1_schnorrsig_sign_custom.
- iOS 13.0+
- macCatalyst 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
- watchOS 6.0+
func signature(message: inout [UInt8], auxiliaryRand: UnsafeMutableRawPointer?, strict: Bool = false) throws -> P256K.Schnorr.SchnorrSignature
Parameters
-
message
-
The message bytes to sign (any length unless strict is true).
-
auxiliaryRand
-
Pointer to 32 bytes of auxiliary randomness, or nil to use zero auxiliary data.
-
strict
-
If true, throws secp256k1Error.incorrectParameterSize when message.count is not 32.
Return Value
A 64-byte P256K.Schnorr.SchnorrSignature.
Discussion
Unlike the Digest-based overloads, this method accepts any message length and passes it directly to secp256k1_schnorrsig_sign_custom. If auxiliaryRand is nil, secp256k1_nonce_function_bip340 sets the auxiliary random data to zero. Pass a pointer to 32 bytes for full BIP-340 compliant nonce derivation.
Throws
secp256k1Error.incorrectParameterSize if strict is true and the message is not 32 bytes; secp256k1Error.underlyingCryptoError if signing fails.