@canton-network/wallet-gateway-remote 1.11.3 → 1.12.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.d.ts +5 -4
- package/dist/auth/jwt-auth-service.d.ts.map +1 -1
- package/dist/auth/jwt-auth-service.js +76 -8
- package/dist/auth/jwt-auth-service.test.js +193 -0
- package/dist/config/Config.d.ts +58 -7
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.test.js +9 -2
- package/dist/config/ConfigUtils.d.ts +1 -1
- package/dist/config/ConfigUtils.d.ts.map +1 -1
- package/dist/config/ConfigUtils.js +43 -8
- package/dist/dapp-api/controller.d.ts +5 -7
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +31 -21
- package/dist/dapp-api/controller.test.js +12 -16
- package/dist/dapp-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/dapp-api/rpc-gen/schemas.d.ts +3 -0
- package/dist/dapp-api/rpc-gen/schemas.d.ts.map +1 -0
- package/dist/dapp-api/rpc-gen/schemas.js +201 -0
- package/dist/dapp-api/rpc-gen/typings.d.ts +8 -1
- package/dist/dapp-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/dapp-api/server.d.ts +8 -9
- package/dist/dapp-api/server.d.ts.map +1 -1
- package/dist/dapp-api/server.js +7 -43
- package/dist/dapp-api/server.test.js +41 -2
- package/dist/dapp-api/sse-sink.d.ts +18 -0
- package/dist/dapp-api/sse-sink.d.ts.map +1 -0
- package/dist/dapp-api/sse-sink.js +27 -0
- package/dist/dapp-api/sse-sink.test.d.ts +2 -0
- package/dist/dapp-api/sse-sink.test.d.ts.map +1 -0
- package/dist/dapp-api/sse-sink.test.js +30 -0
- package/dist/env.d.ts +0 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/init.d.ts +2 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +13 -4
- package/dist/ledger/party-allocation-service.d.ts +3 -3
- package/dist/ledger/party-allocation-service.d.ts.map +1 -1
- package/dist/ledger/self-issued-auth-service.d.ts +50 -0
- package/dist/ledger/self-issued-auth-service.d.ts.map +1 -0
- package/dist/ledger/self-issued-auth-service.js +263 -0
- package/dist/ledger/self-issued-auth-service.test.d.ts +2 -0
- package/dist/ledger/self-issued-auth-service.test.d.ts.map +1 -0
- package/dist/ledger/self-issued-auth-service.test.js +454 -0
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.d.ts +7 -7
- package/dist/ledger/wallet-allocation/signing-providers/bitgo-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/blockdaemon-wallet-allocator.d.ts +7 -7
- 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 +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.d.ts +7 -7
- 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 +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/fireblocks-wallet-allocator.d.ts +7 -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 +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/kernel-wallet-allocator.d.ts +7 -7
- 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 +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.d.ts +6 -6
- package/dist/ledger/wallet-allocation/signing-providers/participant-wallet-allocator.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/signing-providers/securosys-wallet-allocator.d.ts +7 -7
- 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 +1 -1
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts +6 -6
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts.map +1 -1
- package/dist/ledger/wallet-sync-service.d.ts +12 -9
- package/dist/ledger/wallet-sync-service.d.ts.map +1 -1
- package/dist/ledger/wallet-sync-service.js +49 -15
- package/dist/ledger/wallet-sync-service.test.js +171 -11
- package/dist/middleware/apiKeyAuth.d.ts +3 -3
- package/dist/middleware/apiKeyAuth.d.ts.map +1 -1
- package/dist/middleware/apiKeyAuth.js +2 -2
- package/dist/middleware/errorHandler.d.ts +7 -1
- package/dist/middleware/errorHandler.d.ts.map +1 -1
- package/dist/middleware/errorHandler.js +85 -1
- package/dist/middleware/errorHandler.test.js +39 -1
- package/dist/middleware/jsonRpcHandler.d.ts +6 -4
- package/dist/middleware/jsonRpcHandler.d.ts.map +1 -1
- package/dist/middleware/jsonRpcHandler.js +46 -7
- package/dist/middleware/jsonRpcHandler.test.js +101 -1
- package/dist/middleware/jwtAuth.d.ts +2 -2
- package/dist/middleware/jwtAuth.d.ts.map +1 -1
- package/dist/middleware/sessionHandler.d.ts +6 -4
- package/dist/middleware/sessionHandler.d.ts.map +1 -1
- package/dist/middleware/sessionHandler.js +25 -1
- package/dist/middleware/sessionHandler.test.js +61 -1
- package/dist/signing/service-account-session.d.ts +3 -3
- package/dist/signing/service-account-session.d.ts.map +1 -1
- package/dist/signing/service-account-session.js +2 -2
- package/dist/signing/service-account-session.test.js +1 -2
- package/dist/signing/signing-worker.d.ts +18 -16
- package/dist/signing/signing-worker.d.ts.map +1 -1
- package/dist/signing/signing-worker.js +18 -12
- package/dist/signing/signing-worker.test.js +10 -7
- package/dist/user-api/controller.d.ts +11 -7
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +249 -86
- package/dist/user-api/controller.test.js +145 -17
- package/dist/user-api/rpc-gen/index.d.ts +18 -0
- package/dist/user-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/user-api/rpc-gen/index.js +6 -0
- package/dist/user-api/rpc-gen/schemas.d.ts +3 -0
- package/dist/user-api/rpc-gen/schemas.d.ts.map +1 -0
- package/dist/user-api/rpc-gen/schemas.js +1035 -0
- package/dist/user-api/rpc-gen/typings.d.ts +202 -28
- package/dist/user-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/user-api/server.d.ts +7 -8
- package/dist/user-api/server.d.ts.map +1 -1
- package/dist/user-api/server.js +2 -0
- package/dist/user-api/server.test.js +3 -2
- package/dist/user-api/token-network-matching.d.ts +2 -2
- package/dist/user-api/token-network-matching.d.ts.map +1 -1
- package/dist/user-api/token-network-matching.js +9 -7
- package/dist/utils.d.ts +0 -29
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -57
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -5
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/activities/index.html +3 -3
- package/dist/web/frontend/api-keys/add/index.html +2 -2
- package/dist/web/frontend/api-keys/index.html +2 -2
- package/dist/web/frontend/approve/index.html +3 -3
- package/dist/web/frontend/assets/404-B1XXXMXN.js +5 -0
- package/dist/web/frontend/assets/{activities-DSP_NZCE.js → activities-HZnPjlMp.js} +2 -2
- package/dist/web/frontend/assets/{addApiKey-Zv2CS3ub.js → addApiKey-BvkCtUF3.js} +3 -3
- package/dist/web/frontend/assets/addIdentityProvider-Dvjma837.js +28 -0
- package/dist/web/frontend/assets/{addNetwork-B620CvC-.js → addNetwork-Cahac0uo.js} +2 -2
- package/dist/web/frontend/assets/addParty-Cdoed_Yx.js +13 -0
- package/dist/web/frontend/assets/{apiKeys-ohQpjexi.js → apiKeys-BwV6ylWL.js} +3 -3
- package/dist/web/frontend/assets/approve-B0nIfe2y.js +26 -0
- package/dist/web/frontend/assets/callback-BieW5Ux2.js +7 -0
- package/dist/web/frontend/assets/{common-BCDg7K0r.js → common-Bv9twGrA.js} +2 -2
- package/dist/web/frontend/assets/editParty-OOjTHFay.js +14 -0
- package/dist/web/frontend/assets/{identityProviders-C26I4FyE.js → identityProviders-BxJAq1Ne.js} +2 -2
- package/dist/web/frontend/assets/index-Bo6MnlYI.js +2 -0
- package/dist/web/frontend/assets/index-CG_aFABR.js +1 -0
- package/dist/web/frontend/assets/index-D1Brmwbg.js +93 -0
- package/dist/web/frontend/assets/index-pMOoiNFq.js +4887 -0
- package/dist/web/frontend/assets/login-BHxgJEz_.js +11 -0
- package/dist/web/frontend/assets/{networks-CtFnklqS.js → networks-CBprjUF5.js} +3 -3
- package/dist/web/frontend/assets/onboarding-ChmWs-TC.js +84 -0
- package/dist/web/frontend/assets/reviewIdentityProvider-CCmKgN8N.js +43 -0
- package/dist/web/frontend/assets/reviewNetwork-CX8Bmuf3.js +43 -0
- package/dist/web/frontend/assets/signMessage-BN_6S5FV.js +79 -0
- 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/onboarding/index.html +23 -0
- package/dist/web/frontend/parties/add/index.html +5 -4
- package/dist/web/frontend/parties/edit/index.html +5 -4
- package/dist/web/frontend/parties/index.html +3 -2
- package/dist/web/frontend/sign-message/index.html +2 -2
- package/dist/web/route-inputs.js +1 -1
- package/dist/web/server.d.ts +1 -1
- package/dist/web/server.d.ts.map +1 -1
- package/package.json +36 -30
- package/dist/ledger/transaction-service.d.ts +0 -27
- package/dist/ledger/transaction-service.d.ts.map +0 -1
- package/dist/ledger/transaction-service.js +0 -297
- package/dist/ledger/transaction-service.test.d.ts +0 -2
- package/dist/ledger/transaction-service.test.d.ts.map +0 -1
- package/dist/ledger/transaction-service.test.js +0 -551
- package/dist/notification/NotificationService.d.ts +0 -18
- package/dist/notification/NotificationService.d.ts.map +0 -1
- package/dist/notification/NotificationService.js +0 -26
- package/dist/notification/NotificationService.test.d.ts +0 -2
- package/dist/notification/NotificationService.test.d.ts.map +0 -1
- package/dist/notification/NotificationService.test.js +0 -110
- package/dist/signing/signing-drivers.d.ts +0 -7
- package/dist/signing/signing-drivers.d.ts.map +0 -1
- package/dist/signing/signing-drivers.js +0 -3
- package/dist/web/frontend/assets/404-Ds_FbOi_.js +0 -5
- package/dist/web/frontend/assets/addIdentityProvider-BqiC9u9A.js +0 -28
- package/dist/web/frontend/assets/addParty-CSMZt930.js +0 -13
- package/dist/web/frontend/assets/approve-D5YmfGHz.js +0 -21
- package/dist/web/frontend/assets/callback-Dk9tIdBj.js +0 -7
- package/dist/web/frontend/assets/editParty-DX9X91dp.js +0 -14
- package/dist/web/frontend/assets/index-BCECRB_Y.js +0 -4943
- package/dist/web/frontend/assets/index-Cvcr2Fng.js +0 -2
- package/dist/web/frontend/assets/index-DrEQVBtC.js +0 -93
- package/dist/web/frontend/assets/login-dmjNaK2x.js +0 -11
- package/dist/web/frontend/assets/reviewIdentityProvider-GBlomu4-.js +0 -43
- package/dist/web/frontend/assets/reviewNetwork-CWEgNcCg.js +0 -43
- package/dist/web/frontend/assets/settings-DSh9rqaO.js +0 -37
- package/dist/web/frontend/assets/signMessage-CT2_Y1LA.js +0 -79
- package/dist/web/frontend/settings/index.html +0 -15
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { readFileSync, existsSync } from 'fs';
|
|
4
4
|
import { rawConfigSchema } from './Config.js';
|
|
5
5
|
import { Env } from '../env.js';
|
|
6
|
+
import { resolveAuthIdentityProviderId } from '@canton-network/core-wallet-auth';
|
|
6
7
|
export class ConfigUtils {
|
|
7
8
|
static loadConfigFile(filePath) {
|
|
8
9
|
if (existsSync(filePath)) {
|
|
@@ -14,8 +15,9 @@ export class ConfigUtils {
|
|
|
14
15
|
*
|
|
15
16
|
* 1. IDP IDs are unique
|
|
16
17
|
* 2. Network IDs are unique
|
|
17
|
-
* 3.
|
|
18
|
-
* 4. Each Network's
|
|
18
|
+
* 3. Self-issued network audiences are unique
|
|
19
|
+
* 4. Each Network's identityProviderId maps to an existing IDP (in config)
|
|
20
|
+
* 5. Each Network's auth method is compatible with its IDP type
|
|
19
21
|
*/
|
|
20
22
|
const duplicateIdpId = hasDuplicateElement(config.bootstrap.idps.map((idp) => idp.id));
|
|
21
23
|
if (duplicateIdpId) {
|
|
@@ -25,6 +27,12 @@ export class ConfigUtils {
|
|
|
25
27
|
if (duplicateNetworkId) {
|
|
26
28
|
throw new Error(`Non-unique Network IDs found in config file: ${duplicateNetworkId}`);
|
|
27
29
|
}
|
|
30
|
+
const duplicateSelfIssuedAudience = hasDuplicateElement(config.bootstrap.networks
|
|
31
|
+
.filter((network) => network.auth.method === 'self_issued')
|
|
32
|
+
.map((network) => network.auth.audience));
|
|
33
|
+
if (duplicateSelfIssuedAudience) {
|
|
34
|
+
throw new Error(`Non-unique self-issued audience found in config file: ${duplicateSelfIssuedAudience}`);
|
|
35
|
+
}
|
|
28
36
|
const invalidMapping = validateNetworkToIdpMapping(config);
|
|
29
37
|
if (invalidMapping) {
|
|
30
38
|
throw new Error(`Network ${invalidMapping.networkId} references unknown Identity Provider ID ${invalidMapping.idpId}`);
|
|
@@ -43,7 +51,7 @@ export class ConfigUtils {
|
|
|
43
51
|
// The Wallet Gateway can accept adminAuth secrets from environment variables.
|
|
44
52
|
// However, the store expects strings. This function resolves the config from env vars
|
|
45
53
|
function resolveRawNetworkAuth(n) {
|
|
46
|
-
if (n.method === 'authorization_code') {
|
|
54
|
+
if (n.method === 'authorization_code' || n.method === 'self_issued') {
|
|
47
55
|
return n;
|
|
48
56
|
}
|
|
49
57
|
if ('clientSecret' in n) {
|
|
@@ -114,25 +122,52 @@ function hasDuplicateElement(list) {
|
|
|
114
122
|
}
|
|
115
123
|
function validateNetworkToIdpMapping(config) {
|
|
116
124
|
for (const network of config.bootstrap.networks) {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
const authConfigurations = [
|
|
126
|
+
network.auth,
|
|
127
|
+
network.adminAuth,
|
|
128
|
+
network.serviceAccountAuth,
|
|
129
|
+
].filter((auth) => auth !== undefined);
|
|
130
|
+
const idpIds = new Set([
|
|
131
|
+
network.identityProviderId,
|
|
132
|
+
...authConfigurations.flatMap((auth) => auth.method === 'client_credentials' && auth.identityProviderId
|
|
133
|
+
? [auth.identityProviderId]
|
|
134
|
+
: []),
|
|
135
|
+
]);
|
|
136
|
+
for (const idpId of idpIds) {
|
|
137
|
+
const idp = config.bootstrap.idps.find((idp) => idp.id === idpId);
|
|
138
|
+
if (typeof idp === 'undefined') {
|
|
139
|
+
return { networkId: network.id, idpId };
|
|
140
|
+
}
|
|
120
141
|
}
|
|
121
142
|
}
|
|
122
143
|
}
|
|
123
144
|
const SUPPORTED_IDP_METHODS = {
|
|
124
145
|
self_signed: ['self_signed'],
|
|
146
|
+
self_issued: ['self_issued'],
|
|
125
147
|
oauth: ['authorization_code', 'client_credentials'],
|
|
126
148
|
};
|
|
127
149
|
function validateNetworkAuthMethods(config) {
|
|
128
150
|
for (const network of config.bootstrap.networks) {
|
|
129
|
-
const
|
|
130
|
-
|
|
151
|
+
const networkAuthIdpId = resolveAuthIdentityProviderId(network.auth, network.identityProviderId);
|
|
152
|
+
const networkAuthIdp = config.bootstrap.idps.find((idp) => idp.id === networkAuthIdpId);
|
|
153
|
+
if (!SUPPORTED_IDP_METHODS[networkAuthIdp.type].includes(network.auth.method)) {
|
|
131
154
|
return {
|
|
132
155
|
networkId: network.id,
|
|
133
156
|
invalidAuthMethod: network.auth.method,
|
|
134
157
|
};
|
|
135
158
|
}
|
|
159
|
+
for (const auth of [network.adminAuth, network.serviceAccountAuth]) {
|
|
160
|
+
if (auth?.method === 'client_credentials' &&
|
|
161
|
+
auth.identityProviderId) {
|
|
162
|
+
const idp = config.bootstrap.idps.find((idp) => idp.id === auth.identityProviderId);
|
|
163
|
+
if (idp.type !== 'oauth') {
|
|
164
|
+
return {
|
|
165
|
+
networkId: network.id,
|
|
166
|
+
invalidAuthMethod: auth.method,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
136
171
|
}
|
|
137
172
|
}
|
|
138
173
|
// Strips duplicate slashes from a URL, except for the protocol part (e.g., "http://")
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { AuthContext } from '@canton-network/core-wallet-auth';
|
|
2
|
-
import { Store } from '@canton-network/core-wallet-store';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { SigningDrivers } from '../signing/signing-drivers.js';
|
|
7
|
-
import { HASHING_SCHEME_VERSION } from '../env.js';
|
|
1
|
+
import { type AuthContext } from '@canton-network/core-wallet-auth';
|
|
2
|
+
import type { Store } from '@canton-network/core-wallet-store';
|
|
3
|
+
import type { KernelInfo as KernelInfoConfig } from '../config/Config.js';
|
|
4
|
+
import type { Logger } from 'pino';
|
|
5
|
+
import { type HASHING_SCHEME_VERSION, type NotificationService, type SigningDrivers } from '@canton-network/core-wallet-services';
|
|
8
6
|
export interface DappControllerDeps {
|
|
9
7
|
signingDrivers: SigningDrivers;
|
|
10
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,WAAW,
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/dapp-api/controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,KAAK,WAAW,EAEnB,MAAM,kCAAkC,CAAA;AAczC,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,mCAAmC,CAAA;AAU3E,OAAO,KAAK,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC,OAAO,EAKH,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACtB,MAAM,sCAAsC,CAAA;AAE7C,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;;;;;;;;;;;;;;;;CA6exB,CAAA"}
|
|
@@ -1,12 +1,11 @@
|
|
|
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
|
-
import {
|
|
3
|
+
import { assertIsConnected, AuthTokenProvider, } from '@canton-network/core-wallet-auth';
|
|
4
4
|
import buildController from './rpc-gen/index.js';
|
|
5
5
|
import { LedgerClient, isValidGetEndpoint, isValidPostEndpoint, } from '@canton-network/core-ledger-client';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
|
-
import {
|
|
8
|
-
import { TransactionService } from '
|
|
9
|
-
import { rpcErrors } from '@canton-network/core-rpc-errors';
|
|
7
|
+
import { providerErrors, rpcErrors } from '@canton-network/core-rpc-errors';
|
|
8
|
+
import { networkStatus, TransactionService, ledgerPrepareParams, logDynamically, } from '@canton-network/core-wallet-services';
|
|
10
9
|
export const dappController = (kernelInfo, dappUrl, userUrl, store, notificationService, _logger, origin, deps, hashingSchemeVersion, context) => {
|
|
11
10
|
const logger = _logger.child({ component: 'dapp-controller' });
|
|
12
11
|
function assertActAsPartiesBelongToUser(actAs, wallets) {
|
|
@@ -16,6 +15,15 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
}
|
|
18
|
+
async function getActiveSession(context) {
|
|
19
|
+
const session = await store.getSession(context.accessToken);
|
|
20
|
+
if (!session) {
|
|
21
|
+
throw providerErrors.unauthorized({
|
|
22
|
+
message: 'No active session found',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return session;
|
|
26
|
+
}
|
|
19
27
|
return buildController({
|
|
20
28
|
connect: async () => {
|
|
21
29
|
const session = context && (await store.getSession(context.accessToken));
|
|
@@ -118,11 +126,12 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
118
126
|
};
|
|
119
127
|
},
|
|
120
128
|
ledgerApi: async (params) => {
|
|
129
|
+
assertIsConnected(context);
|
|
121
130
|
const network = await store.getCurrentNetwork();
|
|
122
131
|
const ledgerClient = new LedgerClient({
|
|
123
132
|
baseUrl: new URL(network.ledgerApi.baseUrl),
|
|
124
133
|
logger,
|
|
125
|
-
accessTokenProvider: AuthTokenProvider.fromToken(
|
|
134
|
+
accessTokenProvider: AuthTokenProvider.fromToken(context.accessToken, logger),
|
|
126
135
|
});
|
|
127
136
|
let result;
|
|
128
137
|
switch (params.requestMethod) {
|
|
@@ -144,17 +153,15 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
144
153
|
return result;
|
|
145
154
|
},
|
|
146
155
|
prepareExecute: async (params) => {
|
|
156
|
+
assertIsConnected(context);
|
|
147
157
|
const primaryWallet = await store.getPrimaryWallet();
|
|
148
158
|
const wallets = await store.getWallets();
|
|
149
159
|
const network = await store.getCurrentNetwork();
|
|
150
|
-
if (context === undefined) {
|
|
151
|
-
throw new Error('Unauthenticated context');
|
|
152
|
-
}
|
|
153
160
|
// determine user ID
|
|
154
161
|
const gatewayUserId = context.userId;
|
|
155
162
|
let ledgerUserId = context.userId;
|
|
156
163
|
const accessTokenProvider = AuthTokenProvider.fromToken(context.accessToken, logger);
|
|
157
|
-
if (context
|
|
164
|
+
if (context.isApiKey) {
|
|
158
165
|
logger.info('Authenticated with API Key, fetching m2m token for ledger access');
|
|
159
166
|
ledgerUserId = context.ledgerUserId;
|
|
160
167
|
}
|
|
@@ -177,10 +184,7 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
177
184
|
logger,
|
|
178
185
|
accessTokenProvider,
|
|
179
186
|
});
|
|
180
|
-
const session = await
|
|
181
|
-
if (!session) {
|
|
182
|
-
throw new Error('No active session found');
|
|
183
|
-
}
|
|
187
|
+
const session = await getActiveSession(context);
|
|
184
188
|
const notifier = notificationService.getNotifier(session.id);
|
|
185
189
|
const commandId = params.commandId || v4();
|
|
186
190
|
const transactionId = v4();
|
|
@@ -309,31 +313,30 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
309
313
|
};
|
|
310
314
|
},
|
|
311
315
|
listAccounts: async () => {
|
|
316
|
+
assertIsConnected(context);
|
|
312
317
|
return await store.getWallets();
|
|
313
318
|
},
|
|
314
319
|
getActiveNetwork: async () => {
|
|
320
|
+
assertIsConnected(context);
|
|
315
321
|
const network = await store.getCurrentNetwork();
|
|
316
322
|
return {
|
|
317
323
|
networkId: network.id,
|
|
318
324
|
ledgerApi: network.ledgerApi.baseUrl,
|
|
319
|
-
...(context
|
|
325
|
+
...(context.accessToken
|
|
320
326
|
? { accessToken: context.accessToken }
|
|
321
327
|
: {}),
|
|
322
328
|
};
|
|
323
329
|
},
|
|
324
330
|
signMessage: async (params) => {
|
|
331
|
+
assertIsConnected(context);
|
|
325
332
|
if (!params?.message)
|
|
326
333
|
throw new Error('Message is required');
|
|
327
334
|
const wallet = await store.getPrimaryWallet();
|
|
328
|
-
if (context === undefined) {
|
|
329
|
-
throw new Error('Unauthenticated context');
|
|
330
|
-
}
|
|
331
335
|
if (wallet === undefined) {
|
|
332
336
|
throw new Error('No primary wallet found');
|
|
333
337
|
}
|
|
334
|
-
const session = await
|
|
335
|
-
const
|
|
336
|
-
const notifier = notificationService.getNotifier(sessionId);
|
|
338
|
+
const session = await getActiveSession(context);
|
|
339
|
+
const notifier = notificationService.getNotifier(session.id);
|
|
337
340
|
const messageId = v4();
|
|
338
341
|
await store.setMessageRaw({
|
|
339
342
|
id: messageId,
|
|
@@ -355,6 +358,7 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
355
358
|
};
|
|
356
359
|
},
|
|
357
360
|
getPrimaryAccount: async function () {
|
|
361
|
+
assertIsConnected(context);
|
|
358
362
|
const wallet = await store.getPrimaryWallet();
|
|
359
363
|
if (!wallet) {
|
|
360
364
|
throw new Error('No primary wallet found');
|
|
@@ -379,5 +383,11 @@ export const dappController = (kernelInfo, dappUrl, userUrl, store, notification
|
|
|
379
383
|
});
|
|
380
384
|
};
|
|
381
385
|
async function prepareSubmission(userId, partyIds, synchronizerId, params, ledgerClient, hashingSchemeVersion) {
|
|
382
|
-
return await ledgerClient.postWithRetry('/v2/interactive-submission/prepare', ledgerPrepareParams(
|
|
386
|
+
return await ledgerClient.postWithRetry('/v2/interactive-submission/prepare', ledgerPrepareParams({
|
|
387
|
+
userId,
|
|
388
|
+
partyIds,
|
|
389
|
+
synchronizerId,
|
|
390
|
+
params,
|
|
391
|
+
hashingSchemeVersion,
|
|
392
|
+
}));
|
|
383
393
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
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
|
-
import {
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
4
|
import { pino } from 'pino';
|
|
5
5
|
import { sink } from 'pino-test';
|
|
6
6
|
import { PartyLevelRight, } from '@canton-network/core-wallet-store';
|
|
7
7
|
import { StoreInternal } from '@canton-network/core-wallet-store-inmemory';
|
|
8
8
|
import { SigningProvider } from '@canton-network/core-signing-lib';
|
|
9
|
-
import { NotificationService } from '
|
|
9
|
+
import { NotificationService } from '@canton-network/core-wallet-services';
|
|
10
10
|
import { dappController } from './controller.js';
|
|
11
11
|
import { getLogger } from '@logtape/logtape';
|
|
12
12
|
const ledgerMocks = vi.hoisted(() => ({
|
|
@@ -33,7 +33,7 @@ vi.mock('@canton-network/core-ledger-client', async (importOriginal) => {
|
|
|
33
33
|
}),
|
|
34
34
|
};
|
|
35
35
|
});
|
|
36
|
-
vi.mock('
|
|
36
|
+
vi.mock('@canton-network/core-wallet-services', async (importOriginal) => {
|
|
37
37
|
const actual = await importOriginal();
|
|
38
38
|
return {
|
|
39
39
|
...actual,
|
|
@@ -131,9 +131,6 @@ describe('dappController', () => {
|
|
|
131
131
|
});
|
|
132
132
|
mockUuidV4.mockReset();
|
|
133
133
|
});
|
|
134
|
-
afterEach(() => {
|
|
135
|
-
vi.clearAllMocks();
|
|
136
|
-
});
|
|
137
134
|
describe('connect', () => {
|
|
138
135
|
it('returns unauthenticated when there is no auth context', async () => {
|
|
139
136
|
const store = await createStore(logger, auth, {
|
|
@@ -365,7 +362,7 @@ describe('dappController', () => {
|
|
|
365
362
|
it('throws when auth context is missing', async () => {
|
|
366
363
|
const store = await createStore(logger, auth);
|
|
367
364
|
const controller = createController(store, notificationService, logger, undefined);
|
|
368
|
-
await expect(controller.prepareExecute(prepareParams)).rejects.
|
|
365
|
+
await expect(controller.prepareExecute(prepareParams)).rejects.toMatchObject({ code: 4100 });
|
|
369
366
|
});
|
|
370
367
|
it('throws when there is no primary wallet', async () => {
|
|
371
368
|
const store = await createStore(logger, auth, { withWallet: false });
|
|
@@ -436,6 +433,13 @@ describe('dappController', () => {
|
|
|
436
433
|
expect(ledgerMocks.getSynchronizerId).toHaveBeenCalled();
|
|
437
434
|
});
|
|
438
435
|
});
|
|
436
|
+
it.each(['listAccounts', 'getPrimaryAccount', 'getActiveNetwork'])('%s rejects with Unauthorized when auth context is missing', async (method) => {
|
|
437
|
+
const store = await createStore(logger, auth);
|
|
438
|
+
const controller = createController(store, notificationService, logger, undefined);
|
|
439
|
+
await expect(controller[method]()).rejects.toMatchObject({
|
|
440
|
+
code: 4100,
|
|
441
|
+
});
|
|
442
|
+
});
|
|
439
443
|
describe('signMessage', () => {
|
|
440
444
|
it('throws when message is missing', async () => {
|
|
441
445
|
const store = await createStore(logger, auth);
|
|
@@ -445,7 +449,7 @@ describe('dappController', () => {
|
|
|
445
449
|
it('throws when auth context is missing', async () => {
|
|
446
450
|
const store = await createStore(logger, auth);
|
|
447
451
|
const controller = createController(store, notificationService, logger, undefined);
|
|
448
|
-
await expect(controller.signMessage({ message: 'hello' })).rejects.
|
|
452
|
+
await expect(controller.signMessage({ message: 'hello' })).rejects.toMatchObject({ code: 4100 });
|
|
449
453
|
});
|
|
450
454
|
it('throws when there is no primary wallet', async () => {
|
|
451
455
|
const store = await createStore(logger, auth, { withWallet: false });
|
|
@@ -506,14 +510,6 @@ describe('dappController', () => {
|
|
|
506
510
|
accessToken: auth.accessToken,
|
|
507
511
|
});
|
|
508
512
|
});
|
|
509
|
-
it('returns the active network without access token when unauthenticated', async () => {
|
|
510
|
-
const store = await createStore(logger, auth);
|
|
511
|
-
const controller = createController(store, notificationService, logger, undefined);
|
|
512
|
-
await expect(controller.getActiveNetwork()).resolves.toEqual({
|
|
513
|
-
networkId: storeNetwork.id,
|
|
514
|
-
ledgerApi: storeNetwork.ledgerApi.baseUrl,
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
513
|
});
|
|
518
514
|
describe('event-only methods', () => {
|
|
519
515
|
it.each([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA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,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/schemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAoNlD,CAAA"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Code generated by rpc-generator DO NOT EDIT!!
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
// Methods without a declared param only accept an omitted or empty `params`.
|
|
6
|
+
const noParams = z.union([z.undefined(), z.tuple([]), z.strictObject({})]);
|
|
7
|
+
export const paramSchemas = {
|
|
8
|
+
status: noParams,
|
|
9
|
+
connect: noParams,
|
|
10
|
+
disconnect: noParams,
|
|
11
|
+
isConnected: noParams,
|
|
12
|
+
getActiveNetwork: noParams,
|
|
13
|
+
prepareExecute: z.fromJSONSchema({
|
|
14
|
+
title: 'prepareExecuteParams',
|
|
15
|
+
type: 'object',
|
|
16
|
+
description: 'Structure representing the request for prepare and execute calls',
|
|
17
|
+
additionalProperties: { type: 'null' },
|
|
18
|
+
properties: {
|
|
19
|
+
commandId: {
|
|
20
|
+
title: 'CommandId',
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'The unique identifier of the command associated with the transaction.',
|
|
23
|
+
},
|
|
24
|
+
commands: {
|
|
25
|
+
title: 'Commands',
|
|
26
|
+
type: 'array',
|
|
27
|
+
minItems: 1,
|
|
28
|
+
description: 'Non-empty array of Daml command atoms to submit atomically as a single transaction.',
|
|
29
|
+
items: {
|
|
30
|
+
title: 'Command',
|
|
31
|
+
description: 'A Daml command atom. Mirror of the Canton Ledger API Command union; inner shapes are intentionally opaque so the dApp layer never drifts from the Ledger API contract.',
|
|
32
|
+
oneOf: [
|
|
33
|
+
{
|
|
34
|
+
title: 'CreateCommand',
|
|
35
|
+
type: 'object',
|
|
36
|
+
additionalProperties: { type: 'null' },
|
|
37
|
+
required: ['CreateCommand'],
|
|
38
|
+
properties: {
|
|
39
|
+
CreateCommand: {
|
|
40
|
+
title: 'CreateCommandPayload',
|
|
41
|
+
type: 'object',
|
|
42
|
+
additionalProperties: true,
|
|
43
|
+
description: 'Inner shape is defined by the Canton Ledger API CreateCommand schema; do not re-specify here.',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: 'ExerciseCommand',
|
|
49
|
+
type: 'object',
|
|
50
|
+
additionalProperties: { type: 'null' },
|
|
51
|
+
required: ['ExerciseCommand'],
|
|
52
|
+
properties: {
|
|
53
|
+
ExerciseCommand: {
|
|
54
|
+
title: 'ExerciseCommandPayload',
|
|
55
|
+
type: 'object',
|
|
56
|
+
additionalProperties: true,
|
|
57
|
+
description: 'Inner shape is defined by the Canton Ledger API ExerciseCommand schema; do not re-specify here.',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: 'CreateAndExerciseCommand',
|
|
63
|
+
type: 'object',
|
|
64
|
+
additionalProperties: { type: 'null' },
|
|
65
|
+
required: ['CreateAndExerciseCommand'],
|
|
66
|
+
properties: {
|
|
67
|
+
CreateAndExerciseCommand: {
|
|
68
|
+
title: 'CreateAndExerciseCommandPayload',
|
|
69
|
+
type: 'object',
|
|
70
|
+
additionalProperties: true,
|
|
71
|
+
description: 'Inner shape is defined by the Canton Ledger API CreateAndExerciseCommand schema; do not re-specify here.',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: 'ExerciseByKeyCommand',
|
|
77
|
+
type: 'object',
|
|
78
|
+
additionalProperties: { type: 'null' },
|
|
79
|
+
required: ['ExerciseByKeyCommand'],
|
|
80
|
+
properties: {
|
|
81
|
+
ExerciseByKeyCommand: {
|
|
82
|
+
title: 'ExerciseByKeyCommandPayload',
|
|
83
|
+
type: 'object',
|
|
84
|
+
additionalProperties: true,
|
|
85
|
+
description: 'Inner shape is defined by the Canton Ledger API ExerciseByKeyCommand schema; do not re-specify here.',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
actAs: {
|
|
93
|
+
title: 'actAs',
|
|
94
|
+
type: 'array',
|
|
95
|
+
description: "Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used.",
|
|
96
|
+
items: { title: 'party', type: 'string' },
|
|
97
|
+
},
|
|
98
|
+
readAs: {
|
|
99
|
+
title: 'readAs',
|
|
100
|
+
type: 'array',
|
|
101
|
+
description: 'Set of parties that should be granted read access to the command, if submitted. If not set, no additional read parties are granted.',
|
|
102
|
+
items: { title: 'party', type: 'string' },
|
|
103
|
+
},
|
|
104
|
+
disclosedContracts: {
|
|
105
|
+
title: 'disclosedContracts',
|
|
106
|
+
type: 'array',
|
|
107
|
+
description: 'List of contract IDs to be disclosed with the command.',
|
|
108
|
+
items: {
|
|
109
|
+
title: 'DisclosedContract',
|
|
110
|
+
type: 'object',
|
|
111
|
+
description: 'Structure representing a disclosed contract for transaction execution',
|
|
112
|
+
additionalProperties: { type: 'null' },
|
|
113
|
+
properties: {
|
|
114
|
+
templateId: {
|
|
115
|
+
title: 'templateId',
|
|
116
|
+
type: 'string',
|
|
117
|
+
description: 'The template identifier of the disclosed contract.',
|
|
118
|
+
},
|
|
119
|
+
contractId: {
|
|
120
|
+
title: 'contractId',
|
|
121
|
+
type: 'string',
|
|
122
|
+
description: 'The unique identifier of the disclosed contract.',
|
|
123
|
+
},
|
|
124
|
+
createdEventBlob: {
|
|
125
|
+
title: 'createdEventBlob',
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'The blob data of the created event for the disclosed contract.',
|
|
128
|
+
},
|
|
129
|
+
synchronizerId: {
|
|
130
|
+
title: 'synchronizerId',
|
|
131
|
+
type: 'string',
|
|
132
|
+
description: 'The synchronizer identifier associated with the disclosed contract.',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
required: ['createdEventBlob'],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
synchronizerId: {
|
|
139
|
+
title: 'synchronizerId',
|
|
140
|
+
type: 'string',
|
|
141
|
+
description: 'If not set, a suitable synchronizer that this node is connected to will be chosen.',
|
|
142
|
+
},
|
|
143
|
+
packageIdSelectionPreference: {
|
|
144
|
+
title: 'packageIdSelectionPreference',
|
|
145
|
+
type: 'array',
|
|
146
|
+
description: 'The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation',
|
|
147
|
+
items: { title: 'packageId', type: 'string' },
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
required: ['commands'],
|
|
151
|
+
}),
|
|
152
|
+
signMessage: z.fromJSONSchema({
|
|
153
|
+
title: 'signMessageParams',
|
|
154
|
+
type: 'object',
|
|
155
|
+
description: 'Request to sign a message.',
|
|
156
|
+
additionalProperties: { type: 'null' },
|
|
157
|
+
properties: {
|
|
158
|
+
message: {
|
|
159
|
+
title: 'message',
|
|
160
|
+
type: 'string',
|
|
161
|
+
description: 'The message to sign.',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
required: ['message'],
|
|
165
|
+
}),
|
|
166
|
+
ledgerApi: z.fromJSONSchema({
|
|
167
|
+
title: 'ledgerApiParams',
|
|
168
|
+
type: 'object',
|
|
169
|
+
description: 'Ledger API request structure',
|
|
170
|
+
additionalProperties: { type: 'null' },
|
|
171
|
+
properties: {
|
|
172
|
+
requestMethod: {
|
|
173
|
+
title: 'requestMethod',
|
|
174
|
+
type: 'string',
|
|
175
|
+
enum: ['get', 'post', 'patch', 'put', 'delete'],
|
|
176
|
+
},
|
|
177
|
+
resource: { title: 'resource', type: 'string' },
|
|
178
|
+
body: { title: 'body', type: 'object', additionalProperties: true },
|
|
179
|
+
query: {
|
|
180
|
+
title: 'query',
|
|
181
|
+
type: 'object',
|
|
182
|
+
additionalProperties: true,
|
|
183
|
+
description: 'Query parameters as key-value pairs.',
|
|
184
|
+
},
|
|
185
|
+
path: {
|
|
186
|
+
title: 'path',
|
|
187
|
+
type: 'object',
|
|
188
|
+
additionalProperties: true,
|
|
189
|
+
description: 'Path parameters as key-value pairs.',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
required: ['requestMethod', 'resource'],
|
|
193
|
+
}),
|
|
194
|
+
connected: noParams,
|
|
195
|
+
onStatusChanged: noParams,
|
|
196
|
+
accountsChanged: noParams,
|
|
197
|
+
getPrimaryAccount: noParams,
|
|
198
|
+
listAccounts: noParams,
|
|
199
|
+
txChanged: noParams,
|
|
200
|
+
messageSignature: noParams,
|
|
201
|
+
};
|
|
@@ -191,7 +191,7 @@ export type UserUrl = string;
|
|
|
191
191
|
export interface Provider {
|
|
192
192
|
id: ProviderId;
|
|
193
193
|
version?: Version;
|
|
194
|
-
providerType
|
|
194
|
+
providerType: ProviderType;
|
|
195
195
|
url?: Url;
|
|
196
196
|
userUrl?: UserUrl;
|
|
197
197
|
}
|
|
@@ -353,8 +353,15 @@ export interface Wallet {
|
|
|
353
353
|
topologyTransactions?: TopologyTransactions;
|
|
354
354
|
disabled?: Disabled;
|
|
355
355
|
reason?: Reason;
|
|
356
|
+
isAuthParty?: IsAuthParty;
|
|
356
357
|
rights: Rights;
|
|
357
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
*
|
|
361
|
+
* Whether the party authenticates the user with self-issued tokens.
|
|
362
|
+
*
|
|
363
|
+
*/
|
|
364
|
+
export type IsAuthParty = boolean;
|
|
358
365
|
export type PartyLevelRight = any;
|
|
359
366
|
/**
|
|
360
367
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typings.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/typings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typings.d.ts","sourceRoot":"","sources":["../../../src/dapp-api/rpc-gen/typings.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB;AACD,MAAM,WAAW,aAAa;IAC1B,aAAa,EAAE,oBAAoB,CAAA;CACtC;AACD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB;AACD,MAAM,WAAW,eAAe;IAC5B,eAAe,EAAE,sBAAsB,CAAA;CAC1C;AACD;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC5C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB;AACD,MAAM,WAAW,wBAAwB;IACrC,wBAAwB,EAAE,+BAA+B,CAAA;CAC5D;AACD;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB;AACD,MAAM,WAAW,oBAAoB;IACjC,oBAAoB,EAAE,2BAA2B,CAAA;CACpD;AACD;;;;GAIG;AACH,MAAM,MAAM,OAAO,GACb,aAAa,GACb,eAAe,GACf,wBAAwB,GACxB,oBAAoB,CAAA;AAC1B;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAA;AAChC;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAA;AAC1B;;;;G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AC,iBAAiB,CAAC,CAAA;AAC/B,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;AAC7E,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;AAClD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;AACxD,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;AACrD,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAC5D,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import { Logger } from 'pino';
|
|
3
|
-
import { Store } from '@canton-network/core-wallet-store';
|
|
4
|
-
import { AuthAware } from '@canton-network/core-wallet-auth';
|
|
5
|
-
import { Server } from 'http';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { HASHING_SCHEME_VERSION } from '../env.js';
|
|
1
|
+
import type express from 'express';
|
|
2
|
+
import type { Logger } from 'pino';
|
|
3
|
+
import type { Store } from '@canton-network/core-wallet-store';
|
|
4
|
+
import type { AuthAware } from '@canton-network/core-wallet-auth';
|
|
5
|
+
import type { Server } from 'http';
|
|
6
|
+
import type { KernelInfo, ServerConfig } from '../config/Config.js';
|
|
7
|
+
import type { DappControllerDeps } from './controller.js';
|
|
8
|
+
import { type HASHING_SCHEME_VERSION, type NotificationService } from '@canton-network/core-wallet-services';
|
|
10
9
|
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>;
|
|
11
10
|
//# sourceMappingURL=server.d.ts.map
|