Skip to content

ServerSideSecretStorageImpl

Defined in: src/secret-storage.ts:343

Implementation of Server-side secret storage.

Secret sharing is not implemented here: this class is strictly about the storage component of SSSS.

https://spec.matrix.org/v1.6/client-server-api/#storage

new ServerSideSecretStorageImpl(accountDataAdapter, callbacks): ServerSideSecretStorageImpl

Defined in: src/secret-storage.ts:354

Construct a new SecretStorage.

Normally, it is unnecessary to call this directly, since DigitalWorldClient automatically constructs one. However, it may be useful to construct a new SecretStorage, if custom callbacks are required, for example.

AccountDataClient

interface for fetching and setting account data on the server. Normally an instance of DigitalWorldClient.

SecretStorageCallbacks

application level callbacks for retrieving secret keys

ServerSideSecretStorageImpl

addKey(algorithm, opts, keyId?): Promise<SecretStorageKeyObject>

Defined in: src/secret-storage.ts:417

Add a key for encrypting secrets.

string

the algorithm used by the key.

AddSecretStorageKeyOpts

the options for the algorithm. The properties used depend on the algorithm given.

string

the ID of the key. If not given, a random ID will be generated.

Promise<SecretStorageKeyObject>

An object with: keyId: the ID of the key keyInfo: details about the key (iv, mac, passphrase)

ServerSideSecretStorage.addKey


checkKey(key, info): Promise<boolean>

Defined in: src/secret-storage.ts:496

Check whether a key matches what we expect based on the key info

Uint8Array<ArrayBuffer>

the key to check

SecretStorageKeyDescriptionAesV1

the key info

Promise<boolean>

whether or not the key matches

ServerSideSecretStorage.checkKey


get(name): Promise<string | undefined>

Defined in: src/secret-storage.ts:567

Get a secret from storage, and decrypt it.

SecretStorageCallbacks#getSecretStorageKey will be called to obtain a secret storage key to decrypt the secret.

keyof SecretStorageAccountDataEvents

the name of the secret - i.e., the “event type” stored in the account data

Promise<string | undefined>

the decrypted contents of the secret, or “undefined” if name is not found in the user’s account data.

ServerSideSecretStorage.get


getDefaultKeyId(): Promise<string | null>

Defined in: src/secret-storage.ts:364

Get the current default key ID for encrypting secrets.

Promise<string | null>

The default key ID or null if no default key ID is set

ServerSideSecretStorage.getDefaultKeyId


getKey(keyId?): Promise<SecretStorageKeyTuple | null>

Defined in: src/secret-storage.ts:464

Get the key information for a given ID.

string | null

The ID of the key to check for. Defaults to the default key ID if not provided.

Promise<SecretStorageKeyTuple | null>

If the key was found, the return value is an array of the form [keyId, keyInfo]. Otherwise, null is returned. XXX: why is this an array when addKey returns an object?

ServerSideSecretStorage.getKey


hasKey(keyId?): Promise<boolean>

Defined in: src/secret-storage.ts:483

Check whether we have a key with a given ID.

string

The ID of the key to check for. Defaults to the default key ID if not provided.

Promise<boolean>

Whether we have the key.

ServerSideSecretStorage.hasKey


isStored(name): Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null>

Defined in: src/secret-storage.ts:613

Check if a secret is stored on the server.

keyof SecretStorageAccountDataEvents

the name of the secret

Promise<Record<string, SecretStorageKeyDescriptionAesV1> | null>

map of key name to key info the secret is encrypted with, or null if it is not present or not encrypted with a trusted key

ServerSideSecretStorage.isStored


setDefaultKeyId(keyId): Promise<void>

Defined in: src/secret-storage.ts:373

Implementation of ServerSideSecretStorage#setDefaultKeyId.

string | null

Promise<void>

ServerSideSecretStorage.setDefaultKeyId


store(name, secret, keys?): Promise<void>

Defined in: src/secret-storage.ts:513

Implementation of ServerSideSecretStorage#store.

keyof SecretStorageAccountDataEvents

string | null

string[] | null

Promise<void>

ServerSideSecretStorage.store