Green: unseal shared collection keys with the account keypair
decryptCollection now takes the full key material {masterKey,
publicKey, secretKey} and dispatches on keyDecryptionNonce: present
means an owned collection (secretbox under the master key), absent
means a shared collection (sealed box to our public key). Client
already held the keypair for unsealing the auth token, so it just
passes it through.
This commit is contained in:
@@ -25,7 +25,10 @@ const main = async () => {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const { masterKey, token } = await unwrapAuth(challenge.response, PASSWORD);
|
||||
const { masterKey, secretKey, publicKey, token } = await unwrapAuth(
|
||||
challenge.response,
|
||||
PASSWORD,
|
||||
);
|
||||
api.setAuthToken(token);
|
||||
console.log("Logged in, user ID:", challenge.response.id);
|
||||
|
||||
@@ -37,7 +40,7 @@ const main = async () => {
|
||||
|
||||
const userID = challenge.response.id;
|
||||
const collections = rawCollections.map((raw) =>
|
||||
decryptCollection(raw, masterKey, userID),
|
||||
decryptCollection(raw, { masterKey, publicKey, secretKey }, userID),
|
||||
);
|
||||
|
||||
console.log(`${collections.length} collection(s):`);
|
||||
|
||||
Reference in New Issue
Block a user