Storage handlers

The storage handlers expose Ledger Wallet’s per-app key-value store to a Live App. Data is namespaced by application so two Live Apps cannot read or overwrite each other’s keys without an explicit storeId.

Method IDs

Method IDDirectionPurpose
storage.setLive App → WalletStore a string value under a given key.
storage.getLive App → WalletRetrieve a string value for a given key.

Both methods require the wallet to implement the matching walletHandler (storage.set / storage.get). If the wallet does not, the server throws an RpcError with code SERVER_ERROR (-32000) wrapping a not implemented by wallet server error.

storage.set

Stores a string value under the given key. The default store is the calling app’s appId from walletContext.config; pass storeId to write into a specific store.

Parameters

ParameterTypeRequiredNotes
keystringyesKey under which to store the value.
valuestringyesValue to store. The store only accepts strings; serialize objects yourself (for example with JSON.stringify).
storeIdstringnoStore to write into. Defaults to context.config.appId.

Result

Resolves with undefined (the schema is z.void().optional()).

Errors

ConditionError
key or value missing or wrong typeRpcError with code INVALID_PARAMS (-32602).
Wallet does not implement storage.setRpcError with code SERVER_ERROR (-32000), data wraps not implemented by wallet.

storage.get

Retrieves the value previously stored under key. Returns undefined if the key does not exist.

Parameters

ParameterTypeRequiredNotes
keystring (min length 1)yesKey to read.
storeIdstring (min length 1)noStore to read from. Defaults to context.config.appId.

Result

Resolves with { value: string | undefined }. The value is undefined when the key has never been set in the targeted store.

Errors

ConditionError
key missing, empty, or wrong typeRpcError with code INVALID_PARAMS (-32602).
Wallet does not implement storage.getRpcError with code SERVER_ERROR (-32000).

See also

Ledger
Copyright © Ledger SAS. All rights reserved. Ledger, Ledger Stax, Ledger Flex, Ledger Nano, Ledger Nano S, Ledger OS, Ledger Wallet, [LEDGER] (logo), [L] (logo) are trademarks owned by Ledger SAS.