Skip to main content
Interim hand-authored reference. This page is authored from the SeamSDK public Swift sources. See the reference overview for context.

Overview

SeamCredential is a public struct that conforms to Sendable, Equatable, and Hashable. It represents a single access credential as an immutable value snapshot. Read credentials from Seam.shared.credentials; never construct them manually in production — the SDK manages their lifecycle.
public struct SeamCredential: Sendable, Equatable, Hashable
Notes
  • Instances are immutable snapshots. To get the latest state, read Seam.shared.credentials again or call Seam.shared.refresh().
  • Managed credentials (isManaged: true) are created and controlled by the Seam API. Unmanaged credentials (isManaged: false) are discovered directly by a provider integration running on-device.

Initializer

public init(
    id: String,
    isManaged: Bool,
    name: String,
    location: String,
    providerName: String?,
    expiry: Date?,
    cardNumber: String?,
    code: String?,
    supportedUnlockProximities: [SeamUnlockProximity],
    errors: [SeamCredentialError]
)
ParameterTypeDescription
idStringUnique identifier for this credential.
isManagedBooltrue if created by the Seam API; false if discovered by a provider integration.
nameStringDisplay name for this credential.
locationStringAssociated location (for example, building or door name).
providerNameString?Third-party provider (for example, "Latch", "Salto Space"), if any.
expiryDate?Expiration date, if the credential has one.
cardNumberString?Card number, if any.
codeString?Access code, if any.
supportedUnlockProximities[SeamUnlockProximity]Supported proximity levels, ordered by preference.
errors[SeamCredentialError]Active errors for this credential, in priority order.

Properties

PropertyTypeDescription
idStringThe unique identifier for this credential.
isManagedBoolWhether this credential was created and managed by the Seam API.
nameStringThe display name associated with this credential.
locationStringThe credential’s associated location.
expiryDate?The expiration date of the credential, if available.
cardNumberString?The card number associated with this credential, if any.
codeString?The access code associated with this credential, if any.
providerNameString?The third-party provider (for example, Latch, Salto Space) associated with this credential, if any.
supportedUnlockProximities[SeamUnlockProximity]Proximity levels this credential supports, ordered by preference.
errors[SeamCredentialError]Active errors affecting this credential, in priority order.

supportedUnlockProximities — Proximity Requirements

supportedUnlockProximities expresses the minimum physical proximity acceptable for an unlock using this credential. The array is ordered by preference:
  • When Seam.shared.unlock(using:proximity:timeout:) is called without specifying a proximity, the first value in this array is used as the default.
  • Callers may choose any supported value explicitly by passing a proximity: argument.
See also: SeamUnlockProximity, Seam.unlock(using:proximity:timeout:)

Example

let credential = SeamCredential(
    id: "123",
    isManaged: true,
    name: "Main Door",
    location: "Lobby",
    providerName: "Latch",
    expiry: Date().addingTimeInterval(3600),
    cardNumber: "0001",
    code: nil,
    supportedUnlockProximities: [.touch, .nearby],
    errors: []
)

// Check for errors before unlocking
if credential.errors.isEmpty {
    let publisher = try Seam.shared.unlock(using: credential.id)
}