diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/profile-page.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/profile-page.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/profile-page.js b/packages/meshbay-hub/src/meshbay_hub/static/profile-page.js index d3d06d7..7a309a9 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/profile-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/profile-page.js @@ -141,10 +141,18 @@ export function ProfilePage({ user, onLogout }) { try { // Re-wrap every reachable node's identity bundle first — if this cannot // run at all the account is left untouched. + // Both keys from the passphrases, with the pepper this open session asks + // for: the old one opens the bundles as they are, the new one seals them. + const K = window.MeshBayKeys; + const { pepper, version } = await K.fetchBundlePepper(user.token); + const oldKey = await K.deriveBundleSessionKey( + cpOld, user.username, user.userId, pepper, version); + const newKey = await K.deriveBundleSessionKey( + cpNew, user.username, user.userId, pepper, version); const result = await window.MeshBayTransport.rewrapAllNodes({ hubUrl: HUB, token: user.token, username: user.username, userId: user.userId, - oldPassphrase: cpOld, newPassphrase: cpNew, + bundleKey: oldKey, newBundleKey: newKey, onProgress: setCpProgress, }); @@ -158,8 +166,8 @@ export function ProfilePage({ user, onLogout }) { // Keep this tab signed in with the fresh pair, and move the session's // bundle key forward so the next node connection opens the new bundles. setAuth({ ...user, token: resp.access_token, refreshToken: resp.refresh_token }); - session.bundleKey = result.newBundleKey; - _storeBundleKey(result.newBundleKey); + session.bundleKey = newKey; + _storeBundleKey(newKey); setCpResult(result); setCpPhase('done'); |