@canton-network/wallet-gateway-remote 0.11.3 → 0.13.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.js +1 -1
- package/dist/auth/jwt-unsafe-auth-service.js +1 -1
- package/dist/config/Config.d.ts +6 -4
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.js +29 -7
- package/dist/config/Config.test.js +1 -1
- package/dist/config/ConfigUtils.d.ts +9 -5
- package/dist/config/ConfigUtils.d.ts.map +1 -1
- package/dist/config/ConfigUtils.js +11 -9
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +1 -2
- package/dist/dapp-api/rpc-gen/index.js +1 -1
- package/dist/dapp-api/rpc-gen/typings.js +1 -1
- package/dist/dapp-api/server.js +1 -1
- package/dist/dapp-api/server.test.js +4 -4
- package/dist/example-config.d.ts +0 -2
- package/dist/example-config.d.ts.map +1 -1
- package/dist/example-config.js +1 -3
- package/dist/index.js +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +20 -33
- package/dist/ledger/party-allocation-service.js +1 -1
- package/dist/ledger/party-allocation-service.test.js +1 -1
- package/dist/ledger/wallet-sync-service.js +1 -1
- package/dist/ledger/wallet-sync-service.test.js +1 -1
- package/dist/middleware/jsonRpcHandler.js +1 -1
- package/dist/middleware/jwtAuth.d.ts.map +1 -1
- package/dist/middleware/jwtAuth.js +1 -2
- package/dist/middleware/rateLimit.js +1 -1
- package/dist/middleware/sessionHandler.d.ts.map +1 -1
- package/dist/middleware/sessionHandler.js +1 -2
- package/dist/notification/NotificationService.d.ts.map +1 -1
- package/dist/notification/NotificationService.js +1 -1
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +130 -5
- package/dist/user-api/rpc-gen/index.js +1 -1
- package/dist/user-api/rpc-gen/typings.js +1 -1
- package/dist/user-api/server.js +1 -1
- package/dist/user-api/server.test.js +4 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -2
- package/dist/version.js +1 -1
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/approve/index.html +3 -3
- package/dist/web/frontend/assets/{404-DOEElx02.js → 404-KW2rktHv.js} +1 -1
- package/dist/web/frontend/assets/{approve-D15QJVvX.js → approve-GI8lkQ67.js} +1 -1
- package/dist/web/frontend/assets/callback-CiI5c-jK.js +1 -0
- package/dist/web/frontend/assets/index-Beqy7PIH.js +1011 -0
- package/dist/web/frontend/assets/login-OllsdROi.js +186 -0
- package/dist/web/frontend/assets/{settings-DgcggvCV.js → settings-BSmtobKY.js} +1 -1
- package/dist/web/frontend/assets/{state-DcvVyWZr.js → state-Beq2Oijy.js} +1 -1
- package/dist/web/frontend/assets/{transactions-C-931My3.js → transactions-unooQfO1.js} +1 -1
- package/dist/web/frontend/assets/{wallets-Cf2MBnzs.js → wallets-C43SSsO8.js} +2 -2
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/index.html +1 -1
- package/dist/web/frontend/login/index.html +3 -3
- package/dist/web/frontend/settings/index.html +3 -3
- package/dist/web/frontend/transactions/index.html +3 -3
- package/dist/web/frontend/wallets/index.html +3 -3
- package/dist/web/server.js +1 -1
- package/package.json +18 -17
- package/dist/web/frontend/assets/callback-D0wYdJFr.js +0 -1
- package/dist/web/frontend/assets/index-EdAN1_qe.js +0 -1011
- package/dist/web/frontend/assets/login-CqVgGYZA.js +0 -186
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { createRemoteJWKSet, decodeJwt, jwtVerify } from 'jose';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { decodeJwt } from 'jose';
|
|
4
4
|
/**
|
package/dist/config/Config.d.ts
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const kernelInfoSchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
4
5
|
clientType: z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"desktop">, z.ZodLiteral<"mobile">, z.ZodLiteral<"remote">]>;
|
|
5
6
|
}, z.core.$strip>;
|
|
6
7
|
export declare const serverConfigSchema: z.ZodObject<{
|
|
7
|
-
host: z.ZodDefault<z.ZodString>;
|
|
8
8
|
port: z.ZodDefault<z.ZodNumber>;
|
|
9
|
-
tls: z.ZodDefault<z.ZodBoolean>;
|
|
10
9
|
dappPath: z.ZodDefault<z.ZodString>;
|
|
11
10
|
userPath: z.ZodDefault<z.ZodString>;
|
|
12
11
|
allowedOrigins: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
|
|
12
|
+
host: z.ZodOptional<z.ZodString>;
|
|
13
|
+
tls: z.ZodOptional<z.ZodBoolean>;
|
|
13
14
|
}, z.core.$strip>;
|
|
14
15
|
export declare const configSchema: z.ZodObject<{
|
|
15
16
|
kernel: z.ZodObject<{
|
|
16
17
|
id: z.ZodString;
|
|
18
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
17
19
|
clientType: z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"desktop">, z.ZodLiteral<"mobile">, z.ZodLiteral<"remote">]>;
|
|
18
20
|
}, z.core.$strip>;
|
|
19
21
|
server: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodObject<{
|
|
20
|
-
host: z.ZodDefault<z.ZodString>;
|
|
21
22
|
port: z.ZodDefault<z.ZodNumber>;
|
|
22
|
-
tls: z.ZodDefault<z.ZodBoolean>;
|
|
23
23
|
dappPath: z.ZodDefault<z.ZodString>;
|
|
24
24
|
userPath: z.ZodDefault<z.ZodString>;
|
|
25
25
|
allowedOrigins: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
|
|
26
|
+
host: z.ZodOptional<z.ZodString>;
|
|
27
|
+
tls: z.ZodOptional<z.ZodBoolean>;
|
|
26
28
|
}, z.core.$strip>>;
|
|
27
29
|
store: z.ZodObject<{
|
|
28
30
|
connection: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,gBAAgB;;;;iBAY3B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;iBA+B7B,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKvB,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,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
package/dist/config/Config.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { storeConfigSchema } from '@canton-network/core-wallet-store';
|
|
4
4
|
import { storeConfigSchema as signingStoreConfigSchema } from '@canton-network/core-signing-store-sql';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
export const kernelInfoSchema = z.object({
|
|
7
7
|
id: z.string(),
|
|
8
|
+
publicUrl: z.string().optional().meta({
|
|
9
|
+
description: 'The public base URL of the gateway, if available (e.g. https://wallet.example.com). This determines what browsers will try to use to connect, and is useful when using reverse proxies. If omitted, this will be derived from the server configuration.',
|
|
10
|
+
}),
|
|
8
11
|
clientType: z.union([
|
|
9
12
|
z.literal('browser'),
|
|
10
13
|
z.literal('desktop'),
|
|
@@ -13,12 +16,31 @@ export const kernelInfoSchema = z.object({
|
|
|
13
16
|
]),
|
|
14
17
|
});
|
|
15
18
|
export const serverConfigSchema = z.object({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
dappPath: z.string().default('/api/v0/dapp')
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
port: z.number().default(3030).meta({
|
|
20
|
+
description: 'The port on which the NodeJS service will listen. Defaults to 3030.',
|
|
21
|
+
}),
|
|
22
|
+
dappPath: z.string().default('/api/v0/dapp').meta({
|
|
23
|
+
description: 'The path serving the dapp API. Defaults /api/v0/dapp',
|
|
24
|
+
}),
|
|
25
|
+
userPath: z.string().default('/api/v0/user').meta({
|
|
26
|
+
description: 'The path serving the user API. Defaults /api/v0/user',
|
|
27
|
+
}),
|
|
28
|
+
allowedOrigins: z
|
|
29
|
+
.union([z.literal('*'), z.array(z.string())])
|
|
30
|
+
.default('*')
|
|
31
|
+
.meta({
|
|
32
|
+
description: 'Allowed CORS origins, typically corresponding to which external dApps are allowed to connect. Use "*" to allow all origins, or set an array of origin strings.',
|
|
33
|
+
}),
|
|
34
|
+
// @deprecated, the NodeJS server always binds to the localhost interface
|
|
35
|
+
host: z.string().optional().meta({
|
|
36
|
+
deprecated: true,
|
|
37
|
+
description: 'The host interface the server binds to. Deprecated as the service always binds to the local machine network interface. Will be removed in a future release.',
|
|
38
|
+
}),
|
|
39
|
+
// @deprecated since this field does not actually control TLS termination
|
|
40
|
+
tls: z.boolean().optional().meta({
|
|
41
|
+
deprecated: true,
|
|
42
|
+
description: 'Deprecated, this option no longer has any effect. Will be removed in a future release.',
|
|
43
|
+
}),
|
|
22
44
|
});
|
|
23
45
|
export const configSchema = z.object({
|
|
24
46
|
kernel: kernelInfoSchema,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { expect, test } from '@jest/globals';
|
|
4
4
|
import { ConfigUtils } from './ConfigUtils.js';
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { Config
|
|
1
|
+
import { Config } from './Config.js';
|
|
2
2
|
export declare class ConfigUtils {
|
|
3
3
|
static loadConfigFile(filePath: string): Config;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
interface Urls {
|
|
6
|
+
serviceUrl: string;
|
|
7
|
+
publicUrl: string;
|
|
8
|
+
dappApiUrl: string;
|
|
9
|
+
userApiUrl: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const deriveUrls: (config: Config, port?: number) => Urls;
|
|
12
|
+
export {};
|
|
9
13
|
//# sourceMappingURL=ConfigUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigUtils.d.ts","sourceRoot":"","sources":["../../src/config/ConfigUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAgB,
|
|
1
|
+
{"version":3,"file":"ConfigUtils.d.ts","sourceRoot":"","sources":["../../src/config/ConfigUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAA;AAElD,qBAAa,WAAW;IACpB,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAoDlD;AAgDD,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { readFileSync, existsSync } from 'fs';
|
|
4
4
|
import { configSchema } from './Config.js';
|
|
@@ -70,12 +70,14 @@ function validateNetworkAuthMethods(config) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
73
|
+
// Strips duplicate slashes from a URL, except for the protocol part (e.g., "http://")
|
|
74
|
+
function stripDuplicateSlashes(path) {
|
|
75
|
+
return path.replace(/(https?:\/\/)|(\/)+/g, '$1$2');
|
|
76
|
+
}
|
|
77
|
+
export const deriveUrls = (config, port) => {
|
|
78
|
+
const serviceUrl = `http://localhost:${port || config.server.port}`;
|
|
79
|
+
const publicUrl = config.kernel.publicUrl || serviceUrl;
|
|
80
|
+
const dappApiUrl = stripDuplicateSlashes(`${publicUrl}/${config.server.dappPath}`);
|
|
81
|
+
const userApiUrl = stripDuplicateSlashes(`${publicUrl}/${config.server.userPath}`);
|
|
82
|
+
return { dappApiUrl, userApiUrl, publicUrl, serviceUrl };
|
|
81
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAS/E,OAAO,EAAE,KAAK,EAAe,MAAM,mCAAmC,CAAA;AAQtE,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;AAG7B,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,UAAU,WAAW;;;;;;;;;;;;;CAuOxB,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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
|
-
// Disabled unused vars rule to allow for future implementations
|
|
4
3
|
import { assertConnected } from '@canton-network/core-wallet-auth';
|
|
5
4
|
import buildController from './rpc-gen/index.js';
|
|
6
5
|
import { LedgerClient, } from '@canton-network/core-ledger-client';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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
|
function buildController(methods) {
|
|
4
4
|
return {
|
package/dist/dapp-api/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 cors from 'cors';
|
|
4
4
|
import { dappController } from './controller.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { expect, test } from '@jest/globals';
|
|
4
4
|
import cors from 'cors';
|
|
@@ -6,7 +6,7 @@ import request from 'supertest';
|
|
|
6
6
|
import express from 'express';
|
|
7
7
|
import { dapp } from './server.js';
|
|
8
8
|
import { StoreInternal } from '@canton-network/core-wallet-store-inmemory';
|
|
9
|
-
import { ConfigUtils,
|
|
9
|
+
import { ConfigUtils, deriveUrls } from '../config/ConfigUtils.js';
|
|
10
10
|
import { NotificationService } from '../notification/NotificationService.js';
|
|
11
11
|
import { pino } from 'pino';
|
|
12
12
|
import { sink } from 'pino-test';
|
|
@@ -25,8 +25,8 @@ test('call connect rpc', async () => {
|
|
|
25
25
|
app.use(cors());
|
|
26
26
|
app.use(express.json());
|
|
27
27
|
const server = createServer(app);
|
|
28
|
-
const {
|
|
29
|
-
const response = await request(dapp('/api/v0/dapp', app, pino(sink()), server, config.kernel,
|
|
28
|
+
const { dappApiUrl, publicUrl } = deriveUrls(config);
|
|
29
|
+
const response = await request(dapp('/api/v0/dapp', app, pino(sink()), server, config.kernel, dappApiUrl, publicUrl, config.server, notificationService, authService, store))
|
|
30
30
|
.post('/api/v0/dapp')
|
|
31
31
|
.send({ jsonrpc: '2.0', id: 0, method: 'connect', params: [] })
|
|
32
32
|
.set('Accept', 'application/json');
|
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,wBAwFkB"}
|
package/dist/example-config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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
|
export default {
|
|
4
4
|
kernel: {
|
|
@@ -6,9 +6,7 @@ export default {
|
|
|
6
6
|
clientType: 'remote',
|
|
7
7
|
},
|
|
8
8
|
server: {
|
|
9
|
-
host: 'localhost',
|
|
10
9
|
port: 3030,
|
|
11
|
-
tls: false,
|
|
12
10
|
dappPath: '/api/v0/dapp',
|
|
13
11
|
userPath: '/api/v0/user',
|
|
14
12
|
allowedOrigins: '*',
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import { Option, Command } from '@commander-js/extra-typings';
|
|
5
5
|
import { initialize } from './init.js';
|
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;AAqB7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAmFvC,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBA8HhE"}
|
package/dist/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { dapp } from './dapp-api/server.js';
|
|
4
4
|
import { user } from './user-api/server.js';
|
|
@@ -10,11 +10,12 @@ import { SigningProvider } from '@canton-network/core-signing-lib';
|
|
|
10
10
|
import { ParticipantSigningDriver } from '@canton-network/core-signing-participant';
|
|
11
11
|
import { InternalSigningDriver } from '@canton-network/core-signing-internal';
|
|
12
12
|
import FireblocksSigningProvider from '@canton-network/core-signing-fireblocks';
|
|
13
|
+
import BlockdaemonSigningProvider from '@canton-network/core-signing-blockdaemon';
|
|
13
14
|
import { jwtAuthService } from './auth/jwt-auth-service.js';
|
|
14
15
|
import express from 'express';
|
|
15
16
|
import { jwtAuth } from './middleware/jwtAuth.js';
|
|
16
17
|
import { rpcRateLimit } from './middleware/rateLimit.js';
|
|
17
|
-
import {
|
|
18
|
+
import { deriveUrls } from './config/ConfigUtils.js';
|
|
18
19
|
import { existsSync, readFileSync } from 'fs';
|
|
19
20
|
import path from 'path';
|
|
20
21
|
import { GATEWAY_VERSION } from './version.js';
|
|
@@ -73,19 +74,11 @@ export async function initialize(opts, logger) {
|
|
|
73
74
|
const config = ConfigUtils.loadConfigFile(opts.config);
|
|
74
75
|
// Use CLI port override or config port
|
|
75
76
|
const port = opts.port ? Number(opts.port) : config.server.port;
|
|
76
|
-
const
|
|
77
|
-
const protocol = config.server.tls ? 'https' : 'http';
|
|
77
|
+
const { serviceUrl, publicUrl, dappApiUrl, userApiUrl } = deriveUrls(config, port);
|
|
78
78
|
const app = express();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const server = useDefaultListenHost
|
|
83
|
-
? app.listen(port, () => {
|
|
84
|
-
logger.info(`Remote Wallet Gateway starting on ${protocol}://${host}:${port} (bound to 0.0.0.0:${port})`);
|
|
85
|
-
})
|
|
86
|
-
: app.listen(port, host, () => {
|
|
87
|
-
logger.info(`Remote Wallet Gateway starting on ${protocol}://${host}:${port}`);
|
|
88
|
-
});
|
|
79
|
+
const server = app.listen(port, () => {
|
|
80
|
+
logger.info(`Remote Wallet Gateway starting on ${serviceUrl})`);
|
|
81
|
+
});
|
|
89
82
|
app.use('/healthz', rpcRateLimit, (_req, res) => res.status(200).send('OK'));
|
|
90
83
|
app.use('/readyz', rpcRateLimit, (_req, res) => {
|
|
91
84
|
if (isReady) {
|
|
@@ -115,6 +108,9 @@ export async function initialize(opts, logger) {
|
|
|
115
108
|
}
|
|
116
109
|
const keyInfo = { apiKey, apiSecret };
|
|
117
110
|
const userApiKeys = new Map([['user', keyInfo]]);
|
|
111
|
+
const blockdaemonApiUrl = process.env.BLOCKDAEMON_API_URL ||
|
|
112
|
+
'http://localhost:5080/api/cwp/canton';
|
|
113
|
+
const blockdaemonApiKey = process.env.BLOCKDAEMON_API_KEY || '';
|
|
118
114
|
const drivers = {
|
|
119
115
|
[SigningProvider.PARTICIPANT]: new ParticipantSigningDriver(),
|
|
120
116
|
[SigningProvider.WALLET_KERNEL]: new InternalSigningDriver(signingStore),
|
|
@@ -122,6 +118,10 @@ export async function initialize(opts, logger) {
|
|
|
122
118
|
defaultKeyInfo: keyInfo,
|
|
123
119
|
userApiKeys,
|
|
124
120
|
}),
|
|
121
|
+
[SigningProvider.BLOCKDAEMON]: new BlockdaemonSigningProvider({
|
|
122
|
+
baseUrl: blockdaemonApiUrl,
|
|
123
|
+
apiKey: blockdaemonApiKey,
|
|
124
|
+
}),
|
|
125
125
|
};
|
|
126
126
|
const allowedPaths = {
|
|
127
127
|
[config.server.dappPath]: ['*'],
|
|
@@ -130,29 +130,16 @@ export async function initialize(opts, logger) {
|
|
|
130
130
|
app.use('/api/*splat', express.json());
|
|
131
131
|
app.use('/api/*splat', rpcRateLimit);
|
|
132
132
|
app.use('/api/*splat', jwtAuth(authService, logger.child({ component: 'JwtHandler' })), sessionHandler(store, allowedPaths, logger.child({ component: 'SessionHandler' })));
|
|
133
|
-
|
|
134
|
-
const serverConfigWithOverride = {
|
|
135
|
-
...config.server,
|
|
136
|
-
port, // Use the actual port we're listening on
|
|
137
|
-
};
|
|
138
|
-
const { dappUrl, userUrl } = deriveKernelUrls(serverConfigWithOverride);
|
|
139
|
-
logger.info({
|
|
140
|
-
host: serverConfigWithOverride.host,
|
|
141
|
-
port: serverConfigWithOverride.port,
|
|
142
|
-
tls: serverConfigWithOverride.tls,
|
|
143
|
-
dappPath: serverConfigWithOverride.dappPath,
|
|
144
|
-
userPath: serverConfigWithOverride.userPath,
|
|
145
|
-
allowedOrigins: serverConfigWithOverride.allowedOrigins,
|
|
146
|
-
dappUrl,
|
|
147
|
-
userUrl,
|
|
148
|
-
}, 'Server configuration');
|
|
133
|
+
logger.info({ ...config.server, port }, 'Server configuration');
|
|
149
134
|
const kernelInfo = config.kernel;
|
|
150
135
|
// register dapp API handlers
|
|
151
|
-
dapp(config.server.dappPath, app, logger, server, kernelInfo,
|
|
136
|
+
dapp(config.server.dappPath, app, logger, server, kernelInfo, dappApiUrl, publicUrl, config.server, notificationService, authService, store);
|
|
152
137
|
// register user API handlers
|
|
153
|
-
user(config.server.userPath, app, logger, kernelInfo,
|
|
138
|
+
user(config.server.userPath, app, logger, kernelInfo, publicUrl, notificationService, drivers, store);
|
|
154
139
|
// register web handler
|
|
155
|
-
web(app, server,
|
|
140
|
+
web(app, server, userApiUrl);
|
|
156
141
|
isReady = true;
|
|
157
142
|
logger.info(`Wallet Gateway (version: ${GATEWAY_VERSION}) initialization complete`);
|
|
143
|
+
logger.info(`Wallet Gateway UI available on ${publicUrl}`);
|
|
144
|
+
logger.info(`dApp API available on ${dappApiUrl}`);
|
|
158
145
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { LedgerClient, } from '@canton-network/core-ledger-client';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { jest } from '@jest/globals';
|
|
4
4
|
import { pino } from 'pino';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { defaultRetryableOptions, } from '@canton-network/core-ledger-client';
|
|
4
4
|
import { SigningProvider, } from '@canton-network/core-signing-lib';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { jest, describe, it, expect, beforeEach, afterEach, } from '@jest/globals';
|
|
4
4
|
import { pino } from 'pino';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 { JsonRpcError, rpcErrors, toHttpErrorCode, } from '@canton-network/core-rpc-errors';
|
|
4
4
|
import { ErrorResponse, JsonRpcRequest, jsonRpcResponse, } from '@canton-network/core-types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwtAuth.d.ts","sourceRoot":"","sources":["../../src/middleware/jwtAuth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwtAuth.d.ts","sourceRoot":"","sources":["../../src/middleware/jwtAuth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAE7B,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAC9C,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,mBAehE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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
|
-
// middleware/jwtAuth.ts
|
|
4
3
|
export function jwtAuth(authService, logger) {
|
|
5
4
|
return async (req, res, next) => {
|
|
6
5
|
const authHeader = req.headers.authorization;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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 rateLimit from 'express-rate-limit';
|
|
4
4
|
export const rpcRateLimit = rateLimit({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionHandler.d.ts","sourceRoot":"","sources":["../../src/middleware/sessionHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sessionHandler.d.ts","sourceRoot":"","sources":["../../src/middleware/sessionHandler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AAEzD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC1B,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,EAC/B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACtC,MAAM,EAAE,MAAM,IAEA,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,mBA6BhE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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
|
-
// middleware/jwtAuth.ts
|
|
4
3
|
/**
|
|
5
4
|
* Middleware to handle session validation based on user sessions.
|
|
6
5
|
* @param store needs to be AuthAware
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/notification/NotificationService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/notification/NotificationService.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAE7B,KAAK,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AACjD,MAAM,WAAW,QAAQ;IACrB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAA;IAEhD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;IAEhD,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,GAAG,IAAI,CAAA;CACvE;AAED,UAAU,oBAAoB;IAC1B,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAA;CAC5C;AAED,qBAAa,mBAAoB,YAAW,oBAAoB;IAGhD,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,SAAS,CAAmC;gBAEhC,MAAM,EAAE,MAAM;IAElC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ;CAoB5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
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
|
// TODO: make events type-of dApp methods (perhaps just )
|
|
4
4
|
// Support event-driven notifications. We represent a notifier with a generic interface to support node and browser implementations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/user-api/controller.ts"],"names":[],"mappings":"AAyBA,OAAO,EACH,KAAK,EAIR,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAGH,WAAW,EAId,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EACH,sBAAsB,EACtB,eAAe,EAClB,MAAM,kCAAkC,CAAA;AAczC,KAAK,uBAAuB,GAAG,OAAO,CAClC,MAAM,CAAC,eAAe,EAAE,sBAAsB,CAAC,CAClD,CAAA;AAED,eAAO,MAAM,cAAc,GACvB,YAAY,UAAU,EACtB,SAAS,MAAM,EACf,OAAO,KAAK,EACZ,qBAAqB,mBAAmB,EACxC,aAAa,WAAW,GAAG,SAAS,EACpC,SAAS,uBAAuB,EAChC,SAAS,MAAM;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/user-api/controller.ts"],"names":[],"mappings":"AAyBA,OAAO,EACH,KAAK,EAIR,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAGH,WAAW,EAId,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EACH,sBAAsB,EACtB,eAAe,EAClB,MAAM,kCAAkC,CAAA;AAczC,KAAK,uBAAuB,GAAG,OAAO,CAClC,MAAM,CAAC,eAAe,EAAE,sBAAsB,CAAC,CAClD,CAAA;AAED,eAAO,MAAM,cAAc,GACvB,YAAY,UAAU,EACtB,SAAS,MAAM,EACf,OAAO,KAAK,EACZ,qBAAqB,mBAAmB,EACxC,aAAa,WAAW,GAAG,SAAS,EACpC,SAAS,uBAAuB,EAChC,SAAS,MAAM;;;;;;;;;;;;;;;;;;;CAu3BlB,CAAA"}
|