Skip to main content
This page has been updated for Wallets SDK V1. If you are using the previous version, see the previous version docs or the V1 migration guide.
Defined in: packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:7

Extended by

Constructors

new DeviceSignerKeyStorage()

new DeviceSignerKeyStorage(apiKey): DeviceSignerKeyStorage
Defined in: packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:8

Parameters

ParameterType
apiKeystring

Returns

DeviceSignerKeyStorage

Methods

deleteKey()

abstract deleteKey(address): Promise<void>
Defined in: packages/wallets/src/utils/device-signers/DeviceSignerKeyStorage.ts:66 Delete the key pair associated with the given wallet address.

Parameters

ParameterTypeDescription
addressstringThe 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 Generate a new P-256 key pair and persist it.
Parameters
ParameterTypeDescription
params{ address: string; biometricPolicy: "always" | "none"; }Key generation parameters.
params.address?stringOptional wallet address to associate the key with. If omitted, the key should be stored under a temporary identifier until 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 Generate a new P-256 key pair and persist it.
Parameters
ParameterTypeDescription
params{ address: string; biometricExpirationTime: number; biometricPolicy: "session"; }Key generation parameters.
params.address?stringOptional wallet address to associate the key with. If omitted, the key should be stored under a temporary identifier until mapAddressToKey is called.
params.biometricExpirationTimenumber-
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 Generate a new P-256 key pair and persist it.
Parameters
ParameterTypeDescription
params{ address: string; biometricExpirationTime: number; biometricPolicy: BiometricPolicy; }Key generation parameters.
params.address?stringOptional wallet address to associate the key with. If omitted, the key should be stored under a temporary identifier until 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 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 Retrieve the public key for a given wallet address.

Parameters

ParameterTypeDescription
addressstringThe 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 Check if a key with the given public key exists on this device.

Parameters

ParameterTypeDescription
publicKeyBase64stringThe 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 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

ParameterTypeDescription
addressstringThe wallet address to map the key to.
publicKeyBase64stringThe base64-encoded public key returned by 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 Sign a message using the private key associated with the given wallet address.

Parameters

ParameterTypeDescription
addressstringThe wallet address whose private key to sign with.
messagestringThe 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.