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
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”accountDataAdapter
Section titled “accountDataAdapter”interface for fetching and setting account data on the server. Normally an instance of DigitalWorldClient.
callbacks
Section titled “callbacks”application level callbacks for retrieving secret keys
Returns
Section titled “Returns”ServerSideSecretStorageImpl
Methods
Section titled “Methods”addKey()
Section titled “addKey()”addKey(
algorithm,opts,keyId?):Promise<SecretStorageKeyObject>
Defined in: src/secret-storage.ts:417
Add a key for encrypting secrets.
Parameters
Section titled “Parameters”algorithm
Section titled “algorithm”string
the algorithm used by the key.
the options for the algorithm. The properties used depend on the algorithm given.
keyId?
Section titled “keyId?”string
the ID of the key. If not given, a random ID will be generated.
Returns
Section titled “Returns”Promise<SecretStorageKeyObject>
An object with: keyId: the ID of the key keyInfo: details about the key (iv, mac, passphrase)
Implementation of
Section titled “Implementation of”ServerSideSecretStorage.addKey
checkKey()
Section titled “checkKey()”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
Parameters
Section titled “Parameters”Uint8Array<ArrayBuffer>
the key to check
SecretStorageKeyDescriptionAesV1
the key info
Returns
Section titled “Returns”Promise<boolean>
whether or not the key matches
Implementation of
Section titled “Implementation of”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.
Parameters
Section titled “Parameters”keyof SecretStorageAccountDataEvents
the name of the secret - i.e., the “event type” stored in the account data
Returns
Section titled “Returns”Promise<string | undefined>
the decrypted contents of the secret, or “undefined” if name is not found in
the user’s account data.
Implementation of
Section titled “Implementation of”getDefaultKeyId()
Section titled “getDefaultKeyId()”getDefaultKeyId():
Promise<string|null>
Defined in: src/secret-storage.ts:364
Get the current default key ID for encrypting secrets.
Returns
Section titled “Returns”Promise<string | null>
The default key ID or null if no default key ID is set
Implementation of
Section titled “Implementation of”ServerSideSecretStorage.getDefaultKeyId
getKey()
Section titled “getKey()”getKey(
keyId?):Promise<SecretStorageKeyTuple|null>
Defined in: src/secret-storage.ts:464
Get the key information for a given ID.
Parameters
Section titled “Parameters”keyId?
Section titled “keyId?”string | null
The ID of the key to check for. Defaults to the default key ID if not provided.
Returns
Section titled “Returns”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?
Implementation of
Section titled “Implementation of”ServerSideSecretStorage.getKey
hasKey()
Section titled “hasKey()”hasKey(
keyId?):Promise<boolean>
Defined in: src/secret-storage.ts:483
Check whether we have a key with a given ID.
Parameters
Section titled “Parameters”keyId?
Section titled “keyId?”string
The ID of the key to check for. Defaults to the default key ID if not provided.
Returns
Section titled “Returns”Promise<boolean>
Whether we have the key.
Implementation of
Section titled “Implementation of”ServerSideSecretStorage.hasKey
isStored()
Section titled “isStored()”isStored(
name):Promise<Record<string,SecretStorageKeyDescriptionAesV1> |null>
Defined in: src/secret-storage.ts:613
Check if a secret is stored on the server.
Parameters
Section titled “Parameters”keyof SecretStorageAccountDataEvents
the name of the secret
Returns
Section titled “Returns”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
Implementation of
Section titled “Implementation of”ServerSideSecretStorage.isStored
setDefaultKeyId()
Section titled “setDefaultKeyId()”setDefaultKeyId(
keyId):Promise<void>
Defined in: src/secret-storage.ts:373
Implementation of ServerSideSecretStorage#setDefaultKeyId.
Parameters
Section titled “Parameters”string | null
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”ServerSideSecretStorage.setDefaultKeyId
store()
Section titled “store()”store(
name,secret,keys?):Promise<void>
Defined in: src/secret-storage.ts:513
Implementation of ServerSideSecretStorage#store.
Parameters
Section titled “Parameters”keyof SecretStorageAccountDataEvents
secret
Section titled “secret”string | null
string[] | null
Returns
Section titled “Returns”Promise<void>