OZExternalSigner
public struct OZExternalSigner : OZSmartAccountSigner, Equatable, Hashable
A signer that delegates signature verification to a custom verifier contract.
External signers point at a verifier contract (C… strkey) and carry the public-key
bytes (and any auxiliary authentication data) the verifier needs. This enables
non-native signature schemes such as WebAuthn (secp256r1) and Ed25519 to drive Smart
Account authorization.
Use the webAuthn and ed25519 factory methods for the two well-known schemes; the
raw initializer is available when integrating with a custom verifier.
Example:
let webAuthn = try OZExternalSigner.webAuthn(
verifierAddress: "CBCD1234...",
publicKey: secp256r1PublicKey,
credentialId: credentialId
)
let ed25519 = try OZExternalSigner.ed25519(
verifierAddress: "CDEF5678...",
publicKey: ed25519PublicKey
)
-
Contract address (
C…strkey) of the signature verifier.Declaration
Swift
public let verifierAddress: String -
Public-key bytes plus any auxiliary authentication data (for example, a WebAuthn credential id appended to the public key).
Declaration
Swift
public let keyData: Data -
Initializes a new
OZExternalSignerwith raw verifier address and key data.Most callers should prefer the
webAuthnored25519factories, which validate the concrete public-key format before constructing the signer.Throws
SmartAccountValidationException.InvalidAddressifverifierAddressis not a valid contract strkey;SmartAccountValidationException.InvalidInputifkeyDatais empty.Declaration
Swift
public init(verifierAddress: String, keyData: Data) throwsParameters
verifierAddressContract address (
C…strkey) of the signature verifier.keyDataPublic-key bytes plus any auxiliary authentication data; must not be empty.
-
Converts the external signer to its on-chain representation.
Returns an
SCValXDR.vec([Symbol("External"), Address(verifierAddress), Bytes(keyData)]).Throws
SmartAccountValidationException.InvalidInputif the verifier address cannot be encoded into anSCAddressXDR.Declaration
Swift
public func toScVal() throws -> SCValXDRReturn Value
The
SCValXDRrepresentation of this signer. -
Declaration
Swift
public var uniqueKey: String { get } -
Uses constant-time byte comparison via
Data.constantTimeEqualsforkeyData— see that extension for the timing-attack rationale. Both fields are always evaluated regardless of the address result (bitwise AND, not short-circuit).Declaration
Swift
public static func == (lhs: OZExternalSigner, rhs: OZExternalSigner) -> BoolParameters
lhsThe first signer to compare.
rhsThe second signer to compare.
Return Value
truewhen bothverifierAddressandkeyDatamatch. -
Declaration
Swift
public func hash(into hasher: inout Hasher) -
Creates a WebAuthn external signer using an uncompressed secp256r1 public key.
The resulting signer’s
keyDataispublicKey || credentialId, matching the layout expected by WebAuthn verifier contracts.Throws
SmartAccountValidationException.InvalidInputifpublicKeyis the wrong size, has the wrong leading byte, orcredentialIdis empty.SmartAccountValidationException.InvalidAddressifverifierAddressis not a validC…strkey.
Declaration
Swift
public static func webAuthn( verifierAddress: String, publicKey: Data, credentialId: Data ) throws -> OZExternalSignerParameters
verifierAddressContract address (
C…strkey) of the WebAuthn verifier.publicKeyUncompressed secp256r1 public key (
SmartAccountConstants.secp256r1PublicKeySizebytes; first byte must equalSmartAccountConstants.uncompressedPubkeyPrefix).credentialIdWebAuthn credential identifier; must not be empty.
Return Value
An
OZExternalSignerconfigured for WebAuthn signature verification. -
Creates an Ed25519 external signer using a 32-byte Ed25519 public key.
Throws
SmartAccountValidationException.InvalidInputifpublicKeyis not 32 bytes long.SmartAccountValidationException.InvalidAddressifverifierAddressis not a validC…strkey.
Declaration
Swift
public static func ed25519( verifierAddress: String, publicKey: Data ) throws -> OZExternalSignerParameters
verifierAddressContract address (
C…strkey) of the Ed25519 verifier.publicKeyEd25519 public key (
SmartAccountConstants.ed25519PublicKeySizebytes).Return Value
An
OZExternalSignerconfigured for Ed25519 signature verification.
View on GitHub
Install in Dash