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

# DeviceSignerKeyStorage

<Note>
  **This page has been updated for Wallets SDK V1.** If you are using the previous version,
  see the [previous version docs](/wallets/v0/overview) or the [V1 migration guide](/wallets/guides/migrate-to-v1).
</Note>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:7](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L7)

## Extended by

* [`IframeDeviceSignerKeyStorage`](./IframeDeviceSignerKeyStorage)

## Constructors

### new DeviceSignerKeyStorage()

> **new DeviceSignerKeyStorage**(`apiKey`): `DeviceSignerKeyStorage`

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:8](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L8)

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `apiKey`  | `string` |

#### Returns

`DeviceSignerKeyStorage`

## Methods

### deleteKey()

> `abstract` **deleteKey**(`address`): `Promise`\<`void`>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:66](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L66)

Delete the key pair associated with the given wallet address.

#### Parameters

| Parameter | Type     | Description                                  |
| --------- | -------- | -------------------------------------------- |
| `address` | `string` | The wallet address whose key pair to remove. |

#### Returns

`Promise`\<`void`>

***

### generateKey()

#### Call Signature

> `abstract` **generateKey**(`params`): `Promise`\<`string`>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:17](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L17)

Generate a new P-256 key pair and persist it.

##### Parameters

| Parameter                 | Type                                                                 | Description                                                                                                                                                                 |
| ------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `params`                  | \{ `address`: `string`; `biometricPolicy`: `"always"` \| `"none"`; } | Key generation parameters.                                                                                                                                                  |
| `params.address`?         | `string`                                                             | Optional wallet address to associate the key with. If omitted, the key should be stored under a temporary identifier until [mapAddressToKey](./#mapaddresstokey) is called. |
| `params.biometricPolicy`? | `"always"` \| `"none"`                                               | -                                                                                                                                                                           |

##### Returns

`Promise`\<`string`>

The uncompressed public key encoded as a base64 string.

#### Call Signature

> `abstract` **generateKey**(`params`): `Promise`\<`string`>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:21](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L21)

Generate a new P-256 key pair and persist it.

##### Parameters

| Parameter                        | Type                                                                                           | Description                                                                                                                                                                 |
| -------------------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `params`                         | \{ `address`: `string`; `biometricExpirationTime`: `number`; `biometricPolicy`: `"session"`; } | Key generation parameters.                                                                                                                                                  |
| `params.address`?                | `string`                                                                                       | Optional wallet address to associate the key with. If omitted, the key should be stored under a temporary identifier until [mapAddressToKey](./#mapaddresstokey) is called. |
| `params.biometricExpirationTime` | `number`                                                                                       | -                                                                                                                                                                           |
| `params.biometricPolicy`         | `"session"`                                                                                    | -                                                                                                                                                                           |

##### Returns

`Promise`\<`string`>

The uncompressed public key encoded as a base64 string.

#### Call Signature

> `abstract` **generateKey**(`params`): `Promise`\<`string`>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:26](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L26)

Generate a new P-256 key pair and persist it.

##### Parameters

| Parameter                         | Type                                                                                                 | Description                                                                                                                                                                 |
| --------------------------------- | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `params`                          | \{ `address`: `string`; `biometricExpirationTime`: `number`; `biometricPolicy`: `BiometricPolicy`; } | Key generation parameters.                                                                                                                                                  |
| `params.address`?                 | `string`                                                                                             | Optional wallet address to associate the key with. If omitted, the key should be stored under a temporary identifier until [mapAddressToKey](./#mapaddresstokey) is called. |
| `params.biometricExpirationTime`? | `number`                                                                                             | -                                                                                                                                                                           |
| `params.biometricPolicy`?         | `BiometricPolicy`                                                                                    | -                                                                                                                                                                           |

##### Returns

`Promise`\<`string`>

The uncompressed public key encoded as a base64 string.

***

### getDeviceName()

> `abstract` **getDeviceName**(): `string`

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:73](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L73)

Get a human-readable name for this device (e.g. "MacBook Pro", "iPhone 15").
Used to label device signers in the API for identification purposes.

#### Returns

`string`

A descriptive name for the current device.

***

### getKey()

> `abstract` **getKey**(`address`): `Promise`\<`string` | `null`>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:45](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L45)

Retrieve the public key for a given wallet address.

#### Parameters

| Parameter | Type     | Description                                     |
| --------- | -------- | ----------------------------------------------- |
| `address` | `string` | The wallet address whose public key to look up. |

#### Returns

`Promise`\<`string` | `null`>

The base64-encoded public key, or `null` if no key is found for the address.

***

### hasKey()

> `abstract` **hasKey**(`publicKeyBase64`): `Promise`\<`boolean`>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:52](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L52)

Check if a key with the given public key exists on this device.

#### Parameters

| Parameter         | Type     | Description                                |
| ----------------- | -------- | ------------------------------------------ |
| `publicKeyBase64` | `string` | The base64-encoded public key to look for. |

#### Returns

`Promise`\<`boolean`>

`true` if the key exists on the device, `false` otherwise.

***

### mapAddressToKey()

> `abstract` **mapAddressToKey**(`address`, `publicKeyBase64`): `Promise`\<`void`>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:38](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L38)

Associate an already-generated key pair with a wallet address.
Used when the wallet address is not yet known at the time of key generation.

#### Parameters

| Parameter         | Type     | Description                                                              |
| ----------------- | -------- | ------------------------------------------------------------------------ |
| `address`         | `string` | The wallet address to map the key to.                                    |
| `publicKeyBase64` | `string` | The base64-encoded public key returned by [generateKey](./#generatekey). |

#### Returns

`Promise`\<`void`>

***

### signMessage()

> `abstract` **signMessage**(`address`, `message`): `Promise`\<\{ `r`: `string`; `s`: `string`; }>

Defined in: [packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:60](https://github.com/Crossmint/crossmint-sdk/blob/main/packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts#L60)

Sign a message using the private key associated with the given wallet address.

#### Parameters

| Parameter | Type     | Description                                        |
| --------- | -------- | -------------------------------------------------- |
| `address` | `string` | The wallet address whose private key to sign with. |
| `message` | `string` | The message string to sign.                        |

#### Returns

`Promise`\<\{ `r`: `string`; `s`: `string`; }>

The ECDSA signature split into its `r` and `s` components, each as a hex string.
