@armada/sdk / index / EncryptedStore
Class: EncryptedStore
Defined in: src/storage/encrypted.ts:59
Wraps any StorageAdapter, transparently AEAD-encrypting values at rest. Each record carries a fresh 12-byte nonce prepended to the ciphertext, and the record KEY is bound as GCM associated data (AAD) so a ciphertext copied onto a different key fails to decrypt — an attacker with storage write access cannot cut-and-paste one record's blob over another. A tab crash / disk read leaks nothing without the key; get throws on a wrong key, a tampered blob, or a moved record (GCM auth failure).
The namespace is deliberately NOT part of the AAD: identity/durable records must survive a deploy-block change (which rewrites the namespace but not the wallet), and per-wallet keys already isolate one wallet's records from another's.
Implements
Constructors
Constructor
new EncryptedStore(
inner,key):EncryptedStore
Defined in: src/storage/encrypted.ts:60
Parameters
inner
key
Uint8Array
Returns
EncryptedStore
Methods
open()
open(
namespace):Promise<{reset:boolean; }>
Defined in: src/storage/encrypted.ts:69
Bind the store to namespace. Returns { reset: true } when a namespace mismatch (a redeploy under a preserved identity) triggered a chain-state reset, so the instance can surface it as telemetry.
Parameters
namespace
Returns
Promise<{ reset: boolean; }>
Implementation of
put()
put(
key,plaintext):Promise<void>
Defined in: src/storage/encrypted.ts:73
Parameters
key
string
plaintext
Uint8Array
Returns
Promise<void>
Implementation of
get()
get(
key):Promise<Uint8Array<ArrayBufferLike> |undefined>
Defined in: src/storage/encrypted.ts:82
Parameters
key
string
Returns
Promise<Uint8Array<ArrayBufferLike> | undefined>
Implementation of
list()
list(
prefix):AsyncIterable<{key:string;value:Uint8Array; }>
Defined in: src/storage/encrypted.ts:87
Iterate entries whose key starts with prefix (ordered).
Parameters
prefix
string
Returns
AsyncIterable<{ key: string; value: Uint8Array; }>
Implementation of
del()
del(
key):Promise<void>
Defined in: src/storage/encrypted.ts:93
Parameters
key
string
Returns
Promise<void>
Implementation of
resetChainState()
resetChainState():
Promise<void>
Defined in: src/storage/encrypted.ts:97
Targeted reset of chain-derived namespaces, preserving identity records.
Returns
Promise<void>
Implementation of
StorageAdapter.resetChainState
close()
close():
Promise<void>
Defined in: src/storage/encrypted.ts:101
Returns
Promise<void>