Skip to content

Commit

Permalink
feat: refactor app crypto
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Dec 25, 2024
1 parent 15adee0 commit 9a7e942
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 0 additions & 6 deletions lib/app/components/crypto/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ export default class Env {
res = await this.#storage.init();
if ( !res.ok ) return res;

// XXX
setTimeout( async () => {
const res = await this.changeMasterKey();
console.log( "---", res );
}, 5000 );

return result( 200 );
}

Expand Down
7 changes: 6 additions & 1 deletion lib/app/components/crypto/crypto/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,19 @@ export default class CryptoStorage {
masterKey = res.data;
}

masterKey = {
"id": MASTER_KEY_ID,
"key": masterKey,
};

res = await this._rewrapKeys( masterKey );
if ( !res.ok ) return res;

this.#masterKey = masterKey;
this.clear();

return result( 200, {
"masterKey": masterKey
"masterKey": masterKey.key
.export( {
"format": "buffer",
} )
Expand Down

0 comments on commit 9a7e942

Please sign in to comment.