@secrecy/lib 1.85.2-feat-folder-perms.1 → 1.85.2-feat-folder-perms.3
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,
|
|
@@ -272,7 +272,6 @@ export class SecrecyCloudClient {
|
|
|
272
272
|
if (!item) {
|
|
273
273
|
throw new Error('Unable to retrieve user mapped nodes!');
|
|
274
274
|
}
|
|
275
|
-
console.dir({ node, item });
|
|
276
275
|
return {
|
|
277
276
|
id: node.id,
|
|
278
277
|
data: node.data,
|
|
@@ -360,7 +359,7 @@ export class SecrecyCloudClient {
|
|
|
360
359
|
}
|
|
361
360
|
name =
|
|
362
361
|
typeof name === 'string' && node.accesses[0].nameKey !== null
|
|
363
|
-
? await encryptName(name,
|
|
362
|
+
? await encryptName(name, node.accesses[0].nameKey)
|
|
364
363
|
: null;
|
|
365
364
|
const updateNode = await this.#client.apiClient.cloud.updateNode.mutate({
|
|
366
365
|
deletedAt: deletedAt ?? null,
|
|
@@ -523,7 +522,7 @@ export class SecrecyCloudClient {
|
|
|
523
522
|
}
|
|
524
523
|
const rawDataKey = key ? sodium.from_hex(key) : null;
|
|
525
524
|
const nameKey = secretStreamKeygen();
|
|
526
|
-
const encName = await encryptName(name, nameKey);
|
|
525
|
+
const encName = await encryptName(name, sodium.to_hex(nameKey));
|
|
527
526
|
const parentFolder = nodeId ? nodesCache.get(nodeId) : await this.node();
|
|
528
527
|
if (!parentFolder) {
|
|
529
528
|
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.3",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|