OZStoredCredential

public struct OZStoredCredential : Sendable
extension OZStoredCredential: Equatable
extension OZStoredCredential: Hashable

A stored smart account credential with deployment and usage metadata.

Represents a WebAuthn credential (passkey) associated with a smart account. Tracks the credential’s deployment status, contract address, and usage history.

Example:

let credential = OZStoredCredential(
    credentialId: "base64url-encoded-id",
    publicKey: secp256r1PublicKeyData,
    contractId: "CBCD1234...",
    deploymentStatus: .pending,
    isPrimary: true
)
  • The WebAuthn credential ID (Base64URL encoded).

    Declaration

    Swift

    public let credentialId: String
  • The uncompressed secp256r1 public key (65 bytes, 0x04-prefixed).

    Declaration

    Swift

    public let publicKey: Data
  • The smart account contract address (C… strkey).

    Set during wallet creation. nil if the contract address has not been derived yet.

    Declaration

    Swift

    public let contractId: String?
  • The current deployment status of the smart account contract.

    Declaration

    Swift

    public let deploymentStatus: OZCredentialDeploymentStatus
  • Error message if deployment failed.

    Declaration

    Swift

    public let deploymentError: String?
  • Timestamp of when this credential was created (milliseconds since epoch).

    Declaration

    Swift

    public let createdAt: Int64
  • Timestamp of when this credential was last used for signing (milliseconds since epoch).

    Updated after successful transaction signatures.

    Declaration

    Swift

    public let lastUsedAt: Int64?
  • Optional user-friendly nickname for this credential.

    Example: "MacBook Pro Touch ID", "YubiKey 5".

    Declaration

    Swift

    public let nickname: String?
  • Whether this is the primary credential for this smart account.

    The primary credential is used as the default for signing operations.

    Declaration

    Swift

    public let isPrimary: Bool
  • Authenticator transport hints indicating how the platform can communicate with the authenticator (for example "usb", "nfc", "ble", "internal").

    Used when constructing allowCredentials for future authentication ceremonies, which helps the platform select the correct authenticator more efficiently.

    Declaration

    Swift

    public let transports: [String]?
  • Authenticator device type.

    • "singleDevice": hardware security key (not synced).
    • "multiDevice": synced / cloud-backed passkey (available across devices).

    Corresponds to the credentialDeviceType field in WebAuthn authenticator data flags.

    Declaration

    Swift

    public let deviceType: String?
  • Whether the passkey is backed up or synced to a cloud provider.

    When true, the credential is available across the user’s devices via iCloud Keychain, Google Password Manager, or similar sync services. Corresponds to the credentialBackedUp flag in WebAuthn authenticator data.

    Declaration

    Swift

    public let backedUp: Bool?
  • Undocumented

    Declaration

    Swift

    public init(
        credentialId: String,
        publicKey: Data,
        contractId: String? = nil,
        deploymentStatus: OZCredentialDeploymentStatus = .pending,
        deploymentError: String? = nil,
        createdAt: Int64 = Int64(Date().timeIntervalSince1970 * 1000),
        lastUsedAt: Int64? = nil,
        nickname: String? = nil,
        isPrimary: Bool = false,
        transports: [String]? = nil,
        deviceType: String? = nil,
        backedUp: Bool? = nil
    )
  • Returns a new credential with non-nil fields from updates applied to this credential.

    Fields in updates that are nil are left unchanged. This is the partial-update semantic that OZStorageAdapter.update uses internally.

    Declaration

    Swift

    public func applyUpdate(_ updates: OZStoredCredentialUpdate) -> OZStoredCredential
  • Two stored credentials are equal when every field matches.

    The publicKey field is compared in constant time so timing measurements do not leak how many leading bytes of two compared keys agree, which protects secret-bearing byte sequences from side-channel inference.

    Declaration

    Swift

    public static func == (lhs: OZStoredCredential, rhs: OZStoredCredential) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)