@secrecy/lib 1.85.2-feat-folder-perms.1 → 1.85.2-feat-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.
|
@@ -107,7 +107,7 @@ export class SecrecyCloudClient {
|
|
|
107
107
|
}
|
|
108
108
|
name =
|
|
109
109
|
typeof name === 'string' && node.accesses[0].nameKey !== null
|
|
110
|
-
? await encryptName(name,
|
|
110
|
+
? await encryptName(name, node.accesses[0].nameKey)
|
|
111
111
|
: null;
|
|
112
112
|
const { isDuplicated } = await this.#client.apiClient.cloud.duplicateNode.mutate({
|
|
113
113
|
nodeId,
|
|
@@ -126,7 +126,7 @@ export class SecrecyCloudClient {
|
|
|
126
126
|
}
|
|
127
127
|
async createFolder({ name, parentFolderId, }) {
|
|
128
128
|
const nameKey = secretStreamKeygen();
|
|
129
|
-
const encName = await encryptName(name, nameKey);
|
|
129
|
+
const encName = await encryptName(name, sodium.to_hex(nameKey));
|
|
130
130
|
const parentFolder = await this.node({ id: parentFolderId });
|
|
131
131
|
const encryptedAccesses = await Promise.all(Object.keys(parentFolder.identities).map(async (pubKey) => ({
|
|
132
132
|
pubKey,
|
|
@@ -360,7 +360,7 @@ export class SecrecyCloudClient {
|
|
|
360
360
|
}
|
|
361
361
|
name =
|
|
362
362
|
typeof name === 'string' && node.accesses[0].nameKey !== null
|
|
363
|
-
? await encryptName(name,
|
|
363
|
+
? await encryptName(name, node.accesses[0].nameKey)
|
|
364
364
|
: null;
|
|
365
365
|
const updateNode = await this.#client.apiClient.cloud.updateNode.mutate({
|
|
366
366
|
deletedAt: deletedAt ?? null,
|
|
@@ -523,7 +523,7 @@ export class SecrecyCloudClient {
|
|
|
523
523
|
}
|
|
524
524
|
const rawDataKey = key ? sodium.from_hex(key) : null;
|
|
525
525
|
const nameKey = secretStreamKeygen();
|
|
526
|
-
const encName = await encryptName(name, nameKey);
|
|
526
|
+
const encName = await encryptName(name, sodium.to_hex(nameKey));
|
|
527
527
|
const parentFolder = nodeId ? nodesCache.get(nodeId) : await this.node();
|
|
528
528
|
if (!parentFolder) {
|
|
529
529
|
throw new Error('Unable to retrieve parent');
|
|
@@ -8,12 +8,12 @@ export function derivePassword(password, salt) {
|
|
|
8
8
|
return sodium.crypto_pwhash(sodium.crypto_secretbox_KEYBYTES, password, salt, sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE, sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE, sodium.crypto_pwhash_ALG_ARGON2ID13, 'hex');
|
|
9
9
|
}
|
|
10
10
|
export async function encryptName(name, nameKey) {
|
|
11
|
-
const { data } = await encryptSecretStream(nameKey, sodium.from_string(name));
|
|
11
|
+
const { data } = await encryptSecretStream(sodium.from_hex(nameKey), sodium.from_string(name));
|
|
12
12
|
return sodium.to_hex(data);
|
|
13
13
|
}
|
|
14
14
|
export async function generateAndEncryptNameAndKey(args) {
|
|
15
15
|
const nameKey = secretStreamKeygen();
|
|
16
|
-
const encryptedName = await encryptName(args.name, nameKey);
|
|
16
|
+
const encryptedName = await encryptName(args.name, sodium.to_hex(nameKey));
|
|
17
17
|
const encryptedNameKey = await encryptNameKey({ ...args, nameKey });
|
|
18
18
|
return {
|
|
19
19
|
nameKey,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function generatePassword(): string;
|
|
2
2
|
export declare function derivePassword(password: string, salt: Uint8Array<ArrayBufferLike>): string;
|
|
3
|
-
export declare function encryptName(name: string, nameKey:
|
|
3
|
+
export declare function encryptName(name: string, nameKey: string): Promise<string>;
|
|
4
4
|
export declare function generateAndEncryptNameAndKey(args: {
|
|
5
5
|
name: string;
|
|
6
6
|
privateKey: string;
|
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.85.2-feat-folder-perms.
|
|
5
|
+
"version": "1.85.2-feat-folder-perms.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|