> ## Documentation Index
> Fetch the complete documentation index at: https://collinsboundlessfixyz.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CredentialManager

> Manage locally stored passkey credentials via kit.credentials.

## Overview

`CredentialManager` handles the local lifecycle of WebAuthn credentials - creating, saving, deploying, syncing, and deleting them. Access it via `kit.credentials`.

Credentials start as **pending** (registered but not yet deployed on-chain). After deployment, they become **active** and are associated with a smart account contract.

```
create() / save()  →  pending credential
deploy()           →  connects and deploys the wallet
sync() / syncAll() →  reconcile pending state with on-chain state
delete()           →  remove a pending credential that never deployed
```

## Methods

### `getAll()`

Return all stored credentials (both pending and active).

```typescript theme={null}
const all = await kit.credentials.getAll(); // StoredCredential[]
```

### `getForWallet()`

Return credentials associated with the currently connected wallet.

```typescript theme={null}
const creds = await kit.credentials.getForWallet(); // StoredCredential[]
```

### `getPending()`

Return credentials that are pending deployment.

```typescript theme={null}
const pending = await kit.credentials.getPending(); // StoredCredential[]
```

### `create()`

Register a new WebAuthn passkey and store the credential locally as pending.

```typescript theme={null}
const credential = await kit.credentials.create(options?: CreateCredentialOptions);
```

### `save()`

Save a pre-built credential object to local storage.

```typescript theme={null}
await kit.credentials.save(credential: StoredCredential);
```

### `deploy()`

Deploy a pending credential - moves it through the wallet connection flow and deploys the smart account contract.

```typescript theme={null}
const result = await kit.credentials.deploy(
  credentialId: string,
  options?: { autoSubmit?: boolean }
);
```

### `sync()`

Reconcile a single credential against on-chain state.

```typescript theme={null}
await kit.credentials.sync(credentialId: string);
```

### `syncAll()`

Reconcile all stored credentials against on-chain state. Useful on page load to clean up stale pending state.

```typescript theme={null}
await kit.credentials.syncAll();
```

### `delete()`

Remove a pending credential from local storage. Only use this for credentials that never deployed.

```typescript theme={null}
await kit.credentials.delete(credentialId: string);
```

<Warning>
  `delete()` only removes the local record. If the credential was used on-chain, it remains on the contract. Use `kit.signers.remove()` to remove an on-chain signer.
</Warning>

## Types

```typescript theme={null}
import type { StoredCredential, CredentialDeploymentStatus } from 'smart-account-kit';

interface StoredCredential {
  credentialId: string;
  contractId?: string;         // Set once deployed
  publicKey: string;
  status: CredentialDeploymentStatus; // 'pending' | 'failed'
  nickname?: string;
  createdAt: number;
}
```
