1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Clarify client-level method for adding secret storage keys

This commit is contained in:
J. Ryan Stinnett
2019-12-04 13:45:56 +00:00
parent 9dc61faa6f
commit eeffe208ec
3 changed files with 7 additions and 6 deletions

View File

@@ -163,7 +163,7 @@ describe("Secrets", function() {
}; };
alice.resetCrossSigningKeys(); alice.resetCrossSigningKeys();
const newKeyId = await alice.addSecretKey( const newKeyId = await alice.addSecretStorageKey(
SECRET_STORAGE_ALGORITHM_V1, SECRET_STORAGE_ALGORITHM_V1,
); );
// we don't await on this because it waits for the event to come down the sync // we don't await on this because it waits for the event to come down the sync

View File

@@ -1062,7 +1062,7 @@ MatrixClient.prototype.checkEventSenderTrust = async function(event) {
* Add a key for encrypting secrets. * Add a key for encrypting secrets.
* The Secure Secret Storage API is currently UNSTABLE and may change without notice. * The Secure Secret Storage API is currently UNSTABLE and may change without notice.
* *
* @function module:client~MatrixClient#addSecretKey * @function module:client~MatrixClient#addSecretStorageKey
* @param {string} algorithm the algorithm used by the key * @param {string} algorithm the algorithm used by the key
* @param {object} opts the options for the algorithm. The properties used * @param {object} opts the options for the algorithm. The properties used
* depend on the algorithm given. This object may be modified to pass * depend on the algorithm given. This object may be modified to pass
@@ -1136,7 +1136,7 @@ MatrixClient.prototype.checkEventSenderTrust = async function(event) {
wrapCryptoFuncs(MatrixClient, [ wrapCryptoFuncs(MatrixClient, [
"bootstrapSecretStorage", "bootstrapSecretStorage",
"addSecretKey", "addSecretStorageKey",
"storeSecret", "storeSecret",
"getSecret", "getSecret",
"isSecretStored", "isSecretStored",

View File

@@ -332,7 +332,8 @@ Crypto.prototype.init = async function() {
* called to await a secret storage key creation flow. * called to await a secret storage key creation flow.
* Returns: * Returns:
* {Promise} A promise which resolves to key creation data for * {Promise} A promise which resolves to key creation data for
* `addSecretKey`: an object with either `passphrase` or `privkey` fields. * SecretStorage#addKey: an object with either `passphrase` or `privkey`
* fields.
*/ */
Crypto.prototype.bootstrapSecretStorage = async function({ Crypto.prototype.bootstrapSecretStorage = async function({
authUploadDeviceSigningKeys, authUploadDeviceSigningKeys,
@@ -371,7 +372,7 @@ Crypto.prototype.bootstrapSecretStorage = async function({
if (!this._secretStorage.hasKey()) { if (!this._secretStorage.hasKey()) {
logger.log("Secret storage default key not found, creating new key"); logger.log("Secret storage default key not found, creating new key");
const keyOptions = await createSecretStorageKey(); const keyOptions = await createSecretStorageKey();
const newKeyId = await this.addSecretKey( const newKeyId = await this.addSecretStorageKey(
SECRET_STORAGE_ALGORITHM_V1, SECRET_STORAGE_ALGORITHM_V1,
keyOptions, keyOptions,
); );
@@ -395,7 +396,7 @@ Crypto.prototype.bootstrapSecretStorage = async function({
logger.log("Secure Secret Storage ready"); logger.log("Secure Secret Storage ready");
}; };
Crypto.prototype.addSecretKey = function(algorithm, opts, keyID) { Crypto.prototype.addSecretStorageKey = function(algorithm, opts, keyID) {
return this._secretStorage.addKey(algorithm, opts, keyID); return this._secretStorage.addKey(algorithm, opts, keyID);
}; };