@secrecy/lib 1.75.1-feat-create-folder-perms.1 → 1.75.1-feat-create-folder-perms.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -117,24 +117,21 @@ export class SecrecyCloudClient {
|
|
|
117
117
|
const nameKey = secretStreamKeygen();
|
|
118
118
|
const encName = await encryptName(name, nameKey);
|
|
119
119
|
const parentFolder = await this.node({ id: parentFolderId });
|
|
120
|
-
const
|
|
120
|
+
const encryptedAccesses = await Promise.all(Object.keys(parentFolder.identities).map(async (pubKey) => {
|
|
121
121
|
const encryptedNameKey = await encryptNameKey({
|
|
122
122
|
nameKey,
|
|
123
123
|
privateKey: this.#client.uaPrivateKey,
|
|
124
|
-
publicKey:
|
|
124
|
+
publicKey: pubKey,
|
|
125
125
|
});
|
|
126
126
|
return {
|
|
127
|
-
|
|
127
|
+
pubKey,
|
|
128
128
|
nameKey: encryptedNameKey,
|
|
129
129
|
};
|
|
130
130
|
}));
|
|
131
131
|
const createdFolder = await this.#client.apiClient.cloud.createFolder.mutate({
|
|
132
132
|
name: encName,
|
|
133
133
|
parentId: parentFolderId ?? null,
|
|
134
|
-
encryptedAccesses:
|
|
135
|
-
nameKey: access.nameKey,
|
|
136
|
-
pubKey: access.identityPubKey,
|
|
137
|
-
})),
|
|
134
|
+
encryptedAccesses: encryptedAccesses,
|
|
138
135
|
});
|
|
139
136
|
return apiNodeToExternalNodeFull(createdFolder, this.#client.keyPairs);
|
|
140
137
|
}
|
|
@@ -445,7 +442,7 @@ export class SecrecyCloudClient {
|
|
|
445
442
|
if (!parentFolder) {
|
|
446
443
|
throw new Error('Unable to retrieve parent');
|
|
447
444
|
}
|
|
448
|
-
const
|
|
445
|
+
const encryptedAccesses = await Promise.all(Object.keys(parentFolder.identities).map(async (pubKey) => {
|
|
449
446
|
const encryptedNameKey = await encryptNameKey({
|
|
450
447
|
nameKey,
|
|
451
448
|
privateKey: this.#client.uaPrivateKey,
|
|
@@ -455,7 +452,7 @@ export class SecrecyCloudClient {
|
|
|
455
452
|
? sodium.to_hex(encryptCryptoBox(rawDataKey, pubKey, this.#client.uaPrivateKey))
|
|
456
453
|
: null;
|
|
457
454
|
return {
|
|
458
|
-
|
|
455
|
+
pubKey: pubKey,
|
|
459
456
|
nameKey: encryptedNameKey,
|
|
460
457
|
key: dataKey,
|
|
461
458
|
};
|
|
@@ -464,11 +461,7 @@ export class SecrecyCloudClient {
|
|
|
464
461
|
dataId,
|
|
465
462
|
nodeId: nodeId ?? null,
|
|
466
463
|
fileName: encName,
|
|
467
|
-
encryptedAccesses:
|
|
468
|
-
nameKey: access.nameKey,
|
|
469
|
-
pubKey: access.identityPubKey,
|
|
470
|
-
key: access.key,
|
|
471
|
-
})),
|
|
464
|
+
encryptedAccesses: encryptedAccesses,
|
|
472
465
|
});
|
|
473
466
|
const node = await apiNodeToExternalNodeFull(saveInCloud, this.#client.keyPairs);
|
|
474
467
|
return node;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@secrecy/lib",
|
|
3
3
|
"author": "Anonymize <anonymize@gmail.com>",
|
|
4
4
|
"description": "Anonymize Secrecy Library",
|
|
5
|
-
"version": "1.75.1-feat-create-folder-perms.
|
|
5
|
+
"version": "1.75.1-feat-create-folder-perms.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|