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

Add method to check whether cross-signing has keys

This commit is contained in:
J. Ryan Stinnett
2019-11-18 12:31:31 +00:00
parent 3d9bddfb9f
commit f93130a8a7
3 changed files with 22 additions and 0 deletions

View File

@@ -964,6 +964,14 @@ function wrapCryptoFuncs(MatrixClient, names) {
}
}
/**
* Check whether we already have cross-signing keys for the current user.
* The cross-signing API is currently UNSTABLE and may change without notice.
*
* @function module:client~MatrixClient#doesCrossSigningHaveKeys
* @return {boolean} Whether we have keys.
*/
/**
* Generate new cross-signing keys.
* The cross-signing API is currently UNSTABLE and may change without notice.
@@ -1018,6 +1026,7 @@ function wrapCryptoFuncs(MatrixClient, names) {
*/
wrapCryptoFuncs(MatrixClient, [
"doesCrossSigningHaveKeys",
"resetCrossSigningKeys",
"getCrossSigningId",
"getStoredCrossSigningForUser",

View File

@@ -101,6 +101,10 @@ export class CrossSigningInfo extends EventEmitter {
};
}
hasKeys() {
return Object.keys(this.keys).length > 0;
}
/**
* Get the ID used to identify the user
*

View File

@@ -328,6 +328,15 @@ Crypto.prototype.checkPrivateKey = function(privateKey, expectedPublicKey) {
}
};
/**
* Check whether we already have cross-signing keys for the current user.
*
* @return {boolean} Whether we have keys.
*/
Crypto.prototype.doesCrossSigningHaveKeys = function() {
return this._crossSigningInfo.hasKeys();
};
/**
* Generate new cross-signing keys.
*