createPendingCredential

suspend fun createPendingCredential(credentialId: String, publicKey: ByteArray, contractId: String, nickname: String? = null, transports: List<String>? = null, deviceType: String? = null, backedUp: Boolean? = null): StoredCredential

Creates a new pending credential in storage.

The credential is created with:

  • deploymentStatus: PENDING

  • isPrimary: false (set to true by wallet creation flow)

  • createdAt: current timestamp

Validation:

  • Public key must be exactly 65 bytes (uncompressed secp256r1 format)

  • Credential ID must not be empty

  • Credential ID must be unique (no existing credential with same ID)

Return

The newly created credential

Parameters

credentialId

The Base64URL-encoded credential ID (must be unique and non-empty)

publicKey

The uncompressed secp256r1 public key (must be 65 bytes)

contractId

The smart account contract address (C-address)

nickname

Optional user-friendly display name for the credential

transports

Authenticator transport hints (e.g., "usb", "nfc", "ble", "internal")

deviceType

Authenticator device type ("singleDevice" or "multiDevice")

backedUp

Whether the passkey is backed up or synced

Throws

if a credential with the same ID exists

if saving fails

Example:

val credential = manager.createPendingCredential(
credentialId = "abc123",
publicKey = publicKeyData,
contractId = "CBCD1234...",
nickname = "Alice",
transports = listOf("internal"),
deviceType = "multiDevice",
backedUp = true
)
println("Created credential: ${credential.credentialId}")