WIP
This commit is contained in:
parent
88e0321d28
commit
a494082086
2 changed files with 20 additions and 7 deletions
|
@ -8,7 +8,6 @@ import initMatrix from '../../../client/initMatrix';
|
|||
import { openReusableDialog } from '../../../client/action/navigation';
|
||||
import { hasCrossSigningAccountData } from '../../../util/matrixUtil';
|
||||
import { copyToClipboard } from '../../../util/common';
|
||||
import { storePrivateKey } from '../../../client/state/secretStorageKeys';
|
||||
|
||||
import Text from '../../atoms/text/Text';
|
||||
import Button from '../../atoms/button/Button';
|
||||
|
@ -58,11 +57,19 @@ function CrossSigningSetup() {
|
|||
setGenWithPhrase(typeof securityPhrase === 'string');
|
||||
const recoveryKey = await mx.createRecoveryKeyFromPassphrase(securityPhrase);
|
||||
|
||||
const cSInfo = mx.getStoredCrossSigningForUser(mx.getUserId());
|
||||
const { keys, firstUse, crossSigningVerifiedBefore } = cSInfo;
|
||||
mx.crypto.crossSigningInfo.keys = keys;
|
||||
mx.crypto.crossSigningInfo.firstUse = firstUse;
|
||||
mx.crypto.crossSigningVerifiedBefore = crossSigningVerifiedBefore;
|
||||
const authUploadDeviceSigningKeys = async (makeRequest) => {
|
||||
try {
|
||||
await makeRequest({});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
// TODO: handle error
|
||||
}
|
||||
};
|
||||
|
||||
await mx.bootstrapCrossSigning({
|
||||
authUploadDeviceSigningKeys,
|
||||
setupNewCrossSigning: true,
|
||||
});
|
||||
|
||||
const bootstrapSSOpts = {
|
||||
createSecretStorageKey: async () => recoveryKey,
|
||||
|
@ -71,6 +78,8 @@ function CrossSigningSetup() {
|
|||
};
|
||||
|
||||
await mx.bootstrapSecretStorage(bootstrapSSOpts);
|
||||
// setup newKeyBackup only bootstrap it
|
||||
// TODO: createKeyBackupVersion;
|
||||
|
||||
securityKeyDialog(recoveryKey);
|
||||
};
|
||||
|
|
|
@ -27,6 +27,10 @@ async function getSecretStorageKey({ keys }) {
|
|||
return [keyId, privateKey];
|
||||
}
|
||||
|
||||
function cacheSecretStorageKey(keyId, keyInfo, privateKey) {
|
||||
secretStorageKeys[keyId] = privateKey;
|
||||
}
|
||||
|
||||
export const cryptoCallbacks = {
|
||||
getSecretStorageKey,
|
||||
};
|
||||
cacheSecretStorageKey,
|
||||
|
|
Loading…
Add table
Reference in a new issue