@secrecy/lib 1.84.1 → 1.85.0

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.
@@ -5,7 +5,7 @@ export class SecrecyGroupClient {
5
5
  constructor(client) {
6
6
  this.#client = client;
7
7
  }
8
- async addMember(input) {
8
+ async addMember(input, fromIdentityPubKey) {
9
9
  const groupIdentity = this.#client.groupIdentities.find((g) => g.groupId === input.id);
10
10
  if (!groupIdentity) {
11
11
  throw new Error('Group identity not found');
@@ -18,11 +18,13 @@ export class SecrecyGroupClient {
18
18
  pubKey: input.pubKey,
19
19
  role: input.role,
20
20
  id: input.id,
21
- encPriv: sodium.to_hex(encryptCryptoBox(sodium.from_hex(groupPriv), input.pubKey, this.#client.currentIdentityPrivateKey)),
21
+ encPriv: sodium.to_hex(encryptCryptoBox(sodium.from_hex(groupPriv), input.pubKey, fromIdentityPubKey
22
+ ? this.#client.getPrivateKey(fromIdentityPubKey)
23
+ : this.#client.currentIdentityPrivateKey)),
22
24
  };
23
25
  return this.#client.apiClient.group.addMember.mutate({
24
26
  ...opts,
25
- fromIdentityPubKey: this.#client.currentIdentity.identityPubKey,
27
+ fromIdentityPubKey: fromIdentityPubKey ?? this.#client.currentIdentity.identityPubKey,
26
28
  });
27
29
  }
28
30
  async create(input) {
@@ -48,7 +48,7 @@ export function getSecrecyClient(opts = {}) {
48
48
  }
49
49
  return null;
50
50
  }
51
- export async function login({ appId, context, path, redirect, scopes, backPath, session, secrecyUrls, }) {
51
+ export async function login({ appId, context, path, redirect, scopes, backPath, session, secrecyUrls, forceLogin, }) {
52
52
  return await new Promise(async (resolve, reject) => {
53
53
  const appUrl = window.location.origin;
54
54
  const client = getSecrecyClient({ session, secrecyUrls });
@@ -109,7 +109,7 @@ export async function login({ appId, context, path, redirect, scopes, backPath,
109
109
  });
110
110
  }
111
111
  };
112
- if (client === null) {
112
+ if (client === null || forceLogin === true) {
113
113
  innerLogin();
114
114
  }
115
115
  else {
@@ -3,7 +3,7 @@ import { type SecrecyClient } from '../index.js';
3
3
  export declare class SecrecyGroupClient {
4
4
  #private;
5
5
  constructor(client: SecrecyClient);
6
- addMember(input: Pick<RouterInputs['group']['addMember'], 'pubKey' | 'role' | 'id'>): Promise<RouterOutputs['group']['addMember']>;
6
+ addMember(input: Pick<RouterInputs['group']['addMember'], 'pubKey' | 'role' | 'id'>, fromIdentityPubKey?: string): Promise<RouterOutputs['group']['addMember']>;
7
7
  create(input: Pick<RouterInputs['group']['create'], 'name'>): Promise<RouterOutputs['group']['create']>;
8
8
  deleteMember(input: RouterInputs['group']['deleteMember']): Promise<RouterOutputs['group']['deleteMember']>;
9
9
  delete(input: RouterInputs['group']['delete']): Promise<RouterOutputs['group']['delete']>;
@@ -19,6 +19,7 @@ export interface HashInfos {
19
19
  export type UseSecrecyParams = Omit<HashInfos, 'appUrl'> & {
20
20
  session?: boolean | undefined;
21
21
  secrecyUrls?: Partial<SecrecyUrls>;
22
+ forceLogin?: boolean | undefined;
22
23
  };
23
24
  export declare function getSecrecyClient(opts?: {
24
25
  session?: boolean;
@@ -27,5 +28,5 @@ export declare function getSecrecyClient(opts?: {
27
28
  type LoginResponse<Params extends UseSecrecyParams> = Params extends {
28
29
  redirect: true;
29
30
  } ? SecrecyClient | null : SecrecyClient;
30
- export declare function login<Params extends UseSecrecyParams>({ appId, context, path, redirect, scopes, backPath, session, secrecyUrls, }: Params): Promise<LoginResponse<Params>>;
31
+ export declare function login<Params extends UseSecrecyParams>({ appId, context, path, redirect, scopes, backPath, session, secrecyUrls, forceLogin, }: Params): Promise<LoginResponse<Params>>;
31
32
  export {};
@@ -764,7 +764,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
764
764
  tags: string[];
765
765
  lang: "en" | "fr";
766
766
  blogId: string;
767
- target: string;
767
+ targets: string[];
768
768
  } & {
769
769
  blog: {
770
770
  id: string;
@@ -789,7 +789,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
789
789
  tags: string[];
790
790
  lang: "en" | "fr";
791
791
  blogId: string;
792
- target: string;
792
+ targets: string[];
793
793
  } & {
794
794
  blog: {
795
795
  id: string;
@@ -7141,7 +7141,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7141
7141
  tags: string[];
7142
7142
  lang: "en" | "fr";
7143
7143
  blogId: string;
7144
- target: string;
7144
+ targets: string[];
7145
7145
  } & {
7146
7146
  blog: {
7147
7147
  id: string;
@@ -7166,7 +7166,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
7166
7166
  tags: string[];
7167
7167
  lang: "en" | "fr";
7168
7168
  blogId: string;
7169
- target: string;
7169
+ targets: string[];
7170
7170
  } & {
7171
7171
  blog: {
7172
7172
  id: 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.84.1",
5
+ "version": "1.85.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/anonymize-org/lib.git"
@@ -49,48 +49,48 @@
49
49
  "semantic-release": "semantic-release"
50
50
  },
51
51
  "devDependencies": {
52
- "@commitlint/cli": "^20.1.0",
53
- "@commitlint/config-conventional": "^20.0.0",
52
+ "@commitlint/cli": "^20.3.0",
53
+ "@commitlint/config-conventional": "^20.3.0",
54
54
  "@prisma/client": "6.17.1",
55
- "@types/bun": "^1.3.0",
55
+ "@types/bun": "^1.3.5",
56
56
  "@types/jsonwebtoken": "^9.0.10",
57
57
  "@types/spark-md5": "^3.0.5",
58
58
  "@types/streamsaver": "^2.0.5",
59
- "@typescript-eslint/eslint-plugin": "^8.46.1",
60
- "@typescript-eslint/parser": "^8.46.1",
61
- "eslint": "^9.37.0",
62
- "eslint-config-love": "^133.0.0",
59
+ "@typescript-eslint/eslint-plugin": "^8.52.0",
60
+ "@typescript-eslint/parser": "^8.52.0",
61
+ "eslint": "^9.39.2",
62
+ "eslint-config-love": "^140.0.0",
63
63
  "eslint-config-prettier": "^10.1.8",
64
64
  "eslint-plugin-import": "^2.32.0",
65
65
  "eslint-plugin-n": "^17.23.1",
66
66
  "eslint-plugin-promise": "^7.2.1",
67
67
  "husky": "^9.1.7",
68
68
  "npm-run-all": "^4.1.5",
69
- "prettier": "^3.6.2",
70
- "rimraf": "^6.0.1",
69
+ "prettier": "^3.7.4",
70
+ "rimraf": "^6.1.2",
71
71
  "semantic-release": "^25.0.2",
72
- "typedoc": "^0.28.14",
72
+ "typedoc": "^0.28.15",
73
73
  "typedoc-plugin-markdown": "^4.9.0",
74
74
  "typedoc-plugin-missing-exports": "^4.1.2",
75
75
  "typescript": "^5.9.3"
76
76
  },
77
77
  "dependencies": {
78
78
  "@js-temporal/polyfill": "^0.5.1",
79
- "@secrecy/trpc-api-types": "1.38.0",
79
+ "@secrecy/trpc-api-types": "1.40.1",
80
80
  "@trpc/client": "11.6.0",
81
81
  "@trpc/server": "^11.6.0",
82
82
  "@types/libsodium-wrappers-sumo": "^0.7.8",
83
- "axios": "^1.11.0",
84
- "bson": "^6.10.4",
85
- "ethers": "^6.15.0",
86
- "file-type": "^21.0.0",
87
- "jsonwebtoken": "^9.0.2",
88
- "ky": "^1.11.0",
89
- "libsodium-wrappers-sumo": "^0.7.15",
90
- "lru-cache": "^11.2.2",
83
+ "axios": "^1.13.2",
84
+ "bson": "^7.0.0",
85
+ "ethers": "^6.16.0",
86
+ "file-type": "^21.3.0",
87
+ "jsonwebtoken": "^9.0.3",
88
+ "ky": "^1.14.2",
89
+ "libsodium-wrappers-sumo": "^0.8.0",
90
+ "lru-cache": "^11.2.4",
91
91
  "spark-md5": "^3.0.2",
92
92
  "streamsaver": "^2.0.6",
93
- "superjson": "2.2.2",
94
- "zod": "4.1.12"
93
+ "superjson": "2.2.6",
94
+ "zod": "4.3.5"
95
95
  }
96
96
  }