@secrecy/lib 1.75.0-feat-groups-identity.4 → 1.75.0-feat-groups-identity.6
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.
- package/dist/lib/cache.js +9 -0
- package/dist/lib/client/SecrecyAppClient.js +6 -0
- package/dist/lib/client/SecrecyCloudClient.js +19 -19
- package/dist/lib/client/SecrecyGroupClient.js +33 -0
- package/dist/lib/client/SecrecyIdentityClient.js +15 -0
- package/dist/lib/client/convert/node.js +14 -13
- package/dist/lib/client/index.js +6 -3
- package/dist/types/cache.d.ts +3 -0
- package/dist/types/client/SecrecyGroupClient.d.ts +15 -0
- package/dist/types/client/SecrecyIdentityClient.d.ts +9 -0
- package/dist/types/client/index.d.ts +5 -2
- package/dist/types/client/types/node.d.ts +2 -2
- package/dist/types/client.d.ts +344 -0
- package/package.json +2 -2
package/dist/lib/cache.js
CHANGED
|
@@ -3,6 +3,15 @@ import { gigaToBytes } from './utils.js';
|
|
|
3
3
|
export const dataCache = new Map();
|
|
4
4
|
export const nodesCache = new Map();
|
|
5
5
|
export const nodesEncryptionCache = new Map();
|
|
6
|
+
export const getNodeForEncryptionFromCache = (id) => {
|
|
7
|
+
if (nodesEncryptionCache.has(id)) {
|
|
8
|
+
return nodesEncryptionCache.get(id);
|
|
9
|
+
}
|
|
10
|
+
if (nodesCache.has(id)) {
|
|
11
|
+
return nodesCache.get(id);
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
};
|
|
6
15
|
export const usersCache = new Map();
|
|
7
16
|
export const publicKeysCache = new Map();
|
|
8
17
|
export const dataContentCache = new LRUCache({
|
|
@@ -15,6 +15,9 @@ export class SecrecyAppClient {
|
|
|
15
15
|
if (!sub) {
|
|
16
16
|
throw new Error('No sub in JWT');
|
|
17
17
|
}
|
|
18
|
+
if (sub !== this.#client.uaIdentity.userId) {
|
|
19
|
+
throw new Error(`UserId mismatch: ${sub} !== ${this.#client.uaIdentity.userId}`);
|
|
20
|
+
}
|
|
18
21
|
return sub;
|
|
19
22
|
}
|
|
20
23
|
get appId() {
|
|
@@ -24,6 +27,9 @@ export class SecrecyAppClient {
|
|
|
24
27
|
if (!aud) {
|
|
25
28
|
throw new Error('No aud in JWT');
|
|
26
29
|
}
|
|
30
|
+
if (aud !== this.#client.uaIdentity.appId) {
|
|
31
|
+
throw new Error(`AppId mismatch: ${aud} !== ${this.#client.uaIdentity.appId}`);
|
|
32
|
+
}
|
|
27
33
|
return aud;
|
|
28
34
|
}
|
|
29
35
|
async getJwt() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nodesCache, dataCache, dataContentCache,
|
|
1
|
+
import { nodesCache, dataCache, dataContentCache, getNodeForEncryptionFromCache, } from '../cache.js';
|
|
2
2
|
import { decryptCryptoBox, encryptCryptoBox } from '../crypto/index.js';
|
|
3
3
|
import { decompress } from '../minify/index.js';
|
|
4
4
|
import { sodium } from '../sodium.js';
|
|
@@ -470,16 +470,23 @@ export class SecrecyCloudClient {
|
|
|
470
470
|
const nodes = [];
|
|
471
471
|
// Retrieve and format nodes.
|
|
472
472
|
for (const nodeId of nodeIds) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
473
|
+
const node = getNodeForEncryptionFromCache(nodeId);
|
|
474
|
+
// ! Only keep nodes FILE with history.
|
|
475
|
+
if (node && 'history' in node && node.history.length > 0) {
|
|
476
|
+
const access = 'accesses' in node
|
|
477
|
+
? node.accesses.find((a) => a.nameKey !== null)
|
|
478
|
+
: node.access;
|
|
479
|
+
if (!access) {
|
|
480
|
+
throw new Error(`No access found for node ${node.id} to share!`);
|
|
481
|
+
}
|
|
482
|
+
if (access.nameKey === null) {
|
|
483
|
+
throw new Error(`No nameKey found for node ${node.id} to share!`);
|
|
484
|
+
}
|
|
478
485
|
nodes.push({
|
|
479
486
|
id: nodeId,
|
|
480
487
|
name: node.name,
|
|
481
488
|
type: node.type,
|
|
482
|
-
access: { nameKey:
|
|
489
|
+
access: { nameKey: access.nameKey },
|
|
483
490
|
history: node.history.map((data) => {
|
|
484
491
|
if (!data.key) {
|
|
485
492
|
throw new Error('Unable to retrieve data key!');
|
|
@@ -516,20 +523,13 @@ export class SecrecyCloudClient {
|
|
|
516
523
|
(!('history' in node) || node.history.length === 0)) {
|
|
517
524
|
throw new Error(`Can't share a node without data (${node.id})!`);
|
|
518
525
|
}
|
|
519
|
-
const nameKey = node.access?.nameKey;
|
|
520
526
|
nodesMappedUsers[pubKey].push({
|
|
521
527
|
id: node.id,
|
|
522
|
-
nameKey: nameKey
|
|
523
|
-
|
|
524
|
-
:
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
id: f.id,
|
|
528
|
-
key: f.key
|
|
529
|
-
? sodium.to_hex(encryptCryptoBox(sodium.from_hex(f.key), pubKey, this.#client.uaPrivateKey))
|
|
530
|
-
: null,
|
|
531
|
-
}))
|
|
532
|
-
: [],
|
|
528
|
+
nameKey: sodium.to_hex(encryptCryptoBox(sodium.from_hex(node.access.nameKey), pubKey, this.#client.uaPrivateKey)),
|
|
529
|
+
data: node.history.map((f) => ({
|
|
530
|
+
id: f.id,
|
|
531
|
+
key: sodium.to_hex(encryptCryptoBox(sodium.from_hex(f.key), pubKey, this.#client.uaPrivateKey)),
|
|
532
|
+
})),
|
|
533
533
|
});
|
|
534
534
|
}
|
|
535
535
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class SecrecyGroupClient {
|
|
2
|
+
#client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.#client = client;
|
|
5
|
+
}
|
|
6
|
+
async addMember(input) {
|
|
7
|
+
return this.#client.apiClient.group.addMember.mutate(input);
|
|
8
|
+
}
|
|
9
|
+
async create(input) {
|
|
10
|
+
return this.#client.apiClient.group.create.mutate(input);
|
|
11
|
+
}
|
|
12
|
+
async deleteMember(input) {
|
|
13
|
+
return this.#client.apiClient.group.deleteMember.mutate(input);
|
|
14
|
+
}
|
|
15
|
+
async delete(input) {
|
|
16
|
+
return this.#client.apiClient.group.delete.mutate(input);
|
|
17
|
+
}
|
|
18
|
+
async get(input) {
|
|
19
|
+
return this.#client.apiClient.group.get.query(input);
|
|
20
|
+
}
|
|
21
|
+
async getMany(input) {
|
|
22
|
+
return this.#client.apiClient.group.getMany.query(input);
|
|
23
|
+
}
|
|
24
|
+
async transferOwnership(input) {
|
|
25
|
+
return this.#client.apiClient.group.transferOwnership.mutate(input);
|
|
26
|
+
}
|
|
27
|
+
async update(input) {
|
|
28
|
+
return this.#client.apiClient.group.update.mutate(input);
|
|
29
|
+
}
|
|
30
|
+
async updateMember(input) {
|
|
31
|
+
return this.#client.apiClient.group.updateMember.mutate(input);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class SecrecyIdentityClient {
|
|
2
|
+
#client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.#client = client;
|
|
5
|
+
}
|
|
6
|
+
async get(input) {
|
|
7
|
+
return await this.#client.apiClient.identity.get.query(input);
|
|
8
|
+
}
|
|
9
|
+
async getMany(input) {
|
|
10
|
+
return await this.#client.apiClient.identity.getMany.query(input);
|
|
11
|
+
}
|
|
12
|
+
async list(input) {
|
|
13
|
+
return await this.#client.apiClient.identity.list.query(input);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -79,19 +79,20 @@ export async function apiNodeFullToInternalFull(apiNodeFull, keyPairs) {
|
|
|
79
79
|
function internalNodeToNode(internal) {
|
|
80
80
|
const node = {
|
|
81
81
|
...internal,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
breadcrumb: internal.breadcrumb.map((b) => ({
|
|
83
|
+
id: b.id,
|
|
84
|
+
name: b.name,
|
|
85
|
+
})),
|
|
86
|
+
accesses: internal.accesses.map((a) => ({
|
|
87
|
+
isRoot: a.isRoot,
|
|
88
|
+
identityPubKey: a.identityPubKey,
|
|
89
|
+
sharedByPubKey: a.sharedByPubKey,
|
|
90
|
+
rights: a.rights,
|
|
91
|
+
addAccess: a.addAccess,
|
|
92
|
+
delAccess: a.delAccess,
|
|
93
|
+
sharingAddAccess: a.sharingAddAccess,
|
|
94
|
+
sharingDelAccess: a.sharingDelAccess,
|
|
95
|
+
})),
|
|
95
96
|
};
|
|
96
97
|
return node;
|
|
97
98
|
}
|
package/dist/lib/client/index.js
CHANGED
|
@@ -10,6 +10,8 @@ import { SecrecyUserClient } from './SecrecyUserClient.js';
|
|
|
10
10
|
import { SecrecyPseudonymClient } from './SecrecyPseudonymClient.js';
|
|
11
11
|
import { decryptAnonymous } from '../crypto/index.js';
|
|
12
12
|
import { SecrecyOrganizationClient } from './SecrecyOrganizationClient.js';
|
|
13
|
+
import { SecrecyGroupClient } from './SecrecyGroupClient.js';
|
|
14
|
+
import { SecrecyIdentityClient } from './SecrecyIdentityClient.js';
|
|
13
15
|
export class SecrecyClient extends BaseClient {
|
|
14
16
|
#groupIdentities;
|
|
15
17
|
#uaIdentity;
|
|
@@ -23,6 +25,8 @@ export class SecrecyClient extends BaseClient {
|
|
|
23
25
|
pay;
|
|
24
26
|
user;
|
|
25
27
|
pseudonym;
|
|
28
|
+
group;
|
|
29
|
+
identity;
|
|
26
30
|
constructor(opts) {
|
|
27
31
|
super({
|
|
28
32
|
session: opts.uaSession,
|
|
@@ -54,6 +58,8 @@ export class SecrecyClient extends BaseClient {
|
|
|
54
58
|
this.pay = new SecrecyPayClient(this);
|
|
55
59
|
this.user = new SecrecyUserClient(this);
|
|
56
60
|
this.pseudonym = new SecrecyPseudonymClient(this);
|
|
61
|
+
this.group = new SecrecyGroupClient(this);
|
|
62
|
+
this.identity = new SecrecyIdentityClient(this);
|
|
57
63
|
}
|
|
58
64
|
get publicKey() {
|
|
59
65
|
return this.#uaIdentity.identityPubKey;
|
|
@@ -92,7 +98,4 @@ export class SecrecyClient extends BaseClient {
|
|
|
92
98
|
publicKeysCache.clear();
|
|
93
99
|
await super.logout(sessionId);
|
|
94
100
|
}
|
|
95
|
-
async getIdentities(input) {
|
|
96
|
-
return await this.client.identity.getMany.query(input);
|
|
97
|
-
}
|
|
98
101
|
}
|
package/dist/types/cache.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { InternalNode, InternalData, InternalNodeFull, LocalData, InternalMinimalNodeForEncryption } from './client/types/index.js';
|
|
2
2
|
import { LRUCache } from 'lru-cache';
|
|
3
|
+
type NodeForEncryptionCached = InternalNode | InternalNodeFull | InternalMinimalNodeForEncryption;
|
|
3
4
|
export declare const dataCache: Map<string, InternalData>;
|
|
4
5
|
export declare const nodesCache: Map<string, InternalNode | InternalNodeFull>;
|
|
5
6
|
export declare const nodesEncryptionCache: Map<string, InternalMinimalNodeForEncryption>;
|
|
7
|
+
export declare const getNodeForEncryptionFromCache: (id: string) => NodeForEncryptionCached | undefined;
|
|
6
8
|
export declare const usersCache: Map<string, {
|
|
7
9
|
firstname: string;
|
|
8
10
|
lastname: string;
|
|
@@ -12,3 +14,4 @@ export declare const usersCache: Map<string, {
|
|
|
12
14
|
}>;
|
|
13
15
|
export declare const publicKeysCache: Map<string, string>;
|
|
14
16
|
export declare const dataContentCache: LRUCache<string, LocalData, unknown>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RouterInputs, RouterOutputs } from '../client.js';
|
|
2
|
+
import type { SecrecyClient } from '../index.js';
|
|
3
|
+
export declare class SecrecyGroupClient {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(client: SecrecyClient);
|
|
6
|
+
addMember(input: RouterInputs['group']['addMember']): Promise<RouterOutputs['group']['addMember']>;
|
|
7
|
+
create(input: RouterInputs['group']['create']): Promise<RouterOutputs['group']['create']>;
|
|
8
|
+
deleteMember(input: RouterInputs['group']['deleteMember']): Promise<RouterOutputs['group']['deleteMember']>;
|
|
9
|
+
delete(input: RouterInputs['group']['delete']): Promise<RouterOutputs['group']['delete']>;
|
|
10
|
+
get(input: RouterInputs['group']['get']): Promise<RouterOutputs['group']['get']>;
|
|
11
|
+
getMany(input: RouterInputs['group']['getMany']): Promise<RouterOutputs['group']['getMany']>;
|
|
12
|
+
transferOwnership(input: RouterInputs['group']['transferOwnership']): Promise<RouterOutputs['group']['transferOwnership']>;
|
|
13
|
+
update(input: RouterInputs['group']['update']): Promise<RouterOutputs['group']['update']>;
|
|
14
|
+
updateMember(input: RouterInputs['group']['updateMember']): Promise<RouterOutputs['group']['updateMember']>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RouterInputs, RouterOutputs } from '../client.js';
|
|
2
|
+
import type { SecrecyClient } from '../index.js';
|
|
3
|
+
export declare class SecrecyIdentityClient {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(client: SecrecyClient);
|
|
6
|
+
get(input: RouterInputs['identity']['get']): Promise<RouterOutputs['identity']['get']>;
|
|
7
|
+
getMany(input: RouterInputs['identity']['getMany']): Promise<RouterOutputs['identity']['getMany']>;
|
|
8
|
+
list(input: RouterInputs['identity']['list']): Promise<RouterOutputs['identity']['list']>;
|
|
9
|
+
}
|
|
@@ -6,11 +6,13 @@ import { SecrecyAppClient } from './SecrecyAppClient.js';
|
|
|
6
6
|
import { SecrecyDbClient } from './SecrecyDbClient.js';
|
|
7
7
|
import { SecrecyWalletClient } from './SecrecyWalletClient.js';
|
|
8
8
|
import { SecrecyPayClient } from './SecrecyPayClient.js';
|
|
9
|
-
import { type ApiClient, type RouterInputs
|
|
9
|
+
import { type ApiClient, type RouterInputs } from '../client.js';
|
|
10
10
|
import { SecrecyUserClient } from './SecrecyUserClient.js';
|
|
11
11
|
import { SecrecyPseudonymClient } from './SecrecyPseudonymClient.js';
|
|
12
12
|
import { SecrecyOrganizationClient } from './SecrecyOrganizationClient.js';
|
|
13
13
|
import type { AccessIdentity, GroupIdentity, UserAppIdentity } from './types/identity.js';
|
|
14
|
+
import { SecrecyGroupClient } from './SecrecyGroupClient.js';
|
|
15
|
+
import { SecrecyIdentityClient } from './SecrecyIdentityClient.js';
|
|
14
16
|
export type NewMail = Pick<RouterInputs['mail']['createDraft'], 'body' | 'subject' | 'senderFiles' | 'recipients' | 'replyToId'>;
|
|
15
17
|
export type ProgressCallback = (progress: SecretStreamProgress) => Promise<void>;
|
|
16
18
|
export interface SecrecyClientOptions {
|
|
@@ -32,6 +34,8 @@ export declare class SecrecyClient extends BaseClient {
|
|
|
32
34
|
pay: SecrecyPayClient;
|
|
33
35
|
user: SecrecyUserClient;
|
|
34
36
|
pseudonym: SecrecyPseudonymClient;
|
|
37
|
+
group: SecrecyGroupClient;
|
|
38
|
+
identity: SecrecyIdentityClient;
|
|
35
39
|
constructor(opts: SecrecyClientOptions);
|
|
36
40
|
get publicKey(): string;
|
|
37
41
|
get apiClient(): Readonly<ApiClient>;
|
|
@@ -42,5 +46,4 @@ export declare class SecrecyClient extends BaseClient {
|
|
|
42
46
|
get uaIdentity(): Readonly<UserAppIdentity>;
|
|
43
47
|
decryptAnonymous(data: Uint8Array): Uint8Array;
|
|
44
48
|
logout(sessionId?: string | null | undefined): Promise<void>;
|
|
45
|
-
getIdentities(input: RouterInputs['identity']['getMany']): Promise<RouterOutputs['identity']['getMany']>;
|
|
46
49
|
}
|
|
@@ -67,10 +67,10 @@ export type ApiNodeParent = NonNullable<RouterOutputs['cloud']['nodeFullById']['
|
|
|
67
67
|
export type NodeType = ApiNode['type'];
|
|
68
68
|
export type EncryptedNodeInfos = {
|
|
69
69
|
id: string;
|
|
70
|
-
nameKey: string
|
|
70
|
+
nameKey: string;
|
|
71
71
|
data: {
|
|
72
72
|
id: string;
|
|
73
|
-
key: string
|
|
73
|
+
key: string;
|
|
74
74
|
}[];
|
|
75
75
|
};
|
|
76
76
|
export type ShareNodeDetails = {
|
package/dist/types/client.d.ts
CHANGED
|
@@ -5866,6 +5866,178 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
|
|
|
5866
5866
|
meta: any;
|
|
5867
5867
|
}>;
|
|
5868
5868
|
}>;
|
|
5869
|
+
group: import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
5870
|
+
addMember: import("@trpc/server").TRPCMutationProcedure<{
|
|
5871
|
+
input: {
|
|
5872
|
+
fromPubKey: string;
|
|
5873
|
+
id: string;
|
|
5874
|
+
encPriv: string;
|
|
5875
|
+
pubKey: string;
|
|
5876
|
+
role?: "ADMIN" | "MEMBER" | undefined;
|
|
5877
|
+
};
|
|
5878
|
+
output: {
|
|
5879
|
+
member: {
|
|
5880
|
+
createdAt: Date;
|
|
5881
|
+
role: "ADMIN" | "MEMBER";
|
|
5882
|
+
groupId: string;
|
|
5883
|
+
identityPubKey: string;
|
|
5884
|
+
sharedByPubKey: string;
|
|
5885
|
+
encPriv: string;
|
|
5886
|
+
initiatorAppId: string;
|
|
5887
|
+
initiatorUserId: string;
|
|
5888
|
+
};
|
|
5889
|
+
};
|
|
5890
|
+
meta: any;
|
|
5891
|
+
}>;
|
|
5892
|
+
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
5893
|
+
input: {
|
|
5894
|
+
fromPubKey: string;
|
|
5895
|
+
name: string;
|
|
5896
|
+
encPriv: string;
|
|
5897
|
+
pubKey: string;
|
|
5898
|
+
};
|
|
5899
|
+
output: {
|
|
5900
|
+
group: {
|
|
5901
|
+
id: string;
|
|
5902
|
+
createdAt: Date;
|
|
5903
|
+
name: string;
|
|
5904
|
+
updatedAt: Date;
|
|
5905
|
+
identityPubKey: string;
|
|
5906
|
+
ownerPubKey: string;
|
|
5907
|
+
organizationId: string | null;
|
|
5908
|
+
applicationId: string | null;
|
|
5909
|
+
initiatorAppId: string;
|
|
5910
|
+
initiatorUserId: string;
|
|
5911
|
+
};
|
|
5912
|
+
};
|
|
5913
|
+
meta: any;
|
|
5914
|
+
}>;
|
|
5915
|
+
deleteMember: import("@trpc/server").TRPCMutationProcedure<{
|
|
5916
|
+
input: {
|
|
5917
|
+
id: string;
|
|
5918
|
+
pubKey: string;
|
|
5919
|
+
};
|
|
5920
|
+
output: {
|
|
5921
|
+
member: {
|
|
5922
|
+
createdAt: Date;
|
|
5923
|
+
role: "ADMIN" | "MEMBER";
|
|
5924
|
+
groupId: string;
|
|
5925
|
+
identityPubKey: string;
|
|
5926
|
+
sharedByPubKey: string;
|
|
5927
|
+
encPriv: string;
|
|
5928
|
+
initiatorAppId: string;
|
|
5929
|
+
initiatorUserId: string;
|
|
5930
|
+
};
|
|
5931
|
+
};
|
|
5932
|
+
meta: any;
|
|
5933
|
+
}>;
|
|
5934
|
+
delete: import("@trpc/server").TRPCMutationProcedure<{
|
|
5935
|
+
input: {
|
|
5936
|
+
id: string;
|
|
5937
|
+
};
|
|
5938
|
+
output: {
|
|
5939
|
+
group: {
|
|
5940
|
+
id: string;
|
|
5941
|
+
createdAt: Date;
|
|
5942
|
+
name: string;
|
|
5943
|
+
updatedAt: Date;
|
|
5944
|
+
identityPubKey: string;
|
|
5945
|
+
ownerPubKey: string;
|
|
5946
|
+
organizationId: string | null;
|
|
5947
|
+
applicationId: string | null;
|
|
5948
|
+
initiatorAppId: string;
|
|
5949
|
+
initiatorUserId: string;
|
|
5950
|
+
};
|
|
5951
|
+
};
|
|
5952
|
+
meta: any;
|
|
5953
|
+
}>;
|
|
5954
|
+
get: import("@trpc/server").TRPCQueryProcedure<{
|
|
5955
|
+
input: {
|
|
5956
|
+
id: string;
|
|
5957
|
+
};
|
|
5958
|
+
output: {
|
|
5959
|
+
group: {
|
|
5960
|
+
id: string;
|
|
5961
|
+
name: string;
|
|
5962
|
+
};
|
|
5963
|
+
};
|
|
5964
|
+
meta: any;
|
|
5965
|
+
}>;
|
|
5966
|
+
getMany: import("@trpc/server").TRPCQueryProcedure<{
|
|
5967
|
+
input: {
|
|
5968
|
+
ids: string[];
|
|
5969
|
+
};
|
|
5970
|
+
output: {
|
|
5971
|
+
groups: {
|
|
5972
|
+
id: string;
|
|
5973
|
+
name: string;
|
|
5974
|
+
}[];
|
|
5975
|
+
};
|
|
5976
|
+
meta: any;
|
|
5977
|
+
}>;
|
|
5978
|
+
transferOwnership: import("@trpc/server").TRPCMutationProcedure<{
|
|
5979
|
+
input: {
|
|
5980
|
+
id: string;
|
|
5981
|
+
pubKey: string;
|
|
5982
|
+
};
|
|
5983
|
+
output: {
|
|
5984
|
+
group: {
|
|
5985
|
+
id: string;
|
|
5986
|
+
createdAt: Date;
|
|
5987
|
+
name: string;
|
|
5988
|
+
updatedAt: Date;
|
|
5989
|
+
identityPubKey: string;
|
|
5990
|
+
ownerPubKey: string;
|
|
5991
|
+
organizationId: string | null;
|
|
5992
|
+
applicationId: string | null;
|
|
5993
|
+
initiatorAppId: string;
|
|
5994
|
+
initiatorUserId: string;
|
|
5995
|
+
};
|
|
5996
|
+
};
|
|
5997
|
+
meta: any;
|
|
5998
|
+
}>;
|
|
5999
|
+
updateMember: import("@trpc/server").TRPCMutationProcedure<{
|
|
6000
|
+
input: {
|
|
6001
|
+
id: string;
|
|
6002
|
+
pubKey: string;
|
|
6003
|
+
role: "ADMIN" | "MEMBER";
|
|
6004
|
+
};
|
|
6005
|
+
output: {
|
|
6006
|
+
member: {
|
|
6007
|
+
createdAt: Date;
|
|
6008
|
+
role: "ADMIN" | "MEMBER";
|
|
6009
|
+
groupId: string;
|
|
6010
|
+
identityPubKey: string;
|
|
6011
|
+
sharedByPubKey: string;
|
|
6012
|
+
encPriv: string;
|
|
6013
|
+
initiatorAppId: string;
|
|
6014
|
+
initiatorUserId: string;
|
|
6015
|
+
};
|
|
6016
|
+
};
|
|
6017
|
+
meta: any;
|
|
6018
|
+
}>;
|
|
6019
|
+
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
6020
|
+
input: {
|
|
6021
|
+
id: string;
|
|
6022
|
+
name: string;
|
|
6023
|
+
};
|
|
6024
|
+
output: {
|
|
6025
|
+
group: {
|
|
6026
|
+
id: string;
|
|
6027
|
+
createdAt: Date;
|
|
6028
|
+
name: string;
|
|
6029
|
+
updatedAt: Date;
|
|
6030
|
+
identityPubKey: string;
|
|
6031
|
+
ownerPubKey: string;
|
|
6032
|
+
organizationId: string | null;
|
|
6033
|
+
applicationId: string | null;
|
|
6034
|
+
initiatorAppId: string;
|
|
6035
|
+
initiatorUserId: string;
|
|
6036
|
+
};
|
|
6037
|
+
};
|
|
6038
|
+
meta: any;
|
|
6039
|
+
}>;
|
|
6040
|
+
}>;
|
|
5869
6041
|
}>>;
|
|
5870
6042
|
export declare const getTrpcGuestClient: ({ url }?: {
|
|
5871
6043
|
url?: string;
|
|
@@ -11726,5 +11898,177 @@ export declare const getTrpcGuestClient: ({ url }?: {
|
|
|
11726
11898
|
meta: any;
|
|
11727
11899
|
}>;
|
|
11728
11900
|
}>;
|
|
11901
|
+
group: import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
11902
|
+
addMember: import("@trpc/server").TRPCMutationProcedure<{
|
|
11903
|
+
input: {
|
|
11904
|
+
fromPubKey: string;
|
|
11905
|
+
id: string;
|
|
11906
|
+
encPriv: string;
|
|
11907
|
+
pubKey: string;
|
|
11908
|
+
role?: "ADMIN" | "MEMBER" | undefined;
|
|
11909
|
+
};
|
|
11910
|
+
output: {
|
|
11911
|
+
member: {
|
|
11912
|
+
createdAt: Date;
|
|
11913
|
+
role: "ADMIN" | "MEMBER";
|
|
11914
|
+
groupId: string;
|
|
11915
|
+
identityPubKey: string;
|
|
11916
|
+
sharedByPubKey: string;
|
|
11917
|
+
encPriv: string;
|
|
11918
|
+
initiatorAppId: string;
|
|
11919
|
+
initiatorUserId: string;
|
|
11920
|
+
};
|
|
11921
|
+
};
|
|
11922
|
+
meta: any;
|
|
11923
|
+
}>;
|
|
11924
|
+
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
11925
|
+
input: {
|
|
11926
|
+
fromPubKey: string;
|
|
11927
|
+
name: string;
|
|
11928
|
+
encPriv: string;
|
|
11929
|
+
pubKey: string;
|
|
11930
|
+
};
|
|
11931
|
+
output: {
|
|
11932
|
+
group: {
|
|
11933
|
+
id: string;
|
|
11934
|
+
createdAt: Date;
|
|
11935
|
+
name: string;
|
|
11936
|
+
updatedAt: Date;
|
|
11937
|
+
identityPubKey: string;
|
|
11938
|
+
ownerPubKey: string;
|
|
11939
|
+
organizationId: string | null;
|
|
11940
|
+
applicationId: string | null;
|
|
11941
|
+
initiatorAppId: string;
|
|
11942
|
+
initiatorUserId: string;
|
|
11943
|
+
};
|
|
11944
|
+
};
|
|
11945
|
+
meta: any;
|
|
11946
|
+
}>;
|
|
11947
|
+
deleteMember: import("@trpc/server").TRPCMutationProcedure<{
|
|
11948
|
+
input: {
|
|
11949
|
+
id: string;
|
|
11950
|
+
pubKey: string;
|
|
11951
|
+
};
|
|
11952
|
+
output: {
|
|
11953
|
+
member: {
|
|
11954
|
+
createdAt: Date;
|
|
11955
|
+
role: "ADMIN" | "MEMBER";
|
|
11956
|
+
groupId: string;
|
|
11957
|
+
identityPubKey: string;
|
|
11958
|
+
sharedByPubKey: string;
|
|
11959
|
+
encPriv: string;
|
|
11960
|
+
initiatorAppId: string;
|
|
11961
|
+
initiatorUserId: string;
|
|
11962
|
+
};
|
|
11963
|
+
};
|
|
11964
|
+
meta: any;
|
|
11965
|
+
}>;
|
|
11966
|
+
delete: import("@trpc/server").TRPCMutationProcedure<{
|
|
11967
|
+
input: {
|
|
11968
|
+
id: string;
|
|
11969
|
+
};
|
|
11970
|
+
output: {
|
|
11971
|
+
group: {
|
|
11972
|
+
id: string;
|
|
11973
|
+
createdAt: Date;
|
|
11974
|
+
name: string;
|
|
11975
|
+
updatedAt: Date;
|
|
11976
|
+
identityPubKey: string;
|
|
11977
|
+
ownerPubKey: string;
|
|
11978
|
+
organizationId: string | null;
|
|
11979
|
+
applicationId: string | null;
|
|
11980
|
+
initiatorAppId: string;
|
|
11981
|
+
initiatorUserId: string;
|
|
11982
|
+
};
|
|
11983
|
+
};
|
|
11984
|
+
meta: any;
|
|
11985
|
+
}>;
|
|
11986
|
+
get: import("@trpc/server").TRPCQueryProcedure<{
|
|
11987
|
+
input: {
|
|
11988
|
+
id: string;
|
|
11989
|
+
};
|
|
11990
|
+
output: {
|
|
11991
|
+
group: {
|
|
11992
|
+
id: string;
|
|
11993
|
+
name: string;
|
|
11994
|
+
};
|
|
11995
|
+
};
|
|
11996
|
+
meta: any;
|
|
11997
|
+
}>;
|
|
11998
|
+
getMany: import("@trpc/server").TRPCQueryProcedure<{
|
|
11999
|
+
input: {
|
|
12000
|
+
ids: string[];
|
|
12001
|
+
};
|
|
12002
|
+
output: {
|
|
12003
|
+
groups: {
|
|
12004
|
+
id: string;
|
|
12005
|
+
name: string;
|
|
12006
|
+
}[];
|
|
12007
|
+
};
|
|
12008
|
+
meta: any;
|
|
12009
|
+
}>;
|
|
12010
|
+
transferOwnership: import("@trpc/server").TRPCMutationProcedure<{
|
|
12011
|
+
input: {
|
|
12012
|
+
id: string;
|
|
12013
|
+
pubKey: string;
|
|
12014
|
+
};
|
|
12015
|
+
output: {
|
|
12016
|
+
group: {
|
|
12017
|
+
id: string;
|
|
12018
|
+
createdAt: Date;
|
|
12019
|
+
name: string;
|
|
12020
|
+
updatedAt: Date;
|
|
12021
|
+
identityPubKey: string;
|
|
12022
|
+
ownerPubKey: string;
|
|
12023
|
+
organizationId: string | null;
|
|
12024
|
+
applicationId: string | null;
|
|
12025
|
+
initiatorAppId: string;
|
|
12026
|
+
initiatorUserId: string;
|
|
12027
|
+
};
|
|
12028
|
+
};
|
|
12029
|
+
meta: any;
|
|
12030
|
+
}>;
|
|
12031
|
+
updateMember: import("@trpc/server").TRPCMutationProcedure<{
|
|
12032
|
+
input: {
|
|
12033
|
+
id: string;
|
|
12034
|
+
pubKey: string;
|
|
12035
|
+
role: "ADMIN" | "MEMBER";
|
|
12036
|
+
};
|
|
12037
|
+
output: {
|
|
12038
|
+
member: {
|
|
12039
|
+
createdAt: Date;
|
|
12040
|
+
role: "ADMIN" | "MEMBER";
|
|
12041
|
+
groupId: string;
|
|
12042
|
+
identityPubKey: string;
|
|
12043
|
+
sharedByPubKey: string;
|
|
12044
|
+
encPriv: string;
|
|
12045
|
+
initiatorAppId: string;
|
|
12046
|
+
initiatorUserId: string;
|
|
12047
|
+
};
|
|
12048
|
+
};
|
|
12049
|
+
meta: any;
|
|
12050
|
+
}>;
|
|
12051
|
+
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
12052
|
+
input: {
|
|
12053
|
+
id: string;
|
|
12054
|
+
name: string;
|
|
12055
|
+
};
|
|
12056
|
+
output: {
|
|
12057
|
+
group: {
|
|
12058
|
+
id: string;
|
|
12059
|
+
createdAt: Date;
|
|
12060
|
+
name: string;
|
|
12061
|
+
updatedAt: Date;
|
|
12062
|
+
identityPubKey: string;
|
|
12063
|
+
ownerPubKey: string;
|
|
12064
|
+
organizationId: string | null;
|
|
12065
|
+
applicationId: string | null;
|
|
12066
|
+
initiatorAppId: string;
|
|
12067
|
+
initiatorUserId: string;
|
|
12068
|
+
};
|
|
12069
|
+
};
|
|
12070
|
+
meta: any;
|
|
12071
|
+
}>;
|
|
12072
|
+
}>;
|
|
11729
12073
|
}>>;
|
|
11730
12074
|
export type ApiClient = ReturnType<typeof createTRPCClient>;
|
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.0-feat-groups-identity.
|
|
5
|
+
"version": "1.75.0-feat-groups-identity.6",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@js-temporal/polyfill": "^0.5.1",
|
|
79
|
-
"@secrecy/trpc-api-types": "1.33.0-feat-groups-identity.
|
|
79
|
+
"@secrecy/trpc-api-types": "1.33.0-feat-groups-identity.31",
|
|
80
80
|
"@trpc/client": "11.6.0",
|
|
81
81
|
"@trpc/server": "^11.6.0",
|
|
82
82
|
"@types/libsodium-wrappers-sumo": "^0.7.8",
|