Protocols
The following protocols are available globally.
-
Protocol defining the interface for transaction memos that attach messages or data to Stellar transactions.
See moreDeclaration
Swift
public protocol MemoProtocol : Sendable -
Protocol for memos containing hash values with hex encoding capabilities.
See moreDeclaration
Swift
public protocol MemoHashProtocol : Sendable -
Specifies protocol for Account object used when creating an Transaction object.
See moreDeclaration
Swift
public protocol TransactionAccount : Sendable
-
Platform-specific WebAuthn provider interface.
Implementations trigger platform biometric / security-key prompts, handle WebAuthn credential creation and assertion, and return properly formatted byte-array results.
Sendableis required because the protocol crosses actor / task boundaries when invoked from the smart-account transaction pipeline.Errors thrown from
registerorauthenticateare subclasses ofWebAuthnException(defined in the smart-account error module):RegistrationFailed,AuthenticationFailed,NotSupported, orCancelled.Example:
See morelet provider: WebAuthnProvider = MyApplePasskeyProvider() let registration = try await provider.register( challenge: challenge, userId: userIdBytes, userName: "user@example.com" )Declaration
Swift
public protocol WebAuthnProvider : Sendable -
Adapter protocol for external Ed25519 signing sources.
Conform to this protocol to plug in a hardware wallet, remote signing service, or any other out-of-process Ed25519 signing backend into the multi-signer pipeline. The manager consults the adapter before falling back to its in-memory keypair registry (adapter-first precedence rule).
Example:
See morefinal class MyHardwareWalletAdapter: OZExternalEd25519SignerAdapter { func canSignFor(verifierAddress: String, publicKey: Data) -> Bool { hardwareWallet.hasSigner(for: publicKey) } func signAuthDigest(authDigest: Data, publicKey: Data) async throws -> Data { try await hardwareWallet.sign(digest: authDigest, publicKey: publicKey) } }Declaration
Swift
public protocol OZExternalEd25519SignerAdapter : Sendable -
Base type for OpenZeppelin smart-account signature variants.
Smart accounts support multiple signature types for transaction authorization:
OZWebAuthnSignaturefor passkey / biometric authentication signatures.OZEd25519Signaturefor traditional Ed25519 keypair signatures.OZPolicySignatureas a marker for policy-based authorization (an empty map).
Each variant converts to the
SCValXDRrepresentation expected by the on-chain verifier contract. The shape differs per variant:- WebAuthn:
SCValXDR.mapwith alphabetically-ordered keys. - Ed25519:
SCValXDR.bytescontaining the raw 64-byte signature. - Policy:
SCValXDR.map([])(empty map).
Example:
See morelet signature = try OZWebAuthnSignature( authenticatorData: authenticatorDataBytes, clientData: clientDataBytes, signature: signatureBytes ) let scVal = signature.toScVal()Declaration
Swift
public protocol OZSmartAccountSignature : Sendable -
Represents a signer that can authorize OpenZeppelin Smart Account transactions.
Smart account signers describe who can authorize transactions on the wallet contract. Two concrete signer types exist:
OZDelegatedSigner: A Soroban address (G…for accounts orC…for contracts) using the host’s built-inrequire_authverification.OZExternalSigner: A verifier-contract address combined with public-key bytes that describe a custom signature scheme (e.g. WebAuthn / secp256r1, Ed25519).
Example:
See morelet delegated = try OZDelegatedSigner(address: "<G-address>") let webAuthn = try OZExternalSigner.webAuthn( verifierAddress: "CBCD...", publicKey: publicKeyBytes, credentialId: credentialIdBytes ) let scVal = try delegated.toScVal()Declaration
Swift
public protocol OZSmartAccountSigner : Sendable -
Protocol for persisting smart account credentials and sessions.
Storage adapters provide a pluggable persistence layer for credentials and sessions. Implementations must be thread-safe and support concurrent access.
The default implementation is
See moreOZInMemoryStorageAdapter, which stores data in memory only. Platform-specific implementations can provide persistent storage.Declaration
Swift
public protocol OZStorageAdapter : AnyObject, Sendable -
Protocol for integrating external wallet adapters for multi-signer support.
External wallet adapters enable signing with external wallets like Freighter or Albedo for multi-signature smart accounts. They handle wallet connection and signature collection.
Example implementation:
See morefinal class FreighterAdapter: OZExternalWalletAdapter { func connect() async throws -> OZConnectedWallet? { return OZConnectedWallet(address: "G...", walletId: "freighter", walletName: "Freighter") } func signAuthEntry( preimageXdr: String, options: OZSignAuthEntryOptions? ) async throws -> OZSignAuthEntryResult { // Decode preimage, hash with SHA-256, sign with Ed25519, return result. } // ... remaining members ... }Declaration
Swift
public protocol OZExternalWalletAdapter : AnyObject, Sendable -
Protocol for fixed-size binary data wrappers used in XDR encoding.
WrappedData provides a type-safe way to handle fixed-size byte arrays in Stellar’s XDR protocol. Common sizes include 4, 12, and 32 bytes for various key types and hashes.
See moreDeclaration
Swift
public protocol WrappedData : Equatable, XDRDecodable, XDREncodable -
A protocol for types which can be decoded from binary.
See moreDeclaration
Swift
public protocol XDRDecodable : Decodable, Sendable -
A protocol for types which can be encoded to binary.
See moreDeclaration
Swift
public protocol XDREncodable : Encodable, Sendable
View on GitHub
Install in Dash
Protocols Reference