index : matrix-js-sdk

My fork of matrix-js-sdk

diff options
context:
space:
mode:
authorBruno Windels <[email protected]>2020-06-17 15:34:30 +0200
committerBruno Windels <[email protected]>2020-06-17 15:34:30 +0200
commitc5eb290e66a6b0081f8a1b1a1dc8631ea25d17f1 (patch)
treea9b320db888007f11e8977895a3eba08e012c29b
parentd3b2c8246daa718d34212703ada41f316834333a (diff)
downloadmatrix-js-sdk-c5eb290e66a6b0081f8a1b1a1dc8631ea25d17f1.tar.gz
remove resetCrossSigningKeys
it was only used by the bootstrap method in js-sdk, and was not used in react-sdk either. This is a breaking change, in case anything other than react-sdk was using this.
-rw-r--r--src/client.js12
-rw-r--r--src/crypto/index.js52
2 files changed, 1 insertions, 63 deletions
diff --git a/src/client.js b/src/client.js
index fc73b41f..345b979f 100644
--- a/src/client.js
+++ b/src/client.js
@@ -1075,17 +1075,6 @@ function wrapCryptoFuncs(MatrixClient, names) {
}
}
- /**
- * Generate new cross-signing keys.
- * The cross-signing API is currently UNSTABLE and may change without notice.
- *
- * @function module:client~MatrixClient#resetCrossSigningKeys
- * @param {object} authDict Auth data to supply for User-Interactive auth.
- * @param {CrossSigningLevel} [level] the level of cross-signing to reset. New
- * keys will be created for the given level and below. Defaults to
- * regenerating all keys.
- */
-
/**
* Get the user's cross-signing key ID.
* The cross-signing API is currently UNSTABLE and may change without notice.
@@ -1155,7 +1144,6 @@ function wrapCryptoFuncs(MatrixClient, names) {
* @param {module:models/room} room the room the event is in
*/
wrapCryptoFuncs(MatrixClient, [
- "resetCrossSigningKeys",
"getCrossSigningId",
"getStoredCrossSigningForUser",
"checkUserTrust",
diff --git a/src/crypto/index.js b/src/crypto/index.js
index fc2cbc0a..8a632f21 100644
--- a/src/crypto/index.js
+++ b/src/crypto/index.js
@@ -473,6 +473,7 @@ Crypto.prototype.isCrossSigningReady = async function() {
* {Promise} A promise which resolves to key creation data for
* SecretStorage#addKey: an object with `passphrase` and/or `pubkey` fields.
*/
+
Crypto.prototype.bootstrapSecretStorage = async function({
authUploadDeviceSigningKeys = async func => await func(),
createSecretStorageKey = async () => ({ }),
@@ -883,57 +884,6 @@ Crypto.prototype.checkCrossSigningPrivateKey = function(privateKey, expectedPubl
};
/**
- * Generate new cross-signing keys.
- *
- * @param {CrossSigningLevel} [level] the level of cross-signing to reset. New
- * keys will be created for the given level and below. Defaults to
- * regenerating all keys.
- * @param {function} [opts.authUploadDeviceSigningKeys] Optional. Function
- * called to await an interactive auth flow when uploading device signing keys.
- * Args:
- * {function} A function that makes the request requiring auth. Receives the
- * auth data as an object.
- */
-Crypto.prototype.resetCrossSigningKeys = async function(level, {
- authUploadDeviceSigningKeys = async func => await func(),
-} = {}) {
- logger.info(`Resetting cross-signing keys at level ${level}`);
- // Copy old keys (usually empty) in case we need to revert
- const oldKeys = Object.assign({}, this._crossSigningInfo.keys);
- try {
- await this._crossSigningInfo.resetKeys(level);
- await this._signObject(this._crossSigningInfo.keys.master);
-
- // send keys to server first before storing as trusted locally
- // to ensure upload succeeds
- const keys = {};
- for (const [name, key] of Object.entries(this._crossSigningInfo.keys)) {
- keys[name + "_key"] = key;
- }
- await authUploadDeviceSigningKeys(async authDict => {
- await this._baseApis.uploadDeviceSigningKeys(authDict, keys);
- });
-
- // write a copy locally so we know these are trusted keys
- await this._cryptoStore.doTxn(
- 'readwrite', [IndexedDBCryptoStore.STORE_ACCOUNT],
- (txn) => {
- this._cryptoStore.storeCrossSigningKeys(txn, this._crossSigningInfo.keys);
- },
- );
- } catch (e) {
- // If anything failed here, revert the keys so we know to try again from the start
- // next time.
- logger.error("Resetting cross-signing keys failed, revert to previous keys", e);
- this._crossSigningInfo.keys = oldKeys;
- throw e;
- }
- this._baseApis.emit("crossSigning.keysChanged", {});
- await this._afterCrossSigningLocalKeyChange();
- logger.info("Cross-signing key reset complete");
-};
-
-/**
* Run various follow-up actions after cross-signing keys have changed locally
* (either by resetting the keys for the account or by getting them from secret
* storage), such as signing the current device, upgrading device