@canton-network/wallet-gateway-remote 1.9.0 → 1.11.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.
- package/dist/auth/jwt-auth-service.test.js +2 -1
- package/dist/auth/jwt-unsafe-auth-service.test.js +2 -1
- package/dist/config/Config.d.ts +54 -14
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.js +11 -0
- package/dist/config/ConfigUtils.d.ts.map +1 -1
- package/dist/config/ConfigUtils.js +23 -0
- package/dist/dapp-api/controller.d.ts +2 -1
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +5 -5
- package/dist/dapp-api/controller.test.js +5 -3
- package/dist/dapp-api/rpc-gen/index.d.ts +15 -15
- package/dist/dapp-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/dapp-api/server.d.ts +2 -1
- package/dist/dapp-api/server.d.ts.map +1 -1
- package/dist/dapp-api/server.js +2 -2
- package/dist/dapp-api/server.test.js +3 -2
- package/dist/env.d.ts +5 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +4 -0
- package/dist/example-config.d.ts +3 -0
- package/dist/example-config.d.ts.map +1 -1
- package/dist/example-config.js +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +19 -2
- package/dist/ledger/party-allocation-service.d.ts +1 -1
- package/dist/ledger/party-allocation-service.d.ts.map +1 -1
- package/dist/ledger/party-allocation-service.js +4 -0
- package/dist/ledger/transaction-service.d.ts +5 -8
- package/dist/ledger/transaction-service.d.ts.map +1 -1
- package/dist/ledger/transaction-service.js +55 -389
- package/dist/ledger/transaction-service.test.js +101 -19
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.d.ts +24 -0
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.d.ts.map +1 -0
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.js +138 -0
- package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.d.ts +3 -2
- package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.js +11 -9
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.d.ts +3 -2
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.js +12 -10
- package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.d.ts +5 -7
- package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.js +19 -23
- package/dist/ledger/wallet-allocation/signing-providers/kernel-wallet-allocator.d.ts +5 -4
- package/dist/ledger/wallet-allocation/signing-providers/kernel-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/kernel-wallet-allocator.js +13 -11
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.d.ts +2 -1
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.js +4 -0
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.d.ts +3 -2
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.js +12 -10
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts +9 -10
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/wallet-allocation-service.js +49 -13
- package/dist/ledger/wallet-allocation/wallet-allocation-service.test.js +104 -20
- package/dist/ledger/wallet-sync-service.d.ts.map +1 -1
- package/dist/ledger/wallet-sync-service.js +3 -5
- package/dist/ledger/wallet-sync-service.test.js +3 -1
- package/dist/signing/signing-worker.d.ts +2 -0
- package/dist/signing/signing-worker.d.ts.map +1 -1
- package/dist/signing/signing-worker.js +1 -1
- package/dist/signing/signing-worker.test.js +1 -0
- package/dist/user-api/controller.d.ts +5 -2
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +64 -14
- package/dist/user-api/controller.test.js +60 -72
- package/dist/user-api/rpc-gen/index.d.ts +40 -34
- package/dist/user-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/user-api/rpc-gen/index.js +3 -1
- package/dist/user-api/rpc-gen/typings.d.ts +48 -36
- package/dist/user-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/user-api/server.d.ts +2 -1
- package/dist/user-api/server.d.ts.map +1 -1
- package/dist/user-api/server.js +2 -2
- package/dist/user-api/server.test.js +29 -4
- package/dist/user-api/token-network-matching.d.ts.map +1 -1
- package/dist/user-api/token-network-matching.js +0 -28
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/activities/index.html +3 -3
- package/dist/web/frontend/approve/index.html +3 -3
- package/dist/web/frontend/assets/404-DaA35RoG.js +5 -0
- package/dist/web/frontend/assets/{activities-WIV19RPr.js → activities-B5-XCCZC.js} +2 -2
- package/dist/web/frontend/assets/{addIdentityProvider-DA4ry8mX.js → addIdentityProvider-BYCAWtiZ.js} +2 -2
- package/dist/web/frontend/assets/addNetwork-DJM_nq3n.js +38 -0
- package/dist/web/frontend/assets/addParty-BQLGvzJS.js +13 -0
- package/dist/web/frontend/assets/approve-CyDHnjOG.js +21 -0
- package/dist/web/frontend/assets/callback-DCYIq514.js +7 -0
- package/dist/web/frontend/assets/common-Byz7o2Qs.js +31 -0
- package/dist/web/frontend/assets/editParty-Oe0m1yB6.js +14 -0
- package/dist/web/frontend/assets/{identityProviders-nRE_Y8vP.js → identityProviders-1ro-4zy9.js} +3 -3
- package/dist/web/frontend/assets/index-BhzcMGYw.js +4943 -0
- package/dist/web/frontend/assets/index-Cvcr2Fng.js +2 -0
- package/dist/web/frontend/assets/index-D-NXyb6u.js +93 -0
- package/dist/web/frontend/assets/login-VCs39tyk.js +11 -0
- package/dist/web/frontend/assets/{networks-pshe9KRL.js → networks-CRTkFNGb.js} +2 -2
- package/dist/web/frontend/assets/{reviewIdentityProvider-DtUWN0jT.js → reviewIdentityProvider-8F5_K-A5.js} +3 -3
- package/dist/web/frontend/assets/{reviewNetwork-3vKq0jr4.js → reviewNetwork-DL-oQDwd.js} +3 -3
- package/dist/web/frontend/assets/{settings-Bdp9lvU5.js → settings-DgRrnzuq.js} +2 -2
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/identity-providers/add/index.html +2 -2
- package/dist/web/frontend/identity-providers/index.html +2 -2
- package/dist/web/frontend/identity-providers/review/index.html +2 -2
- package/dist/web/frontend/index.html +1 -1
- package/dist/web/frontend/login/index.html +2 -2
- package/dist/web/frontend/networks/add/index.html +2 -2
- package/dist/web/frontend/networks/index.html +2 -2
- package/dist/web/frontend/networks/review/index.html +2 -2
- package/dist/web/frontend/parties/add/index.html +4 -3
- package/dist/web/frontend/parties/edit/index.html +17 -0
- package/dist/web/frontend/parties/index.html +2 -2
- package/dist/web/frontend/settings/index.html +2 -2
- package/package.json +29 -27
- package/dist/web/frontend/assets/404-G9ooRT6W.js +0 -5
- package/dist/web/frontend/assets/addNetwork-URqIQBpY.js +0 -38
- package/dist/web/frontend/assets/addParty-CYVpWBOW.js +0 -45
- package/dist/web/frontend/assets/approve-uxh5J3JI.js +0 -21
- package/dist/web/frontend/assets/callback-BSwKp4qp.js +0 -3
- package/dist/web/frontend/assets/index-Bbo4F8DN.js +0 -4810
- package/dist/web/frontend/assets/index-BjhQnXf1.js +0 -2
- package/dist/web/frontend/assets/index-kNaUhLVu.js +0 -91
- package/dist/web/frontend/assets/login-Dojx8YbO.js +0 -11
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
4
|
+
import { getLogger } from '@logtape/logtape';
|
|
4
5
|
import { pino } from 'pino';
|
|
5
6
|
import { sink } from 'pino-test';
|
|
6
7
|
import { SignJWT } from 'jose';
|
|
@@ -48,7 +49,7 @@ describe('jwtAuthService', () => {
|
|
|
48
49
|
let store;
|
|
49
50
|
beforeEach(async () => {
|
|
50
51
|
mockLogger = pino(sink());
|
|
51
|
-
store = new StoreInternal({ idps: [], networks: [] },
|
|
52
|
+
store = new StoreInternal({ idps: [], networks: [] }, getLogger('mock'), authContext);
|
|
52
53
|
vi.stubGlobal('fetch', mockFetch);
|
|
53
54
|
mockFetch.mockReset();
|
|
54
55
|
mockJwtVerify.mockReset();
|
|
@@ -6,6 +6,7 @@ import { sink } from 'pino-test';
|
|
|
6
6
|
import { SignJWT } from 'jose';
|
|
7
7
|
import { StoreInternal } from '@canton-network/core-wallet-store-inmemory';
|
|
8
8
|
import { jwtAuthService as jwtUnsafeAuthService } from './jwt-unsafe-auth-service.js';
|
|
9
|
+
import { getLogger } from '@logtape/logtape';
|
|
9
10
|
const authContext = {
|
|
10
11
|
userId: 'test-user-id',
|
|
11
12
|
accessToken: 'test-access-token',
|
|
@@ -22,7 +23,7 @@ describe('jwtAuthService (unsafe)', () => {
|
|
|
22
23
|
let store;
|
|
23
24
|
beforeEach(async () => {
|
|
24
25
|
mockLogger = pino(sink());
|
|
25
|
-
store = new StoreInternal({ idps: [], networks: [] },
|
|
26
|
+
store = new StoreInternal({ idps: [], networks: [] }, getLogger('mock'), authContext);
|
|
26
27
|
await store.addIdp({
|
|
27
28
|
id: 'idp-self',
|
|
28
29
|
type: 'self_signed',
|
package/dist/config/Config.d.ts
CHANGED
|
@@ -55,34 +55,48 @@ export declare const rawConfigSchema: z.ZodObject<{
|
|
|
55
55
|
}>>;
|
|
56
56
|
}, z.core.$strip>>>;
|
|
57
57
|
store: z.ZodObject<{
|
|
58
|
-
connection: z.
|
|
58
|
+
connection: z.ZodUnion<readonly [z.ZodObject<{
|
|
59
59
|
type: z.ZodLiteral<"memory">;
|
|
60
60
|
}, z.core.$strip>, z.ZodObject<{
|
|
61
61
|
type: z.ZodLiteral<"sqlite">;
|
|
62
62
|
database: z.ZodString;
|
|
63
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
64
64
|
type: z.ZodLiteral<"postgres">;
|
|
65
65
|
host: z.ZodString;
|
|
66
66
|
port: z.ZodNumber;
|
|
67
67
|
user: z.ZodString;
|
|
68
68
|
password: z.ZodString;
|
|
69
69
|
database: z.ZodString;
|
|
70
|
-
}, z.core.$loose
|
|
70
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"postgres">;
|
|
72
|
+
host: z.ZodString;
|
|
73
|
+
port: z.ZodNumber;
|
|
74
|
+
user: z.ZodString;
|
|
75
|
+
passwordEnv: z.ZodString;
|
|
76
|
+
database: z.ZodString;
|
|
77
|
+
}, z.core.$loose>]>]>;
|
|
71
78
|
}, z.core.$strip>;
|
|
72
79
|
signingStore: z.ZodObject<{
|
|
73
|
-
connection: z.
|
|
80
|
+
connection: z.ZodUnion<readonly [z.ZodObject<{
|
|
74
81
|
type: z.ZodLiteral<"memory">;
|
|
75
82
|
}, z.core.$strip>, z.ZodObject<{
|
|
76
83
|
type: z.ZodLiteral<"sqlite">;
|
|
77
84
|
database: z.ZodString;
|
|
78
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
79
86
|
type: z.ZodLiteral<"postgres">;
|
|
80
87
|
host: z.ZodString;
|
|
81
88
|
port: z.ZodNumber;
|
|
82
89
|
user: z.ZodString;
|
|
83
90
|
password: z.ZodString;
|
|
84
91
|
database: z.ZodString;
|
|
85
|
-
}, z.core.$loose
|
|
92
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"postgres">;
|
|
94
|
+
host: z.ZodString;
|
|
95
|
+
port: z.ZodNumber;
|
|
96
|
+
user: z.ZodString;
|
|
97
|
+
passwordEnv: z.ZodString;
|
|
98
|
+
database: z.ZodString;
|
|
99
|
+
}, z.core.$loose>]>]>;
|
|
86
100
|
}, z.core.$strip>;
|
|
87
101
|
bootstrap: z.ZodObject<{
|
|
88
102
|
idps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -102,7 +116,7 @@ export declare const rawConfigSchema: z.ZodObject<{
|
|
|
102
116
|
synchronizerId: z.ZodOptional<z.ZodString>;
|
|
103
117
|
identityProviderId: z.ZodString;
|
|
104
118
|
ledgerApi: z.ZodObject<{
|
|
105
|
-
baseUrl: z.
|
|
119
|
+
baseUrl: z.ZodURL;
|
|
106
120
|
}, z.core.$strip>;
|
|
107
121
|
auth: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
108
122
|
method: z.ZodLiteral<"authorization_code">;
|
|
@@ -217,6 +231,12 @@ export declare const rawConfigSchema: z.ZodObject<{
|
|
|
217
231
|
}, z.core.$strip>], "method">]>>;
|
|
218
232
|
}, z.core.$strip>>;
|
|
219
233
|
}, z.core.$strip>;
|
|
234
|
+
hashingScheme: z.ZodOptional<z.ZodObject<{
|
|
235
|
+
version: z.ZodEnum<{
|
|
236
|
+
HASHING_SCHEME_VERSION_V2: "HASHING_SCHEME_VERSION_V2";
|
|
237
|
+
HASHING_SCHEME_VERSION_V3: "HASHING_SCHEME_VERSION_V3";
|
|
238
|
+
}>;
|
|
239
|
+
}, z.core.$strip>>;
|
|
220
240
|
}, z.core.$strip>;
|
|
221
241
|
export declare const configSchema: z.ZodObject<{
|
|
222
242
|
kernel: z.ZodObject<{
|
|
@@ -254,34 +274,48 @@ export declare const configSchema: z.ZodObject<{
|
|
|
254
274
|
}>>;
|
|
255
275
|
}, z.core.$strip>>>;
|
|
256
276
|
store: z.ZodObject<{
|
|
257
|
-
connection: z.
|
|
277
|
+
connection: z.ZodUnion<readonly [z.ZodObject<{
|
|
258
278
|
type: z.ZodLiteral<"memory">;
|
|
259
279
|
}, z.core.$strip>, z.ZodObject<{
|
|
260
280
|
type: z.ZodLiteral<"sqlite">;
|
|
261
281
|
database: z.ZodString;
|
|
262
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
282
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
263
283
|
type: z.ZodLiteral<"postgres">;
|
|
264
284
|
host: z.ZodString;
|
|
265
285
|
port: z.ZodNumber;
|
|
266
286
|
user: z.ZodString;
|
|
267
287
|
password: z.ZodString;
|
|
268
288
|
database: z.ZodString;
|
|
269
|
-
}, z.core.$loose
|
|
289
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
290
|
+
type: z.ZodLiteral<"postgres">;
|
|
291
|
+
host: z.ZodString;
|
|
292
|
+
port: z.ZodNumber;
|
|
293
|
+
user: z.ZodString;
|
|
294
|
+
passwordEnv: z.ZodString;
|
|
295
|
+
database: z.ZodString;
|
|
296
|
+
}, z.core.$loose>]>]>;
|
|
270
297
|
}, z.core.$strip>;
|
|
271
298
|
signingStore: z.ZodObject<{
|
|
272
|
-
connection: z.
|
|
299
|
+
connection: z.ZodUnion<readonly [z.ZodObject<{
|
|
273
300
|
type: z.ZodLiteral<"memory">;
|
|
274
301
|
}, z.core.$strip>, z.ZodObject<{
|
|
275
302
|
type: z.ZodLiteral<"sqlite">;
|
|
276
303
|
database: z.ZodString;
|
|
277
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
304
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
278
305
|
type: z.ZodLiteral<"postgres">;
|
|
279
306
|
host: z.ZodString;
|
|
280
307
|
port: z.ZodNumber;
|
|
281
308
|
user: z.ZodString;
|
|
282
309
|
password: z.ZodString;
|
|
283
310
|
database: z.ZodString;
|
|
284
|
-
}, z.core.$loose
|
|
311
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
312
|
+
type: z.ZodLiteral<"postgres">;
|
|
313
|
+
host: z.ZodString;
|
|
314
|
+
port: z.ZodNumber;
|
|
315
|
+
user: z.ZodString;
|
|
316
|
+
passwordEnv: z.ZodString;
|
|
317
|
+
database: z.ZodString;
|
|
318
|
+
}, z.core.$loose>]>]>;
|
|
285
319
|
}, z.core.$strip>;
|
|
286
320
|
bootstrap: z.ZodObject<{
|
|
287
321
|
idps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -301,7 +335,7 @@ export declare const configSchema: z.ZodObject<{
|
|
|
301
335
|
synchronizerId: z.ZodOptional<z.ZodString>;
|
|
302
336
|
identityProviderId: z.ZodString;
|
|
303
337
|
ledgerApi: z.ZodObject<{
|
|
304
|
-
baseUrl: z.
|
|
338
|
+
baseUrl: z.ZodURL;
|
|
305
339
|
}, z.core.$strip>;
|
|
306
340
|
auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
307
341
|
method: z.ZodLiteral<"authorization_code">;
|
|
@@ -362,6 +396,12 @@ export declare const configSchema: z.ZodObject<{
|
|
|
362
396
|
}, z.core.$strip>], "method">>;
|
|
363
397
|
}, z.core.$strip>>;
|
|
364
398
|
}, z.core.$strip>;
|
|
399
|
+
hashingScheme: z.ZodOptional<z.ZodObject<{
|
|
400
|
+
version: z.ZodEnum<{
|
|
401
|
+
HASHING_SCHEME_VERSION_V2: "HASHING_SCHEME_VERSION_V2";
|
|
402
|
+
HASHING_SCHEME_VERSION_V3: "HASHING_SCHEME_VERSION_V3";
|
|
403
|
+
}>;
|
|
404
|
+
}, z.core.$strip>>;
|
|
365
405
|
}, z.core.$strip>;
|
|
366
406
|
export type KernelInfo = z.infer<typeof kernelInfoSchema>;
|
|
367
407
|
export type ServerConfig = z.infer<typeof serverConfigSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,eAAO,MAAM,gBAAgB;;;;iBAY3B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;iBA0D7B,CAAA;
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,eAAO,MAAM,gBAAgB;;;;iBAY3B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;iBA0D7B,CAAA;AA6CF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ1B,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQvB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
package/dist/config/Config.js
CHANGED
|
@@ -86,6 +86,15 @@ const bootstrapFromEnv = bootstrapConfigSchema.extend({
|
|
|
86
86
|
serviceAccountAuth: authFromEnvOrConfig.optional(),
|
|
87
87
|
})),
|
|
88
88
|
});
|
|
89
|
+
const hashingSchemeSchema = z
|
|
90
|
+
.object({
|
|
91
|
+
version: z
|
|
92
|
+
.enum(['HASHING_SCHEME_VERSION_V2', 'HASHING_SCHEME_VERSION_V3'])
|
|
93
|
+
.meta({
|
|
94
|
+
description: 'Hashing scheme version for the ledger. If omitted, defaults to HASHING_SCHEME_VERSION_V3',
|
|
95
|
+
}),
|
|
96
|
+
})
|
|
97
|
+
.optional();
|
|
89
98
|
// Includes secrets for networks as env vars, rather than defined explicitly
|
|
90
99
|
export const rawConfigSchema = z.object({
|
|
91
100
|
kernel: kernelInfoSchema,
|
|
@@ -94,6 +103,7 @@ export const rawConfigSchema = z.object({
|
|
|
94
103
|
store: storeConfigSchema,
|
|
95
104
|
signingStore: signingStoreConfigSchema,
|
|
96
105
|
bootstrap: bootstrapFromEnv,
|
|
106
|
+
hashingScheme: hashingSchemeSchema,
|
|
97
107
|
});
|
|
98
108
|
export const configSchema = z.object({
|
|
99
109
|
kernel: kernelInfoSchema,
|
|
@@ -102,4 +112,5 @@ export const configSchema = z.object({
|
|
|
102
112
|
store: storeConfigSchema,
|
|
103
113
|
signingStore: signingStoreConfigSchema,
|
|
104
114
|
bootstrap: bootstrapConfigSchema,
|
|
115
|
+
hashingScheme: hashingSchemeSchema,
|
|
105
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigUtils.d.ts","sourceRoot":"","sources":["../../src/config/ConfigUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAA8B,MAAM,aAAa,CAAA;AAGhE,qBAAa,WAAW;IACpB,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAsDlD;
|
|
1
|
+
{"version":3,"file":"ConfigUtils.d.ts","sourceRoot":"","sources":["../../src/config/ConfigUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAA8B,MAAM,aAAa,CAAA;AAGhE,qBAAa,WAAW;IACpB,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAsDlD;AA8HD,UAAU,IAAI;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACrB;AAOD,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,IAa1D,CAAA"}
|
|
@@ -58,6 +58,25 @@ function resolveRawNetworkAuth(n) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
function resolvePostgressPassword(s) {
|
|
62
|
+
if (s.connection.type !== 'postgres') {
|
|
63
|
+
return s;
|
|
64
|
+
}
|
|
65
|
+
if ('password' in s.connection) {
|
|
66
|
+
return s;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const { passwordEnv, ...rest } = s.connection;
|
|
70
|
+
const password = Env.get(passwordEnv, { required: true });
|
|
71
|
+
return {
|
|
72
|
+
...s,
|
|
73
|
+
connection: {
|
|
74
|
+
...rest,
|
|
75
|
+
password,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
61
80
|
function resolveRawConfig(rawConfig) {
|
|
62
81
|
const rawNetworks = rawConfig.bootstrap.networks;
|
|
63
82
|
const networks = rawNetworks.map((n) => {
|
|
@@ -72,8 +91,12 @@ function resolveRawConfig(rawConfig) {
|
|
|
72
91
|
: undefined,
|
|
73
92
|
};
|
|
74
93
|
});
|
|
94
|
+
const store = resolvePostgressPassword(rawConfig.store);
|
|
95
|
+
const signingStore = resolvePostgressPassword(rawConfig.signingStore);
|
|
75
96
|
return {
|
|
76
97
|
...rawConfig,
|
|
98
|
+
store,
|
|
99
|
+
signingStore,
|
|
77
100
|
bootstrap: {
|
|
78
101
|
...rawConfig.bootstrap,
|
|
79
102
|
networks,
|
|
@@ -4,10 +4,11 @@ import { NotificationService } from '../notification/NotificationService.js';
|
|
|
4
4
|
import { KernelInfo as KernelInfoConfig } from '../config/Config.js';
|
|
5
5
|
import { Logger } from 'pino';
|
|
6
6
|
import { SigningDrivers } from '../signing/signing-drivers.js';
|
|
7
|
+
import { HASHING_SCHEME_VERSION } from '../env.js';
|
|
7
8
|
export interface DappControllerDeps {
|
|
8
9
|
signingDrivers: SigningDrivers;
|
|
9
10
|
}
|
|
10
|
-
export declare const dappController: (kernelInfo: KernelInfoConfig, dappUrl: string, userUrl: string, store: Store, notificationService: NotificationService, _logger: Logger, origin: string | null, deps: DappControllerDeps, context?: AuthContext) => {
|
|
11
|
+
export declare const dappController: (kernelInfo: KernelInfoConfig, dappUrl: string, userUrl: string, store: Store, notificationService: NotificationService, _logger: Logger, origin: string | null, deps: DappControllerDeps, hashingSchemeVersion: HASHING_SCHEME_VERSION, context?: AuthContext) => {
|
|
11
12
|
status: import("./rpc-gen/typings.js").Status;
|
|
12
13
|
connect: import("./rpc-gen/typings.js").Connect;
|
|
13
14
|
disconnect: import("./rpc-gen/typings.js").Disconnect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,WAAW,EAEd,MAAM,kCAAkC,CAAA;AAczC,OAAO,EAAE,KAAK,EAAe,MAAM,mCAAmC,CAAA;AAUtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAK7B,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,WAAW,EAEd,MAAM,kCAAkC,CAAA;AAczC,OAAO,EAAE,KAAK,EAAe,MAAM,mCAAmC,CAAA;AAUtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAK7B,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAElD,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,cAAc,CAAA;CACjC;AAED,eAAO,MAAM,cAAc,GACvB,YAAY,gBAAgB,EAC5B,SAAS,MAAM,EACf,SAAS,MAAM,EACf,OAAO,KAAK,EACZ,qBAAqB,mBAAmB,EACxC,SAAS,MAAM,EACf,QAAQ,MAAM,GAAG,IAAI,EACrB,MAAM,kBAAkB,EACxB,sBAAsB,sBAAsB,EAC5C,UAAU,WAAW;;;;;;;;;;;;;;;;CAmexB,CAAA"}
|
|
@@ -7,7 +7,7 @@ import { v4 } from 'uuid';
|
|
|
7
7
|
import { networkStatus, ledgerPrepareParams, logDynamically } from '../utils.js';
|
|
8
8
|
import { TransactionService } from '../ledger/transaction-service.js';
|
|
9
9
|
import { rpcErrors } from '@canton-network/core-rpc-errors';
|
|
10
|
-
export const dappController = (kernelInfo, dappUrl, userUrl, store, notificationService, _logger, origin, deps, context) => {
|
|
10
|
+
export const dappController = (kernelInfo, dappUrl, userUrl, store, notificationService, _logger, origin, deps, hashingSchemeVersion, context) => {
|
|
11
11
|
const logger = _logger.child({ component: 'dapp-controller' });
|
|
12
12
|
function assertActAsPartiesBelongToUser(actAs, wallets) {
|
|
13
13
|
for (const party of actAs) {
|
|
@@ -197,7 +197,7 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
197
197
|
params,
|
|
198
198
|
},
|
|
199
199
|
});
|
|
200
|
-
const prepared = await prepareSubmission(ledgerUserId, actAs, synchronizerId, params, ledgerClient);
|
|
200
|
+
const prepared = await prepareSubmission(ledgerUserId, actAs, synchronizerId, params, ledgerClient, hashingSchemeVersion);
|
|
201
201
|
logDynamically(logger, 'prepareExecute: Received response from ledger', {
|
|
202
202
|
info: { transactionId },
|
|
203
203
|
debug: {
|
|
@@ -238,7 +238,7 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
238
238
|
transactionId,
|
|
239
239
|
signingProviderId: wallet.signingProviderId,
|
|
240
240
|
}, 'Service account straight-through prepare/sign/execute');
|
|
241
|
-
const transactionService = new TransactionService(store, logger, deps.signingDrivers, notifier);
|
|
241
|
+
const transactionService = new TransactionService(store, logger, deps.signingDrivers, notifier, hashingSchemeVersion);
|
|
242
242
|
try {
|
|
243
243
|
await transactionService.signAndExecute(context, network, wallet, transaction);
|
|
244
244
|
}
|
|
@@ -378,6 +378,6 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
378
378
|
},
|
|
379
379
|
});
|
|
380
380
|
};
|
|
381
|
-
async function prepareSubmission(userId, partyIds, synchronizerId, params, ledgerClient) {
|
|
382
|
-
return await ledgerClient.postWithRetry('/v2/interactive-submission/prepare', ledgerPrepareParams(userId, partyIds, synchronizerId, params));
|
|
381
|
+
async function prepareSubmission(userId, partyIds, synchronizerId, params, ledgerClient, hashingSchemeVersion) {
|
|
382
|
+
return await ledgerClient.postWithRetry('/v2/interactive-submission/prepare', ledgerPrepareParams(userId, partyIds, synchronizerId, params, hashingSchemeVersion));
|
|
383
383
|
}
|
|
@@ -8,6 +8,7 @@ import { StoreInternal } from '@canton-network/core-wallet-store-inmemory';
|
|
|
8
8
|
import { SigningProvider } from '@canton-network/core-signing-lib';
|
|
9
9
|
import { NotificationService } from '../notification/NotificationService.js';
|
|
10
10
|
import { dappController } from './controller.js';
|
|
11
|
+
import { getLogger } from '@logtape/logtape';
|
|
11
12
|
const ledgerMocks = vi.hoisted(() => ({
|
|
12
13
|
getWithRetry: vi.fn(),
|
|
13
14
|
postWithRetry: vi.fn(),
|
|
@@ -95,11 +96,12 @@ const primaryWallet = {
|
|
|
95
96
|
publicKey: 'wallet-public-key',
|
|
96
97
|
namespace: 'namespace',
|
|
97
98
|
networkId: 'network1',
|
|
99
|
+
userId: 'user-1',
|
|
98
100
|
rights: [PartyLevelRight.CanActAs],
|
|
99
101
|
};
|
|
100
102
|
async function createStore(logger, context, options = {}) {
|
|
101
103
|
const { withSession = true, withWallet = true } = options;
|
|
102
|
-
const store = new StoreInternal({ idps: [idp], networks: [storeNetwork] },
|
|
104
|
+
const store = new StoreInternal({ idps: [idp], networks: [storeNetwork] }, getLogger('mock'), context);
|
|
103
105
|
if (context && withSession) {
|
|
104
106
|
await store.setSession(session);
|
|
105
107
|
}
|
|
@@ -109,7 +111,7 @@ async function createStore(logger, context, options = {}) {
|
|
|
109
111
|
return store;
|
|
110
112
|
}
|
|
111
113
|
function createController(store, notificationService, logger, context, requestOrigin = origin, deps) {
|
|
112
|
-
return dappController(kernelInfo, dappUrl, userUrl, store, notificationService, logger, requestOrigin, deps || { signingDrivers: {} }, context);
|
|
114
|
+
return dappController(kernelInfo, dappUrl, userUrl, store, notificationService, logger, requestOrigin, deps || { signingDrivers: {} }, 'HASHING_SCHEME_VERSION_V3', context);
|
|
113
115
|
}
|
|
114
116
|
describe('dappController', () => {
|
|
115
117
|
let logger;
|
|
@@ -420,7 +422,7 @@ describe('dappController', () => {
|
|
|
420
422
|
...storeNetwork,
|
|
421
423
|
synchronizerId: undefined,
|
|
422
424
|
};
|
|
423
|
-
const store = new StoreInternal({ idps: [idp], networks: [networkWithoutSync] },
|
|
425
|
+
const store = new StoreInternal({ idps: [idp], networks: [networkWithoutSync] }, getLogger('mock'), auth);
|
|
424
426
|
await store.setSession(session);
|
|
425
427
|
await store.addWallet(primaryWallet);
|
|
426
428
|
mockUuidV4.mockReturnValueOnce('cmd-id');
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Status } from './typings.js';
|
|
2
|
-
import { Connect } from './typings.js';
|
|
3
|
-
import { Disconnect } from './typings.js';
|
|
4
|
-
import { IsConnected } from './typings.js';
|
|
5
|
-
import { GetActiveNetwork } from './typings.js';
|
|
6
|
-
import { PrepareExecute } from './typings.js';
|
|
7
|
-
import { SignMessage } from './typings.js';
|
|
8
|
-
import { LedgerApi } from './typings.js';
|
|
9
|
-
import { Connected } from './typings.js';
|
|
10
|
-
import { OnStatusChanged } from './typings.js';
|
|
11
|
-
import { AccountsChanged } from './typings.js';
|
|
12
|
-
import { GetPrimaryAccount } from './typings.js';
|
|
13
|
-
import { ListAccounts } from './typings.js';
|
|
14
|
-
import { TxChanged } from './typings.js';
|
|
15
|
-
import { MessageSignature } from './typings.js';
|
|
1
|
+
import type { Status } from './typings.js';
|
|
2
|
+
import type { Connect } from './typings.js';
|
|
3
|
+
import type { Disconnect } from './typings.js';
|
|
4
|
+
import type { IsConnected } from './typings.js';
|
|
5
|
+
import type { GetActiveNetwork } from './typings.js';
|
|
6
|
+
import type { PrepareExecute } from './typings.js';
|
|
7
|
+
import type { SignMessage } from './typings.js';
|
|
8
|
+
import type { LedgerApi } from './typings.js';
|
|
9
|
+
import type { Connected } from './typings.js';
|
|
10
|
+
import type { OnStatusChanged } from './typings.js';
|
|
11
|
+
import type { AccountsChanged } from './typings.js';
|
|
12
|
+
import type { GetPrimaryAccount } from './typings.js';
|
|
13
|
+
import type { ListAccounts } from './typings.js';
|
|
14
|
+
import type { TxChanged } from './typings.js';
|
|
15
|
+
import type { MessageSignature } from './typings.js';
|
|
16
16
|
export type Methods = {
|
|
17
17
|
status: Status;
|
|
18
18
|
connect: Connect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpD,MAAM,MAAM,OAAO,GAAG;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,WAAW,CAAA;IACxB,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,SAAS,CAAA;IACpB,eAAe,EAAE,eAAe,CAAA;IAChC,eAAe,EAAE,eAAe,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;IACpB,gBAAgB,EAAE,gBAAgB,CAAA;CACrC,CAAA;AAED,iBAAS,eAAe,CAAC,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;EAkBxC;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -6,5 +6,6 @@ import { Server } from 'http';
|
|
|
6
6
|
import { NotificationService } from '../notification/NotificationService.js';
|
|
7
7
|
import { KernelInfo, ServerConfig } from '../config/Config.js';
|
|
8
8
|
import { DappControllerDeps } from './controller.js';
|
|
9
|
-
|
|
9
|
+
import { HASHING_SCHEME_VERSION } from '../env.js';
|
|
10
|
+
export declare const dapp: (route: string, app: express.Express, logger: Logger, server: Server, kernelInfo: KernelInfo, dappUrl: string, userUrl: string, serverConfig: ServerConfig, notificationService: NotificationService, store: Store & AuthAware<Store>, controllerDeps: DappControllerDeps, hashingSchemeVersion: HASHING_SCHEME_VERSION) => Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>;
|
|
10
11
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dapp-api/server.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,EAAE,MAAM,EAA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 -7,7 +7,7 @@ function writeSSE(res, event, data) {
|
|
|
7
7
|
res.write(`event: ${event}\n`);
|
|
8
8
|
res.write(`data: ${JSON.stringify(data)}\n\n`);
|
|
9
9
|
}
|
|
10
|
-
export const dapp = (route, app, logger, server, kernelInfo, dappUrl, userUrl, serverConfig, notificationService, store, controllerDeps) => {
|
|
10
|
+
export const dapp = (route, app, logger, server, kernelInfo, dappUrl, userUrl, serverConfig, notificationService, store, controllerDeps, hashingSchemeVersion) => {
|
|
11
11
|
app.use(cors({
|
|
12
12
|
origin: serverConfig.allowedOrigins,
|
|
13
13
|
}));
|
|
@@ -79,7 +79,7 @@ export const dapp = (route, app, logger, server, kernelInfo, dappUrl, userUrl, s
|
|
|
79
79
|
app.use(route, (req, res, next) => {
|
|
80
80
|
const origin = req.headers.origin ?? null;
|
|
81
81
|
jsonRpcHandler({
|
|
82
|
-
controller: dappController(kernelInfo, dappUrl, userUrl, store.withAuthContext(req.authContext), notificationService, logger, origin, controllerDeps, req.authContext),
|
|
82
|
+
controller: dappController(kernelInfo, dappUrl, userUrl, store.withAuthContext(req.authContext), notificationService, logger, origin, controllerDeps, hashingSchemeVersion, req.authContext),
|
|
83
83
|
logger,
|
|
84
84
|
})(req, res, next);
|
|
85
85
|
});
|
|
@@ -11,9 +11,10 @@ import { NotificationService } from '../notification/NotificationService.js';
|
|
|
11
11
|
import { pino } from 'pino';
|
|
12
12
|
import { sink } from 'pino-test';
|
|
13
13
|
import { createServer } from 'http';
|
|
14
|
+
import { getLogger } from '@logtape/logtape';
|
|
14
15
|
const configPath = '../test/config.json';
|
|
15
16
|
const config = ConfigUtils.loadConfigFile(configPath);
|
|
16
|
-
const store = new StoreInternal(config.bootstrap,
|
|
17
|
+
const store = new StoreInternal(config.bootstrap, getLogger('mock'));
|
|
17
18
|
const notificationService = new NotificationService(pino(sink()));
|
|
18
19
|
test('call connect rpc', async () => {
|
|
19
20
|
const app = express();
|
|
@@ -21,7 +22,7 @@ test('call connect rpc', async () => {
|
|
|
21
22
|
app.use(express.json());
|
|
22
23
|
const server = createServer(app);
|
|
23
24
|
const { dappApiUrl, publicUrl } = deriveUrls(config);
|
|
24
|
-
const response = await request(dapp('/api/v0/dapp', app, pino(sink()), server, config.kernel, dappApiUrl, publicUrl, config.server, notificationService, store, { signingDrivers: {} }))
|
|
25
|
+
const response = await request(dapp('/api/v0/dapp', app, pino(sink()), server, config.kernel, dappApiUrl, publicUrl, config.server, notificationService, store, { signingDrivers: {} }, 'HASHING_SCHEME_VERSION_V3'))
|
|
25
26
|
.post('/api/v0/dapp')
|
|
26
27
|
.send({ jsonrpc: '2.0', id: 0, method: 'connect', params: [] })
|
|
27
28
|
.set('Accept', 'application/json');
|
package/dist/env.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type HASHING_SCHEME_VERSION = 'HASHING_SCHEME_VERSION_V2' | 'HASHING_SCHEME_VERSION_V3' | undefined;
|
|
1
2
|
export declare class Env {
|
|
2
3
|
static FIREBLOCKS_API_KEY: () => string | undefined;
|
|
3
4
|
static FIREBLOCKS_SECRET: () => string | undefined;
|
|
@@ -18,6 +19,10 @@ export declare class Env {
|
|
|
18
19
|
static DFNS_CRED_ID: () => string | undefined;
|
|
19
20
|
static DFNS_PRIVATE_KEY: () => string | undefined;
|
|
20
21
|
static DFNS_AUTH_TOKEN: () => string | undefined;
|
|
22
|
+
static BITGO_ACCESS_TOKEN: () => string | undefined;
|
|
23
|
+
static BITGO_API_URL: (fallback: string) => string;
|
|
24
|
+
static BITGO_ENTERPRISE_ID: () => string | undefined;
|
|
25
|
+
static BITGO_COIN: () => string | undefined;
|
|
21
26
|
static get(key: string, options: {
|
|
22
27
|
required?: boolean;
|
|
23
28
|
fallback: string;
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAGA,qBAAa,GAAG;IACZ,MAAM,CAAC,kBAA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
|
static { this.DFNS_AUTH_TOKEN = () => Env.get('DFNS_AUTH_TOKEN'); }
|
|
23
|
+
static { this.BITGO_ACCESS_TOKEN = () => Env.get('BITGO_ACCESS_TOKEN'); }
|
|
24
|
+
static { this.BITGO_API_URL = (fallback) => Env.get('BITGO_API_URL', { fallback }); }
|
|
25
|
+
static { this.BITGO_ENTERPRISE_ID = () => Env.get('BITGO_ENTERPRISE_ID'); }
|
|
26
|
+
static { this.BITGO_COIN = () => Env.get('BITGO_COIN'); }
|
|
23
27
|
static get(key, options) {
|
|
24
28
|
const { fallback, required } = options || {};
|
|
25
29
|
const value = process.env[key]?.trim() || fallback?.trim();
|
package/dist/example-config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example-config.d.ts","sourceRoot":"","sources":["../src/example-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"example-config.d.ts","sourceRoot":"","sources":["../src/example-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAwGqB"}
|
package/dist/example-config.js
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAkGA,QAAA,MAAM,OAAO;;;;;;;CAAiB,CAAA;AAE9B,MAAM,MAAM,UAAU,GAAG,OAAO,OAAO,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { rawConfigSchema } from './config/Config.js';
|
|
|
14
14
|
import exampleConfig from './example-config.js';
|
|
15
15
|
import { GATEWAY_VERSION } from './version.js';
|
|
16
16
|
import { nestedRedact } from './utils.js';
|
|
17
|
+
import { install } from '@logtape/adaptor-pino';
|
|
17
18
|
const program = new Command()
|
|
18
19
|
.name('wallet-gateway')
|
|
19
20
|
.version(GATEWAY_VERSION)
|
|
@@ -68,6 +69,8 @@ const program = new Command()
|
|
|
68
69
|
}
|
|
69
70
|
: {}),
|
|
70
71
|
});
|
|
72
|
+
// install pino loger for logtape
|
|
73
|
+
install(logger);
|
|
71
74
|
// Initialize the database with the provided config
|
|
72
75
|
initialize(opts, logger);
|
|
73
76
|
});
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AA6B7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AA0MvC,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBA+OhE"}
|
package/dist/init.js
CHANGED
|
@@ -13,6 +13,7 @@ import DfnsSigningProvider from '@canton-network/core-signing-dfns';
|
|
|
13
13
|
import FireblocksSigningProvider from '@canton-network/core-signing-fireblocks';
|
|
14
14
|
import BlockdaemonSigningProvider from '@canton-network/core-signing-blockdaemon';
|
|
15
15
|
import SecurosysSigningProvider from '@canton-network/core-signing-securosys';
|
|
16
|
+
import BitGoSigningProvider from '@canton-network/core-signing-bitgo';
|
|
16
17
|
import { jwtAuthService } from './auth/jwt-auth-service.js';
|
|
17
18
|
import express from 'express';
|
|
18
19
|
import { jwtAuth } from './middleware/jwtAuth.js';
|
|
@@ -252,6 +253,20 @@ export async function initialize(opts, logger) {
|
|
|
252
253
|
else {
|
|
253
254
|
logger.warn('Dfns env vars not fully set — Dfns signing provider will be unavailable');
|
|
254
255
|
}
|
|
256
|
+
if (Env.BITGO_ACCESS_TOKEN()) {
|
|
257
|
+
if (!Env.BITGO_ENTERPRISE_ID()) {
|
|
258
|
+
logger.warn('BITGO_ENTERPRISE_ID not set — wallet creation (createKey) will fail and restart-safe transaction lookup will be unavailable');
|
|
259
|
+
}
|
|
260
|
+
drivers[SigningProvider.BITGO] = new BitGoSigningProvider({
|
|
261
|
+
accessToken: Env.BITGO_ACCESS_TOKEN(),
|
|
262
|
+
baseUrl: Env.BITGO_API_URL('https://app.bitgo.com'),
|
|
263
|
+
enterpriseId: Env.BITGO_ENTERPRISE_ID(),
|
|
264
|
+
coin: Env.BITGO_COIN(),
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
logger.warn('BITGO_ACCESS_TOKEN not set — BitGo signing provider will be unavailable');
|
|
269
|
+
}
|
|
255
270
|
const allowedPaths = {
|
|
256
271
|
[config.server.dappPath]: ['*'],
|
|
257
272
|
[config.server.userPath]: [
|
|
@@ -268,20 +283,22 @@ export async function initialize(opts, logger) {
|
|
|
268
283
|
const signingWorkerLogger = logger.child({
|
|
269
284
|
component: 'SigningWorker',
|
|
270
285
|
});
|
|
286
|
+
const hashingSchemeVersion = config.hashingScheme?.version ?? 'HASHING_SCHEME_VERSION_V3';
|
|
271
287
|
signingWorker = new SigningWorker({
|
|
272
288
|
intervalMs: config.server.signingWorker.pollInterval,
|
|
273
289
|
signingDrivers: drivers,
|
|
274
290
|
store,
|
|
275
291
|
notificationService,
|
|
276
292
|
logger: signingWorkerLogger,
|
|
293
|
+
hashingSchemeVersion,
|
|
277
294
|
});
|
|
278
295
|
signingWorker.start();
|
|
279
296
|
// register dapp API handlers
|
|
280
297
|
dapp(config.server.dappPath, app, logger, server, kernelInfo, dappApiUrl, publicUrl, config.server, notificationService, store, {
|
|
281
298
|
signingDrivers: drivers,
|
|
282
|
-
});
|
|
299
|
+
}, hashingSchemeVersion);
|
|
283
300
|
// register user API handlers
|
|
284
|
-
user(config.server.userPath, app, logger, kernelInfo, publicUrl, notificationService, drivers, store, config.server.admin);
|
|
301
|
+
user(config.server.userPath, app, logger, kernelInfo, publicUrl, notificationService, drivers, store, hashingSchemeVersion, config.server.admin);
|
|
285
302
|
// register web handler
|
|
286
303
|
web(app, server, userApiUrl, dappApiUrl);
|
|
287
304
|
isReady = true;
|
|
@@ -36,7 +36,7 @@ export declare class PartyAllocationService {
|
|
|
36
36
|
allocateParty(userId: string, hint: string, publicKey: string, signingCallback: SigningCbFn): Promise<AllocatedParty>;
|
|
37
37
|
/**
|
|
38
38
|
* Create fingerprint
|
|
39
|
-
* @param publicKey The public key of the user.
|
|
39
|
+
* @param publicKey The public key of the user (in base64 format).
|
|
40
40
|
*/
|
|
41
41
|
createFingerprintFromKey(publicKey: string): string;
|
|
42
42
|
/**
|