@secrecy/lib 1.62.0-feat-node-sharing.6 → 1.62.0-feat-node-sharing.8
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.
|
@@ -15,7 +15,20 @@ export class SecrecyAppClient {
|
|
|
15
15
|
this.#apiClient = apiClient;
|
|
16
16
|
}
|
|
17
17
|
get userId() {
|
|
18
|
-
|
|
18
|
+
const sub = this.jwtDecoded.sub;
|
|
19
|
+
if (!sub) {
|
|
20
|
+
throw new Error('No sub in JWT');
|
|
21
|
+
}
|
|
22
|
+
return sub;
|
|
23
|
+
}
|
|
24
|
+
get appId() {
|
|
25
|
+
const aud = Array.isArray(this.jwtDecoded.aud)
|
|
26
|
+
? this.jwtDecoded.aud[0]
|
|
27
|
+
: this.jwtDecoded.aud;
|
|
28
|
+
if (!aud) {
|
|
29
|
+
throw new Error('No aud in JWT');
|
|
30
|
+
}
|
|
31
|
+
return aud;
|
|
19
32
|
}
|
|
20
33
|
async getJwt() {
|
|
21
34
|
// TODO useful?
|
|
@@ -64,7 +77,7 @@ export class SecrecyAppClient {
|
|
|
64
77
|
return await this.#apiClient.application.notification.query();
|
|
65
78
|
}
|
|
66
79
|
async userPublicKey(input, appId) {
|
|
67
|
-
appId ??= this.
|
|
80
|
+
appId ??= this.appId;
|
|
68
81
|
const userIds = Array.isArray(input) ? input : [input];
|
|
69
82
|
const publicKeys = Object.fromEntries(userIds
|
|
70
83
|
.map((userId) => [
|
|
@@ -299,7 +299,7 @@ export class SecrecyCloudClient {
|
|
|
299
299
|
const createdFolder = await this.#apiClient.cloud.createFolder.mutate({
|
|
300
300
|
name: encryptedName,
|
|
301
301
|
parentId: parentFolderId ?? null,
|
|
302
|
-
nameKey:
|
|
302
|
+
nameKey: encryptedNameKey,
|
|
303
303
|
});
|
|
304
304
|
const folder = await apiNodeToExternalNodeFull(createdFolder, this.#keys);
|
|
305
305
|
const users = folder.parent?.users?.filter(([u]) => u.id !== this.#client.app.userId) ??
|
|
@@ -8,6 +8,7 @@ export declare class SecrecyAppClient {
|
|
|
8
8
|
jwtDecoded: JwtPayload;
|
|
9
9
|
constructor(uaJwt: string, _client: SecrecyClient, _keys: KeyPair, apiClient: ApiClient);
|
|
10
10
|
get userId(): string;
|
|
11
|
+
get appId(): string;
|
|
11
12
|
getJwt(): Promise<string>;
|
|
12
13
|
limits(): Promise<RouterOutputs['application']['limits']>;
|
|
13
14
|
metrics(): Promise<RouterOutputs['application']['metrics']>;
|
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.62.0-feat-node-sharing.
|
|
5
|
+
"version": "1.62.0-feat-node-sharing.8",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|