@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
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
5
|
import { LedgerClient } from '@canton-network/core-ledger-client';
|
|
6
6
|
import buildController from './rpc-gen/index.js';
|
|
7
|
-
import { assertConnected, authSchema, AuthTokenProvider, idpSchema, } from '@canton-network/core-wallet-auth';
|
|
7
|
+
import { assertConnected, authSchema, AuthTokenProvider, idpSchema, resolveAuthIdentityProviderId, assertIsConnected, } from '@canton-network/core-wallet-auth';
|
|
8
8
|
import { isRpcError, SigningProvider } from '@canton-network/core-signing-lib';
|
|
9
9
|
import { PartyAllocationService } from '../ledger/party-allocation-service.js';
|
|
10
10
|
import { WalletAllocationService } from '../ledger/wallet-allocation/wallet-allocation-service.js';
|
|
11
11
|
import { WalletSyncService } from '../ledger/wallet-sync-service.js';
|
|
12
|
-
import { logDynamically, networkStatus } from '../utils.js';
|
|
13
12
|
import { v4 } from 'uuid';
|
|
14
|
-
import {
|
|
13
|
+
import { assertSelfIssuedOnboardingAllowed, createSelfIssuedAuthService, } from '../ledger/self-issued-auth-service.js';
|
|
15
14
|
import { providerErrors, rpcErrors } from '@canton-network/core-rpc-errors';
|
|
16
15
|
import crypto from 'crypto';
|
|
17
16
|
import { assertTokenClaimsMatchNetwork } from './token-network-matching.js';
|
|
17
|
+
import { TransactionService, logDynamically, networkStatus, } from '@canton-network/core-wallet-services';
|
|
18
18
|
export const userController = (kernelInfo, userUrl, store, notificationService, authContext, drivers, _logger, hashingSchemeVersion, adminUserId) => {
|
|
19
19
|
const logger = _logger.child({ component: 'user-controller' });
|
|
20
20
|
const provider = {
|
|
@@ -28,11 +28,48 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
28
28
|
return !!adminUserId && !!userId && userId === adminUserId;
|
|
29
29
|
}
|
|
30
30
|
function assertAdmin() {
|
|
31
|
-
|
|
32
|
-
if (!adminUserId || userId !== adminUserId) {
|
|
31
|
+
assertIsConnected(authContext);
|
|
32
|
+
if (!adminUserId || authContext.userId !== adminUserId) {
|
|
33
33
|
throw new Error('Unauthorized: only the admin user can perform this operation');
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
function requireOnboardingSession() {
|
|
37
|
+
if (!authContext || authContext.isApiKey || !authContext.sessionId) {
|
|
38
|
+
throw new Error('No onboarding session found');
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
userId: authContext.userId,
|
|
42
|
+
sessionId: authContext.sessionId,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async function emitSessionConnected(sessionId, network, { userId, accessToken }, ledgerClient) {
|
|
46
|
+
const status = await networkStatus(ledgerClient);
|
|
47
|
+
const statusEvent = {
|
|
48
|
+
provider: provider,
|
|
49
|
+
connection: {
|
|
50
|
+
isConnected: status.isConnected,
|
|
51
|
+
reason: status.reason ? status.reason : 'OK',
|
|
52
|
+
isNetworkConnected: status.isConnected,
|
|
53
|
+
networkReason: status.reason ? status.reason : 'OK',
|
|
54
|
+
},
|
|
55
|
+
network: {
|
|
56
|
+
networkId: network.id,
|
|
57
|
+
ledgerApi: network.ledgerApi.baseUrl,
|
|
58
|
+
accessToken: accessToken,
|
|
59
|
+
},
|
|
60
|
+
session: {
|
|
61
|
+
accessToken: accessToken,
|
|
62
|
+
userId: userId,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const notifier = notificationService.getNotifier(sessionId);
|
|
66
|
+
notifier.emit('statusChanged', statusEvent);
|
|
67
|
+
notifier.emit('connected', statusEvent);
|
|
68
|
+
return status;
|
|
69
|
+
}
|
|
70
|
+
async function getIdpForAuth(network, auth) {
|
|
71
|
+
return await store.getIdp(resolveAuthIdentityProviderId(auth, network.identityProviderId));
|
|
72
|
+
}
|
|
36
73
|
/**
|
|
37
74
|
* Session responses always include user auth for the UI.
|
|
38
75
|
* Privileged credentials are included only for the admin user.
|
|
@@ -45,12 +82,13 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
45
82
|
const { adminAuth: _adminAuth, serviceAccountAuth: _sa, ...rest } = dto;
|
|
46
83
|
return rest;
|
|
47
84
|
}
|
|
85
|
+
const authAwareStore = store;
|
|
48
86
|
const getSigningProviderKeys = async (params) => {
|
|
49
87
|
const network = await store.getCurrentNetwork();
|
|
50
|
-
const idp = await store.getIdp(network.identityProviderId);
|
|
51
88
|
if (!network.adminAuth) {
|
|
52
89
|
throw new Error('No admin auth configured');
|
|
53
90
|
}
|
|
91
|
+
const idp = await getIdpForAuth(network, network.adminAuth);
|
|
54
92
|
const adminAccessTokenProvider = AuthTokenProvider.fromGatewayConfig(idp, network.adminAuth, logger);
|
|
55
93
|
const partyAllocator = new PartyAllocationService({
|
|
56
94
|
synchronizerId: network.synchronizerId,
|
|
@@ -68,9 +106,9 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
68
106
|
};
|
|
69
107
|
return buildController({
|
|
70
108
|
getUser: async () => {
|
|
71
|
-
|
|
109
|
+
assertIsConnected(authContext);
|
|
72
110
|
return {
|
|
73
|
-
userId,
|
|
111
|
+
userId: authContext.userId,
|
|
74
112
|
isAdmin: isAdmin(),
|
|
75
113
|
};
|
|
76
114
|
},
|
|
@@ -98,6 +136,24 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
98
136
|
serviceAccountAuth,
|
|
99
137
|
ledgerApi,
|
|
100
138
|
};
|
|
139
|
+
const referencedIdentityProviderIds = new Set([
|
|
140
|
+
newNetwork.identityProviderId,
|
|
141
|
+
...[
|
|
142
|
+
newNetwork.auth,
|
|
143
|
+
newNetwork.adminAuth,
|
|
144
|
+
newNetwork.serviceAccountAuth,
|
|
145
|
+
].flatMap((auth) => auth?.method === 'client_credentials' &&
|
|
146
|
+
auth.identityProviderId
|
|
147
|
+
? [auth.identityProviderId]
|
|
148
|
+
: []),
|
|
149
|
+
]);
|
|
150
|
+
const configuredIdentityProviderIds = new Set((await store.listIdps()).map((idp) => idp.id));
|
|
151
|
+
const missingIdentityProviderId = [
|
|
152
|
+
...referencedIdentityProviderIds,
|
|
153
|
+
].find((id) => !configuredIdentityProviderIds.has(id));
|
|
154
|
+
if (missingIdentityProviderId) {
|
|
155
|
+
throw new Error(`Identity provider "${missingIdentityProviderId}" not found`);
|
|
156
|
+
}
|
|
101
157
|
// TODO: Add an explicit updateNetwork method to the User API spec and controller
|
|
102
158
|
const existingNetworks = await store.listNetworks();
|
|
103
159
|
if (existingNetworks.find((n) => n.id === newNetwork.id)) {
|
|
@@ -191,15 +247,15 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
191
247
|
listIdps: async () => ({ idps: await store.listIdps() }),
|
|
192
248
|
createWallet: async (params) => {
|
|
193
249
|
const { signingProviderId, primary, partyHint } = params;
|
|
194
|
-
|
|
250
|
+
assertIsConnected(authContext);
|
|
195
251
|
const network = await store.getCurrentNetwork();
|
|
196
252
|
if (network === undefined) {
|
|
197
253
|
throw new Error('No network session found');
|
|
198
254
|
}
|
|
199
|
-
const idp = await store.getIdp(network.identityProviderId);
|
|
200
255
|
if (!network.adminAuth) {
|
|
201
256
|
throw new Error('No admin auth configured');
|
|
202
257
|
}
|
|
258
|
+
const idp = await getIdpForAuth(network, network.adminAuth);
|
|
203
259
|
const adminTokenProvider = AuthTokenProvider.fromGatewayConfig(idp, network.adminAuth, logger);
|
|
204
260
|
const partyAllocator = new PartyAllocationService({
|
|
205
261
|
synchronizerId: network.synchronizerId,
|
|
@@ -211,24 +267,89 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
211
267
|
if (!drivers[signingProviderId]) {
|
|
212
268
|
throw new Error(`Signing provider ${signingProviderId} not supported`);
|
|
213
269
|
}
|
|
214
|
-
const wallet = await walletAllocationService.createWallet(
|
|
215
|
-
// Sync wallets (TODO: separate rights sync from wallet sync as we only need rights sync here)
|
|
270
|
+
const wallet = await walletAllocationService.createWallet(authContext, partyHint, primary ?? false, signingProviderId, params.keyName);
|
|
216
271
|
const ledgerClient = new LedgerClient({
|
|
217
272
|
baseUrl: new URL(network.ledgerApi.baseUrl),
|
|
218
273
|
logger,
|
|
219
274
|
accessTokenProvider: AuthTokenProvider.fromToken(authContext.accessToken, logger),
|
|
220
275
|
});
|
|
221
|
-
const service = new WalletSyncService(store, ledgerClient, authContext, logger
|
|
222
|
-
await service.
|
|
276
|
+
const service = new WalletSyncService(store, ledgerClient, authContext, logger);
|
|
277
|
+
await service.syncRights();
|
|
223
278
|
// Notify about the change and return the new wallet
|
|
224
279
|
const wallets = await store.getWallets();
|
|
225
280
|
notificationService
|
|
226
|
-
.getNotifier(
|
|
281
|
+
.getNotifier(authContext.userId)
|
|
227
282
|
.emit('accountsChanged', wallets);
|
|
283
|
+
const walletWithUpdatedRights = wallets.find((w) => w.partyId === wallet.partyId && w.networkId === network.id);
|
|
284
|
+
return { wallet: walletWithUpdatedRights ?? wallet };
|
|
285
|
+
},
|
|
286
|
+
addSelfIssuedSession: async (params) => {
|
|
287
|
+
const username = params.username.trim();
|
|
288
|
+
if (!username) {
|
|
289
|
+
throw new Error('username is required');
|
|
290
|
+
}
|
|
291
|
+
const network = await authAwareStore.getNetwork(params.networkId);
|
|
292
|
+
if (network.auth.method !== 'self_issued') {
|
|
293
|
+
throw new Error('Network does not use self_issued authentication');
|
|
294
|
+
}
|
|
295
|
+
const onboardingStore = authAwareStore.withAuthContext({
|
|
296
|
+
userId: username,
|
|
297
|
+
accessToken: '',
|
|
298
|
+
});
|
|
299
|
+
await assertSelfIssuedOnboardingAllowed(authAwareStore, network, username, logger);
|
|
300
|
+
const sessionId = v4();
|
|
301
|
+
await onboardingStore.setSession({
|
|
302
|
+
id: sessionId,
|
|
303
|
+
origin: params.origin,
|
|
304
|
+
network: network.id,
|
|
305
|
+
});
|
|
306
|
+
return { sessionId };
|
|
307
|
+
},
|
|
308
|
+
getSelfIssuedOnboarding: async (_params) => {
|
|
309
|
+
const service = await createSelfIssuedAuthService(authAwareStore, requireOnboardingSession(), drivers, logger);
|
|
310
|
+
return service.getOnboardingState();
|
|
311
|
+
},
|
|
312
|
+
createSelfIssuedWallet: async (params) => {
|
|
313
|
+
const { signingProviderId } = params;
|
|
314
|
+
if (!drivers[signingProviderId]) {
|
|
315
|
+
throw new Error(`Signing provider ${signingProviderId} not supported`);
|
|
316
|
+
}
|
|
317
|
+
const service = await createSelfIssuedAuthService(authAwareStore, requireOnboardingSession(), drivers, logger);
|
|
318
|
+
const wallet = await service.createWallet({
|
|
319
|
+
partyHint: params.partyHint,
|
|
320
|
+
signingProviderId: signingProviderId,
|
|
321
|
+
});
|
|
228
322
|
return { wallet };
|
|
229
323
|
},
|
|
324
|
+
allocateSelfIssuedWallet: async (params) => {
|
|
325
|
+
const service = await createSelfIssuedAuthService(authAwareStore, requireOnboardingSession(), drivers, logger);
|
|
326
|
+
const allocated = await service.allocateParty({
|
|
327
|
+
partyId: params.partyId,
|
|
328
|
+
});
|
|
329
|
+
return { wallet: allocated };
|
|
330
|
+
},
|
|
331
|
+
connectSelfIssuedSession: async (params) => {
|
|
332
|
+
const onboardingSession = requireOnboardingSession();
|
|
333
|
+
const service = await createSelfIssuedAuthService(authAwareStore, onboardingSession, drivers, logger);
|
|
334
|
+
const { wallet, accessToken, session } = await service.connectSession({
|
|
335
|
+
partyId: params.partyId,
|
|
336
|
+
});
|
|
337
|
+
const connectedContext = {
|
|
338
|
+
userId: onboardingSession.userId,
|
|
339
|
+
accessToken,
|
|
340
|
+
};
|
|
341
|
+
const scopedStore = authAwareStore.withAuthContext(connectedContext);
|
|
342
|
+
const network = await scopedStore.getCurrentNetwork();
|
|
343
|
+
const ledgerClient = new LedgerClient({
|
|
344
|
+
baseUrl: new URL(network.ledgerApi.baseUrl),
|
|
345
|
+
logger,
|
|
346
|
+
accessTokenProvider: AuthTokenProvider.fromToken(accessToken, logger),
|
|
347
|
+
});
|
|
348
|
+
await emitSessionConnected(session.id, network, connectedContext, ledgerClient);
|
|
349
|
+
return { wallet, accessToken, sessionId: session.id };
|
|
350
|
+
},
|
|
230
351
|
allocatePartyForWallet: async (params) => {
|
|
231
|
-
|
|
352
|
+
assertIsConnected(authContext);
|
|
232
353
|
const network = await store.getCurrentNetwork();
|
|
233
354
|
if (!network) {
|
|
234
355
|
throw new Error('No network session found');
|
|
@@ -241,7 +362,7 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
241
362
|
if (!existingWallet) {
|
|
242
363
|
throw new Error(`Wallet not found for party ${params.partyId}`);
|
|
243
364
|
}
|
|
244
|
-
const idp = await
|
|
365
|
+
const idp = await getIdpForAuth(network, network.adminAuth);
|
|
245
366
|
const accessTokenProvider = AuthTokenProvider.fromGatewayConfig(idp, network.adminAuth, logger);
|
|
246
367
|
const partyAllocator = new PartyAllocationService({
|
|
247
368
|
synchronizerId: network.synchronizerId,
|
|
@@ -254,21 +375,20 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
254
375
|
if (!drivers[signingProviderId]) {
|
|
255
376
|
throw new Error(`Signing provider ${signingProviderId} not supported`);
|
|
256
377
|
}
|
|
257
|
-
await walletAllocationService.allocateParty(
|
|
258
|
-
// Sync wallets (TODO: separate rights sync from wallet sync as we only need rights sync here)
|
|
378
|
+
await walletAllocationService.allocateParty(authContext, existingWallet, signingProviderId);
|
|
259
379
|
const ledgerClient = new LedgerClient({
|
|
260
380
|
baseUrl: new URL(network.ledgerApi.baseUrl),
|
|
261
381
|
logger,
|
|
262
382
|
accessTokenProvider: AuthTokenProvider.fromToken(authContext.accessToken, logger),
|
|
263
383
|
});
|
|
264
|
-
const service = new WalletSyncService(store, ledgerClient, authContext, logger
|
|
265
|
-
await service.
|
|
384
|
+
const service = new WalletSyncService(store, ledgerClient, authContext, logger);
|
|
385
|
+
await service.syncRights();
|
|
266
386
|
// Notify about the change and return the updated wallet
|
|
267
387
|
const wallets = await store.getWallets();
|
|
268
388
|
const wallet = wallets.find((w) => w.partyId === existingWallet.partyId &&
|
|
269
389
|
w.networkId === network.id);
|
|
270
390
|
notificationService
|
|
271
|
-
.getNotifier(
|
|
391
|
+
.getNotifier(authContext.userId)
|
|
272
392
|
.emit('accountsChanged', wallets);
|
|
273
393
|
return { wallet };
|
|
274
394
|
},
|
|
@@ -294,10 +414,10 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
294
414
|
const wallets = await store.getWallets();
|
|
295
415
|
const wallet = wallets.find((w) => w.partyId === signParams.partyId);
|
|
296
416
|
if (wallet === undefined) {
|
|
297
|
-
throw new Error(
|
|
417
|
+
throw new Error(`No wallet found for partyId ${signParams.partyId}`);
|
|
298
418
|
}
|
|
299
|
-
|
|
300
|
-
const session = await store.getSession(
|
|
419
|
+
assertIsConnected(authContext);
|
|
420
|
+
const session = await store.getSession(authContext.accessToken);
|
|
301
421
|
if (!session) {
|
|
302
422
|
throw new Error('No active session found');
|
|
303
423
|
}
|
|
@@ -305,9 +425,9 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
305
425
|
const transactionService = new TransactionService(store, logger, drivers, notifier, hashingSchemeVersion);
|
|
306
426
|
logDynamically(logger, 'signing transaction with params', {
|
|
307
427
|
info: { transactionId: signParams.transactionId },
|
|
308
|
-
debug: { signParams, wallet,
|
|
428
|
+
debug: { signParams, wallet, authContext },
|
|
309
429
|
});
|
|
310
|
-
const response = await transactionService.sign(
|
|
430
|
+
const response = await transactionService.sign(authContext, wallet, signParams);
|
|
311
431
|
logDynamically(logger, 'transaction signed with response', {
|
|
312
432
|
info: { transactionId: signParams.transactionId },
|
|
313
433
|
debug: { response },
|
|
@@ -322,11 +442,12 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
322
442
|
if (pending.status !== 'pending') {
|
|
323
443
|
throw new Error(`Cannot sign message with status '${pending.status}'. Only pending messages can be signed.`);
|
|
324
444
|
}
|
|
325
|
-
|
|
445
|
+
assertIsConnected(authContext);
|
|
446
|
+
const userId = authContext.userId;
|
|
326
447
|
if (pending.userId !== userId) {
|
|
327
448
|
throw new Error(`Message signing request ${pending.id} is not owned by user ${userId}`);
|
|
328
449
|
}
|
|
329
|
-
const session = await store.getSession(
|
|
450
|
+
const session = await store.getSession(authContext.accessToken);
|
|
330
451
|
if (!session) {
|
|
331
452
|
throw new Error('No active session found');
|
|
332
453
|
}
|
|
@@ -446,11 +567,21 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
446
567
|
if (message.status !== 'pending') {
|
|
447
568
|
throw new Error(`Cannot delete message with status '${message.status}'. Only pending messages can be deleted.`);
|
|
448
569
|
}
|
|
449
|
-
|
|
570
|
+
assertIsConnected(authContext);
|
|
571
|
+
const userId = authContext.userId;
|
|
450
572
|
if (message.userId !== userId) {
|
|
451
573
|
throw new Error(`Message signing request ${message.id} is not owned by user ${userId}`);
|
|
452
574
|
}
|
|
453
575
|
await store.removeMessageRaw(message.id);
|
|
576
|
+
const session = await store.getSession(authContext.accessToken);
|
|
577
|
+
if (session) {
|
|
578
|
+
notificationService
|
|
579
|
+
.getNotifier(session.id)
|
|
580
|
+
.emit('messageSignature', {
|
|
581
|
+
status: 'failed',
|
|
582
|
+
messageId: message.id,
|
|
583
|
+
});
|
|
584
|
+
}
|
|
454
585
|
return null;
|
|
455
586
|
},
|
|
456
587
|
execute: async (executeParams) => {
|
|
@@ -464,12 +595,12 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
464
595
|
if (transaction === undefined) {
|
|
465
596
|
throw new Error('No transaction found');
|
|
466
597
|
}
|
|
467
|
-
|
|
468
|
-
const accessTokenProvider = AuthTokenProvider.fromToken(
|
|
598
|
+
assertIsConnected(authContext);
|
|
599
|
+
const accessTokenProvider = AuthTokenProvider.fromToken(authContext.accessToken, logger);
|
|
469
600
|
if (network === undefined) {
|
|
470
601
|
throw new Error('No network session found');
|
|
471
602
|
}
|
|
472
|
-
const session = await store.getSession(
|
|
603
|
+
const session = await store.getSession(authContext.accessToken);
|
|
473
604
|
if (!session) {
|
|
474
605
|
throw new Error('No active session found');
|
|
475
606
|
}
|
|
@@ -486,10 +617,10 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
486
617
|
executeParams,
|
|
487
618
|
transaction,
|
|
488
619
|
wallet,
|
|
489
|
-
userId:
|
|
620
|
+
userId: authContext.userId,
|
|
490
621
|
},
|
|
491
622
|
});
|
|
492
|
-
const response = await transactionService.execute(
|
|
623
|
+
const response = await transactionService.execute(authContext.userId, wallet, transaction, executeParams, ledgerClient, authContext, network);
|
|
493
624
|
logDynamically(logger, 'transaction executed with response', {
|
|
494
625
|
info: { transactionId: executeParams.transactionId },
|
|
495
626
|
debug: { response },
|
|
@@ -498,8 +629,8 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
498
629
|
},
|
|
499
630
|
addSession: async function (params) {
|
|
500
631
|
try {
|
|
501
|
-
|
|
502
|
-
const {
|
|
632
|
+
assertIsConnected(authContext);
|
|
633
|
+
const { accessToken } = authContext;
|
|
503
634
|
const newSessionId = v4();
|
|
504
635
|
logger.info(`Adding session with ID ${newSessionId} for network ${params.networkId}`);
|
|
505
636
|
const network = await store.getNetwork(params.networkId);
|
|
@@ -509,35 +640,14 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
509
640
|
id: newSessionId,
|
|
510
641
|
origin: params.origin,
|
|
511
642
|
network: params.networkId,
|
|
512
|
-
accessToken:
|
|
643
|
+
accessToken: accessToken || '',
|
|
513
644
|
});
|
|
514
|
-
const notifier = notificationService.getNotifier(newSessionId);
|
|
515
645
|
const ledgerClient = new LedgerClient({
|
|
516
646
|
baseUrl: new URL(network.ledgerApi.baseUrl),
|
|
517
647
|
logger,
|
|
518
648
|
accessTokenProvider: AuthTokenProvider.fromToken(accessToken, logger),
|
|
519
649
|
});
|
|
520
|
-
const status = await
|
|
521
|
-
const statusEvent = {
|
|
522
|
-
provider: provider,
|
|
523
|
-
connection: {
|
|
524
|
-
isConnected: status.isConnected,
|
|
525
|
-
reason: status.reason ? status.reason : 'OK',
|
|
526
|
-
isNetworkConnected: status.isConnected,
|
|
527
|
-
networkReason: status.reason ? status.reason : 'OK',
|
|
528
|
-
},
|
|
529
|
-
network: {
|
|
530
|
-
networkId: network.id,
|
|
531
|
-
ledgerApi: network.ledgerApi.baseUrl,
|
|
532
|
-
accessToken: accessToken,
|
|
533
|
-
},
|
|
534
|
-
session: {
|
|
535
|
-
accessToken: accessToken,
|
|
536
|
-
userId: userId,
|
|
537
|
-
},
|
|
538
|
-
};
|
|
539
|
-
notifier.emit('statusChanged', statusEvent);
|
|
540
|
-
notifier.emit('connected', statusEvent);
|
|
650
|
+
const status = await emitSessionConnected(newSessionId, network, authContext, ledgerClient);
|
|
541
651
|
// Only bootstrap wallets the first time a session is created.
|
|
542
652
|
// Session creation must remain successful when the ledger or
|
|
543
653
|
// wallet synchronization is unavailable.
|
|
@@ -554,14 +664,15 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
554
664
|
if (!network.adminAuth) {
|
|
555
665
|
throw new Error('No admin auth configured');
|
|
556
666
|
}
|
|
557
|
-
const
|
|
667
|
+
const adminIdp = await getIdpForAuth(network, network.adminAuth);
|
|
668
|
+
const adminAccessTokenProvider = AuthTokenProvider.fromGatewayConfig(adminIdp, network.adminAuth, logger);
|
|
558
669
|
const partyAllocator = new PartyAllocationService({
|
|
559
670
|
synchronizerId: network.synchronizerId,
|
|
560
671
|
accessTokenProvider: adminAccessTokenProvider,
|
|
561
672
|
httpLedgerUrl: network.ledgerApi.baseUrl,
|
|
562
673
|
logger,
|
|
563
674
|
});
|
|
564
|
-
const service = new WalletSyncService(store, ledgerClient,
|
|
675
|
+
const service = new WalletSyncService(store, ledgerClient, authContext, logger, drivers, partyAllocator);
|
|
565
676
|
await service.syncWallets();
|
|
566
677
|
}
|
|
567
678
|
catch (error) {
|
|
@@ -648,10 +759,10 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
648
759
|
const network = await store.getCurrentNetwork();
|
|
649
760
|
const { userId } = assertConnected(authContext);
|
|
650
761
|
const userAccessTokenProvider = AuthTokenProvider.fromToken(authContext.accessToken, logger);
|
|
651
|
-
const idp = await store.getIdp(network.identityProviderId);
|
|
652
762
|
if (!network.adminAuth) {
|
|
653
763
|
throw new Error('No admin auth configured');
|
|
654
764
|
}
|
|
765
|
+
const idp = await getIdpForAuth(network, network.adminAuth);
|
|
655
766
|
const adminAccessTokenProvider = AuthTokenProvider.fromGatewayConfig(idp, network.adminAuth, logger);
|
|
656
767
|
const partyAllocator = new PartyAllocationService({
|
|
657
768
|
synchronizerId: network.synchronizerId,
|
|
@@ -680,10 +791,10 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
680
791
|
const network = await store.getCurrentNetwork();
|
|
681
792
|
assertConnected(authContext);
|
|
682
793
|
const userAccessTokenProvider = AuthTokenProvider.fromToken(authContext.accessToken, logger);
|
|
683
|
-
const idp = await store.getIdp(network.identityProviderId);
|
|
684
794
|
if (!network.adminAuth) {
|
|
685
795
|
throw new Error('No admin auth configured');
|
|
686
796
|
}
|
|
797
|
+
const idp = await getIdpForAuth(network, network.adminAuth);
|
|
687
798
|
const adminAccessTokenProvider = AuthTokenProvider.fromGatewayConfig(idp, network.adminAuth, logger);
|
|
688
799
|
const partyAllocator = new PartyAllocationService({
|
|
689
800
|
synchronizerId: network.synchronizerId,
|
|
@@ -770,7 +881,8 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
770
881
|
if (!transaction) {
|
|
771
882
|
throw new Error(`Transaction not found with id: ${params.transactionId}`);
|
|
772
883
|
}
|
|
773
|
-
if (transaction.status !== 'pending'
|
|
884
|
+
if (transaction.status !== 'pending' &&
|
|
885
|
+
transaction.status !== 'awaiting-signature') {
|
|
774
886
|
throw new Error(`Cannot delete transaction with status '${transaction.status}'. Only pending transactions can be deleted.`);
|
|
775
887
|
}
|
|
776
888
|
const session = await store.getSession(assertConnected(authContext).accessToken);
|
|
@@ -846,7 +958,7 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
846
958
|
if (!network.adminAuth) {
|
|
847
959
|
throw new Error('No admin auth configured');
|
|
848
960
|
}
|
|
849
|
-
const idp = await
|
|
961
|
+
const idp = await getIdpForAuth(network, network.adminAuth);
|
|
850
962
|
const adminTokenProvider = AuthTokenProvider.fromGatewayConfig(idp, network.adminAuth, logger);
|
|
851
963
|
const partyAllocator = new PartyAllocationService({
|
|
852
964
|
synchronizerId: network.synchronizerId,
|
|
@@ -872,29 +984,80 @@ export const userController = (kernelInfo, userUrl, store, notificationService,
|
|
|
872
984
|
getWallet: async (params) => {
|
|
873
985
|
return await store.getWallet(params.partyId);
|
|
874
986
|
},
|
|
987
|
+
getTransactionStatus: async (params) => {
|
|
988
|
+
const tx = await store.getTransaction(params.transactionId);
|
|
989
|
+
if (!tx)
|
|
990
|
+
throw new Error(`Transaction with txId: ${params.transactionId} not found in store`);
|
|
991
|
+
//no externalTxId means nothing sent to signing provider, so no need to poll
|
|
992
|
+
if (!tx.externalTxId || tx.status !== 'awaiting-signature') {
|
|
993
|
+
return {
|
|
994
|
+
status: tx.status,
|
|
995
|
+
...(tx.externalTxId && { externalTxId: tx.externalTxId }),
|
|
996
|
+
...(tx.failureReason && {
|
|
997
|
+
failureReason: tx.failureReason,
|
|
998
|
+
}),
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
const wallet = params.partyId
|
|
1002
|
+
? (await store.getWallets()).find((x) => x.partyId === params.partyId)
|
|
1003
|
+
: await store.getPrimaryWallet();
|
|
1004
|
+
if (!wallet) {
|
|
1005
|
+
throw new Error(params.partyId
|
|
1006
|
+
? `No wallet found for partyId: ${params.partyId}`
|
|
1007
|
+
: `No primary wallet found`);
|
|
1008
|
+
}
|
|
1009
|
+
assertIsConnected(authContext);
|
|
1010
|
+
const session = await store.getSession(authContext.accessToken);
|
|
1011
|
+
if (!session) {
|
|
1012
|
+
throw new Error('No active session found');
|
|
1013
|
+
}
|
|
1014
|
+
const notifier = notificationService.getNotifier(session.id);
|
|
1015
|
+
const transactionService = new TransactionService(store, logger, drivers, notifier, hashingSchemeVersion);
|
|
1016
|
+
const result = await transactionService.refreshTransaction(authContext, wallet, tx.id);
|
|
1017
|
+
logDynamically(logger, `refreshed transaction status`, {
|
|
1018
|
+
info: { transactionId: tx.id, status: result.status },
|
|
1019
|
+
debug: { result },
|
|
1020
|
+
});
|
|
1021
|
+
return result;
|
|
1022
|
+
},
|
|
875
1023
|
});
|
|
876
1024
|
};
|
|
877
1025
|
function toAuthDto(auth) {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1026
|
+
switch (auth.method) {
|
|
1027
|
+
case 'authorization_code':
|
|
1028
|
+
return {
|
|
1029
|
+
method: auth.method,
|
|
1030
|
+
audience: auth.audience,
|
|
1031
|
+
scope: auth.scope,
|
|
1032
|
+
clientId: auth.clientId,
|
|
1033
|
+
};
|
|
1034
|
+
case 'client_credentials':
|
|
1035
|
+
return {
|
|
1036
|
+
method: auth.method,
|
|
1037
|
+
...(auth.identityProviderId
|
|
1038
|
+
? { identityProviderId: auth.identityProviderId }
|
|
1039
|
+
: {}),
|
|
1040
|
+
audience: auth.audience,
|
|
1041
|
+
scope: auth.scope,
|
|
1042
|
+
clientId: auth.clientId,
|
|
1043
|
+
clientSecret: auth.clientSecret,
|
|
1044
|
+
};
|
|
1045
|
+
case 'self_signed':
|
|
1046
|
+
return {
|
|
1047
|
+
method: auth.method,
|
|
1048
|
+
audience: auth.audience,
|
|
1049
|
+
scope: auth.scope,
|
|
1050
|
+
clientId: auth.clientId,
|
|
1051
|
+
clientSecret: auth.clientSecret,
|
|
1052
|
+
issuer: auth.issuer,
|
|
1053
|
+
};
|
|
1054
|
+
case 'self_issued':
|
|
1055
|
+
return {
|
|
1056
|
+
method: auth.method,
|
|
1057
|
+
audience: auth.audience,
|
|
1058
|
+
scope: auth.scope,
|
|
1059
|
+
};
|
|
896
1060
|
}
|
|
897
|
-
return base;
|
|
898
1061
|
}
|
|
899
1062
|
function toNetworkDto(network) {
|
|
900
1063
|
return {
|
|
@@ -924,7 +1087,7 @@ function toPublicNetwork(network) {
|
|
|
924
1087
|
ledgerApi: network.ledgerApi.baseUrl,
|
|
925
1088
|
authMethod: auth.method,
|
|
926
1089
|
...(auth.method !== 'client_credentials' && {
|
|
927
|
-
clientId: auth.clientId,
|
|
1090
|
+
...('clientId' in auth ? { clientId: auth.clientId } : {}),
|
|
928
1091
|
scope: auth.scope,
|
|
929
1092
|
audience: auth.audience,
|
|
930
1093
|
}),
|