@canton-network/wallet-gateway-remote 1.13.0 → 1.14.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/README.md +2 -2
- package/dist/auth/jwt-auth-service.d.ts.map +1 -1
- package/dist/auth/jwt-auth-service.js +16 -2
- package/dist/config/Config.d.ts +261 -2
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.js +26 -5
- package/dist/config/ConfigUtils.d.ts +16 -1
- package/dist/config/ConfigUtils.d.ts.map +1 -1
- package/dist/config/ConfigUtils.js +147 -59
- package/dist/dapp-api/controller.d.ts +13 -1
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +2 -1
- package/dist/dapp-api/rpc-gen/typings.d.ts +30 -0
- package/dist/dapp-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/dapp-api/server.d.ts +10 -5
- package/dist/dapp-api/server.d.ts.map +1 -1
- package/dist/dapp-api/server.js +10 -3
- package/dist/example-config.d.ts +58 -62
- package/dist/example-config.d.ts.map +1 -1
- package/dist/example-config.js +59 -61
- package/dist/index.js +7 -4
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +64 -19
- package/dist/ledger/wallet-sync-service.d.ts +11 -1
- package/dist/ledger/wallet-sync-service.d.ts.map +1 -1
- package/dist/ledger/wallet-sync-service.js +101 -48
- package/dist/middleware/rateLimit.d.ts.map +1 -1
- package/dist/middleware/rateLimit.js +3 -9
- package/dist/notices/server-notices.d.ts +24 -0
- package/dist/notices/server-notices.d.ts.map +1 -0
- package/dist/notices/server-notices.js +40 -0
- package/dist/notices/server-status-service.d.ts +11 -0
- package/dist/notices/server-status-service.d.ts.map +1 -0
- package/dist/notices/server-status-service.js +17 -0
- package/dist/signing/service-account-session.d.ts +16 -2
- package/dist/signing/service-account-session.d.ts.map +1 -1
- package/dist/signing/service-account-session.js +31 -0
- package/dist/signing-providers-registration.d.ts +2 -1
- package/dist/signing-providers-registration.d.ts.map +1 -1
- package/dist/signing-providers-registration.js +76 -16
- package/dist/user-api/controller.d.ts +20 -2
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +161 -302
- package/dist/user-api/rpc-gen/index.d.ts +12 -3
- package/dist/user-api/rpc-gen/index.d.ts.map +1 -1
- package/dist/user-api/rpc-gen/index.js +4 -1
- package/dist/user-api/rpc-gen/schemas.d.ts.map +1 -1
- package/dist/user-api/rpc-gen/schemas.js +46 -3
- package/dist/user-api/rpc-gen/typings.d.ts +113 -35
- package/dist/user-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/user-api/server.d.ts +7 -5
- package/dist/user-api/server.d.ts.map +1 -1
- package/dist/user-api/server.js +7 -2
- package/dist/web/frontend/404/index.html +3 -2
- package/dist/web/frontend/activities/index.html +4 -3
- package/dist/web/frontend/admin/index.html +16 -0
- package/dist/web/frontend/api-keys/add/index.html +3 -2
- package/dist/web/frontend/api-keys/index.html +3 -2
- package/dist/web/frontend/approve/index.html +4 -4
- package/dist/web/frontend/assets/404-N2p-H94F.js +5 -0
- package/dist/web/frontend/assets/activities-CIyMcvMq.js +71 -0
- package/dist/web/frontend/assets/addApiKey-DD_HxolC.js +92 -0
- package/dist/web/frontend/assets/addIdentityProvider-DNaST3bz.js +28 -0
- package/dist/web/frontend/assets/addNetwork-BwV-qK9L.js +38 -0
- package/dist/web/frontend/assets/addParty-DtBW1rpV.js +14 -0
- package/dist/web/frontend/assets/admin-CKAkdJym.js +53 -0
- package/dist/web/frontend/assets/apiKeys-CcnbBkNH.js +68 -0
- package/dist/web/frontend/assets/approve-33mo5eC8.js +27 -0
- package/dist/web/frontend/assets/callback-lKGXXz-1.js +7 -0
- package/dist/web/frontend/assets/common-DaUa4tUM.js +15 -0
- package/dist/web/frontend/assets/dist-BW5ACUmw.js +2 -0
- package/dist/web/frontend/assets/dist-CVv1nHd6.js +1 -0
- package/dist/web/frontend/assets/editParty-ZifjLzYx.js +15 -0
- package/dist/web/frontend/assets/frontend-Bs6UVmG1.js +4968 -0
- package/dist/web/frontend/assets/identityProviders-D5s7N-Ec.js +76 -0
- package/dist/web/frontend/assets/login-BAJsIB9G.js +11 -0
- package/dist/web/frontend/assets/networks-Do-zoG5E.js +78 -0
- package/dist/web/frontend/assets/parties-DFcN190b.js +51 -0
- package/dist/web/frontend/assets/reviewIdentityProvider-C2tsrpKc.js +43 -0
- package/dist/web/frontend/assets/reviewNetwork-BEGzls61.js +43 -0
- package/dist/web/frontend/assets/rolldown-runtime-pP25SEvz.js +1 -0
- package/dist/web/frontend/assets/selfIssuedLogin-a2KenO2P.js +112 -0
- package/dist/web/frontend/assets/signMessage-CQF0sCMe.js +23 -0
- package/dist/web/frontend/callback/index.html +3 -3
- package/dist/web/frontend/identity-providers/add/index.html +3 -2
- package/dist/web/frontend/identity-providers/index.html +3 -2
- package/dist/web/frontend/identity-providers/review/index.html +3 -2
- package/dist/web/frontend/index.html +2 -1
- package/dist/web/frontend/login/index.html +4 -12
- package/dist/web/frontend/networks/add/index.html +3 -2
- package/dist/web/frontend/networks/index.html +3 -2
- package/dist/web/frontend/networks/review/index.html +3 -2
- package/dist/web/frontend/parties/add/index.html +5 -5
- package/dist/web/frontend/parties/edit/index.html +5 -5
- package/dist/web/frontend/parties/index.html +4 -3
- package/dist/web/frontend/self-issued-login/index.html +5 -13
- package/dist/web/frontend/sign-message/index.html +3 -2
- package/dist/web/route-inputs.d.ts.map +1 -1
- package/dist/web/route-inputs.js +1 -0
- package/package.json +34 -30
- package/dist/ledger/self-issued-auth-service.d.ts +0 -50
- package/dist/ledger/self-issued-auth-service.d.ts.map +0 -1
- package/dist/ledger/self-issued-auth-service.js +0 -264
- package/dist/signing/signing-worker.d.ts +0 -86
- package/dist/signing/signing-worker.d.ts.map +0 -1
- package/dist/signing/signing-worker.js +0 -213
- package/dist/web/frontend/assets/404-D6hNG1H8.js +0 -5
- package/dist/web/frontend/assets/activities-CSaNJ4Bw.js +0 -61
- package/dist/web/frontend/assets/addApiKey-IKOYP6lC.js +0 -92
- package/dist/web/frontend/assets/addIdentityProvider-CnRS1C3U.js +0 -28
- package/dist/web/frontend/assets/addNetwork-Wq0K3t5Z.js +0 -38
- package/dist/web/frontend/assets/addParty-B0GaqKvG.js +0 -14
- package/dist/web/frontend/assets/apiKeys-BgJyxg5r.js +0 -68
- package/dist/web/frontend/assets/approve-kKlT_54l.js +0 -27
- package/dist/web/frontend/assets/callback-83Lr1QFW.js +0 -7
- package/dist/web/frontend/assets/common-BkYw_tO_.js +0 -31
- package/dist/web/frontend/assets/editParty-DU9eMclk.js +0 -15
- package/dist/web/frontend/assets/identityProviders-sWmbKlSu.js +0 -71
- package/dist/web/frontend/assets/index-AvzB2hln.js +0 -93
- package/dist/web/frontend/assets/index-BF3EIXoM.js +0 -2
- package/dist/web/frontend/assets/index-CGK8ht7_.js +0 -1
- package/dist/web/frontend/assets/index-DRQ0oWml.js +0 -4814
- package/dist/web/frontend/assets/index-NgSpx7q_.js +0 -3
- package/dist/web/frontend/assets/login-BqK1nbQm.js +0 -11
- package/dist/web/frontend/assets/networks-C62lWsP4.js +0 -73
- package/dist/web/frontend/assets/reviewIdentityProvider-pILqo6EV.js +0 -43
- package/dist/web/frontend/assets/reviewNetwork-DZOWqkuG.js +0 -43
- package/dist/web/frontend/assets/selfIssuedLogin-DarXIpvS.js +0 -81
- package/dist/web/frontend/assets/signMessage-k9b_lLxh.js +0 -23
package/README.md
CHANGED
|
@@ -181,7 +181,7 @@ $ docker run --network=host --name some-postgres -e POSTGRES_PASSWORD=postgres -
|
|
|
181
181
|
"store": {
|
|
182
182
|
"connection": {
|
|
183
183
|
"type": "postgres",
|
|
184
|
-
"
|
|
184
|
+
"passwordEnv": "WG_TEST_POSTGRES_PASSWORD",
|
|
185
185
|
"port": 5432,
|
|
186
186
|
"user": "postgres",
|
|
187
187
|
"host": "0.0.0.0",
|
|
@@ -191,7 +191,7 @@ $ docker run --network=host --name some-postgres -e POSTGRES_PASSWORD=postgres -
|
|
|
191
191
|
"signingStore": {
|
|
192
192
|
"connection": {
|
|
193
193
|
"type": "postgres",
|
|
194
|
-
"
|
|
194
|
+
"passwordEnv": "WG_TEST_POSTGRES_PASSWORD",
|
|
195
195
|
"port": 5432,
|
|
196
196
|
"user": "postgres",
|
|
197
197
|
"host": "0.0.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-auth-service.d.ts","sourceRoot":"","sources":["../../src/auth/jwt-auth-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,KAAK,WAAW,EAKnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AAa9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"jwt-auth-service.d.ts","sourceRoot":"","sources":["../../src/auth/jwt-auth-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,KAAK,WAAW,EAKnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAA;AAa9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAkOlC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,UAAW,KAAK,UAAU,MAAM,KAAG,WAsL7D,CAAA"}
|
|
@@ -8,6 +8,18 @@ function getEmail(value) {
|
|
|
8
8
|
}
|
|
9
9
|
return value;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* App-only access tokens, such as Entra ID client-credentials tokens, carry
|
|
13
|
+
* application permissions in `roles` and omit `scope` and `scp`. The claim
|
|
14
|
+
* values are not matched; a non-empty role is enough, same as scope.
|
|
15
|
+
*/
|
|
16
|
+
function hasRolesClaim(roles) {
|
|
17
|
+
if (typeof roles === 'string') {
|
|
18
|
+
return roles.length > 0;
|
|
19
|
+
}
|
|
20
|
+
return (Array.isArray(roles) &&
|
|
21
|
+
roles.some((role) => typeof role === 'string' && role.length > 0));
|
|
22
|
+
}
|
|
11
23
|
/**
|
|
12
24
|
* Verifies a self-signed token against the secret of the network named by
|
|
13
25
|
* the `kid` header, and rejects it if that network belongs to another IDP.
|
|
@@ -222,8 +234,10 @@ export const jwtAuthService = (store, logger) => {
|
|
|
222
234
|
logger.warn(`No identity provider found for issuer: ${iss}`);
|
|
223
235
|
return undefined;
|
|
224
236
|
}
|
|
225
|
-
if (!decoded.scope &&
|
|
226
|
-
|
|
237
|
+
if (!decoded.scope &&
|
|
238
|
+
!decoded.scp &&
|
|
239
|
+
!hasRolesClaim(decoded.roles)) {
|
|
240
|
+
logger.warn('JWT does not contain a scope or roles claim');
|
|
227
241
|
return undefined;
|
|
228
242
|
}
|
|
229
243
|
if (idp.type == 'self_signed') {
|
package/dist/config/Config.d.ts
CHANGED
|
@@ -180,7 +180,171 @@ export declare const rawConfigSchema: z.ZodObject<{
|
|
|
180
180
|
accessTokenEnv: z.ZodDefault<z.ZodString>;
|
|
181
181
|
}, z.core.$strip>>;
|
|
182
182
|
}, z.core.$strip>>;
|
|
183
|
-
|
|
183
|
+
idps: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
184
|
+
id: z.ZodString;
|
|
185
|
+
type: z.ZodLiteral<"self_signed">;
|
|
186
|
+
issuer: z.ZodString;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
type: z.ZodLiteral<"self_issued">;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
id: z.ZodString;
|
|
192
|
+
type: z.ZodLiteral<"oauth">;
|
|
193
|
+
issuer: z.ZodString;
|
|
194
|
+
configUrl: z.ZodURL;
|
|
195
|
+
}, z.core.$strip>], "type">>>;
|
|
196
|
+
networks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
name: z.ZodString;
|
|
199
|
+
description: z.ZodString;
|
|
200
|
+
synchronizerId: z.ZodOptional<z.ZodString>;
|
|
201
|
+
identityProviderId: z.ZodString;
|
|
202
|
+
ledgerApi: z.ZodObject<{
|
|
203
|
+
baseUrl: z.ZodURL;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
auth: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
206
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
207
|
+
audience: z.ZodString;
|
|
208
|
+
scope: z.ZodString;
|
|
209
|
+
clientId: z.ZodString;
|
|
210
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
211
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
212
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
213
|
+
audience: z.ZodString;
|
|
214
|
+
scope: z.ZodString;
|
|
215
|
+
clientId: z.ZodString;
|
|
216
|
+
clientSecret: z.ZodString;
|
|
217
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
218
|
+
method: z.ZodLiteral<"self_signed">;
|
|
219
|
+
issuer: z.ZodString;
|
|
220
|
+
audience: z.ZodString;
|
|
221
|
+
scope: z.ZodString;
|
|
222
|
+
clientId: z.ZodString;
|
|
223
|
+
clientSecret: z.ZodString;
|
|
224
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
225
|
+
method: z.ZodLiteral<"self_issued">;
|
|
226
|
+
audience: z.ZodString;
|
|
227
|
+
scope: z.ZodString;
|
|
228
|
+
}, z.core.$strip>], "method">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
229
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
230
|
+
audience: z.ZodString;
|
|
231
|
+
scope: z.ZodString;
|
|
232
|
+
clientId: z.ZodString;
|
|
233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
234
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
235
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
236
|
+
audience: z.ZodString;
|
|
237
|
+
scope: z.ZodString;
|
|
238
|
+
clientId: z.ZodString;
|
|
239
|
+
clientSecretEnv: z.ZodString;
|
|
240
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
241
|
+
method: z.ZodLiteral<"self_signed">;
|
|
242
|
+
issuer: z.ZodString;
|
|
243
|
+
audience: z.ZodString;
|
|
244
|
+
scope: z.ZodString;
|
|
245
|
+
clientId: z.ZodString;
|
|
246
|
+
clientSecretEnv: z.ZodString;
|
|
247
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
248
|
+
method: z.ZodLiteral<"self_issued">;
|
|
249
|
+
audience: z.ZodString;
|
|
250
|
+
scope: z.ZodString;
|
|
251
|
+
}, z.core.$strip>], "method">]>;
|
|
252
|
+
adminAuth: z.ZodOptional<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
253
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
254
|
+
audience: z.ZodString;
|
|
255
|
+
scope: z.ZodString;
|
|
256
|
+
clientId: z.ZodString;
|
|
257
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
258
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
259
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
260
|
+
audience: z.ZodString;
|
|
261
|
+
scope: z.ZodString;
|
|
262
|
+
clientId: z.ZodString;
|
|
263
|
+
clientSecret: z.ZodString;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
method: z.ZodLiteral<"self_signed">;
|
|
266
|
+
issuer: z.ZodString;
|
|
267
|
+
audience: z.ZodString;
|
|
268
|
+
scope: z.ZodString;
|
|
269
|
+
clientId: z.ZodString;
|
|
270
|
+
clientSecret: z.ZodString;
|
|
271
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
272
|
+
method: z.ZodLiteral<"self_issued">;
|
|
273
|
+
audience: z.ZodString;
|
|
274
|
+
scope: z.ZodString;
|
|
275
|
+
}, z.core.$strip>], "method">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
276
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
277
|
+
audience: z.ZodString;
|
|
278
|
+
scope: z.ZodString;
|
|
279
|
+
clientId: z.ZodString;
|
|
280
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
281
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
282
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
283
|
+
audience: z.ZodString;
|
|
284
|
+
scope: z.ZodString;
|
|
285
|
+
clientId: z.ZodString;
|
|
286
|
+
clientSecretEnv: z.ZodString;
|
|
287
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
288
|
+
method: z.ZodLiteral<"self_signed">;
|
|
289
|
+
issuer: z.ZodString;
|
|
290
|
+
audience: z.ZodString;
|
|
291
|
+
scope: z.ZodString;
|
|
292
|
+
clientId: z.ZodString;
|
|
293
|
+
clientSecretEnv: z.ZodString;
|
|
294
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
295
|
+
method: z.ZodLiteral<"self_issued">;
|
|
296
|
+
audience: z.ZodString;
|
|
297
|
+
scope: z.ZodString;
|
|
298
|
+
}, z.core.$strip>], "method">]>>;
|
|
299
|
+
serviceAccountAuth: z.ZodOptional<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
300
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
301
|
+
audience: z.ZodString;
|
|
302
|
+
scope: z.ZodString;
|
|
303
|
+
clientId: z.ZodString;
|
|
304
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
305
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
306
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
307
|
+
audience: z.ZodString;
|
|
308
|
+
scope: z.ZodString;
|
|
309
|
+
clientId: z.ZodString;
|
|
310
|
+
clientSecret: z.ZodString;
|
|
311
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
312
|
+
method: z.ZodLiteral<"self_signed">;
|
|
313
|
+
issuer: z.ZodString;
|
|
314
|
+
audience: z.ZodString;
|
|
315
|
+
scope: z.ZodString;
|
|
316
|
+
clientId: z.ZodString;
|
|
317
|
+
clientSecret: z.ZodString;
|
|
318
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
319
|
+
method: z.ZodLiteral<"self_issued">;
|
|
320
|
+
audience: z.ZodString;
|
|
321
|
+
scope: z.ZodString;
|
|
322
|
+
}, z.core.$strip>], "method">, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
323
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
324
|
+
audience: z.ZodString;
|
|
325
|
+
scope: z.ZodString;
|
|
326
|
+
clientId: z.ZodString;
|
|
327
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
328
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
329
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
330
|
+
audience: z.ZodString;
|
|
331
|
+
scope: z.ZodString;
|
|
332
|
+
clientId: z.ZodString;
|
|
333
|
+
clientSecretEnv: z.ZodString;
|
|
334
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
335
|
+
method: z.ZodLiteral<"self_signed">;
|
|
336
|
+
issuer: z.ZodString;
|
|
337
|
+
audience: z.ZodString;
|
|
338
|
+
scope: z.ZodString;
|
|
339
|
+
clientId: z.ZodString;
|
|
340
|
+
clientSecretEnv: z.ZodString;
|
|
341
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
342
|
+
method: z.ZodLiteral<"self_issued">;
|
|
343
|
+
audience: z.ZodString;
|
|
344
|
+
scope: z.ZodString;
|
|
345
|
+
}, z.core.$strip>], "method">]>>;
|
|
346
|
+
}, z.core.$strip>>>;
|
|
347
|
+
bootstrap: z.ZodOptional<z.ZodObject<{
|
|
184
348
|
idps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
185
349
|
id: z.ZodString;
|
|
186
350
|
type: z.ZodLiteral<"self_signed">;
|
|
@@ -345,7 +509,7 @@ export declare const rawConfigSchema: z.ZodObject<{
|
|
|
345
509
|
scope: z.ZodString;
|
|
346
510
|
}, z.core.$strip>], "method">]>>;
|
|
347
511
|
}, z.core.$strip>>;
|
|
348
|
-
}, z.core.$strip
|
|
512
|
+
}, z.core.$strip>>;
|
|
349
513
|
hashingScheme: z.ZodOptional<z.ZodObject<{
|
|
350
514
|
version: z.ZodEnum<{
|
|
351
515
|
HASHING_SCHEME_VERSION_V2: "HASHING_SCHEME_VERSION_V2";
|
|
@@ -473,6 +637,101 @@ export declare const configSchema: z.ZodObject<{
|
|
|
473
637
|
accessTokenEnv: z.ZodDefault<z.ZodString>;
|
|
474
638
|
}, z.core.$strip>>;
|
|
475
639
|
}, z.core.$strip>>;
|
|
640
|
+
idps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
641
|
+
id: z.ZodString;
|
|
642
|
+
type: z.ZodLiteral<"self_signed">;
|
|
643
|
+
issuer: z.ZodString;
|
|
644
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
645
|
+
id: z.ZodString;
|
|
646
|
+
type: z.ZodLiteral<"self_issued">;
|
|
647
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
648
|
+
id: z.ZodString;
|
|
649
|
+
type: z.ZodLiteral<"oauth">;
|
|
650
|
+
issuer: z.ZodString;
|
|
651
|
+
configUrl: z.ZodURL;
|
|
652
|
+
}, z.core.$strip>], "type">>;
|
|
653
|
+
networks: z.ZodArray<z.ZodObject<{
|
|
654
|
+
id: z.ZodString;
|
|
655
|
+
name: z.ZodString;
|
|
656
|
+
description: z.ZodString;
|
|
657
|
+
synchronizerId: z.ZodOptional<z.ZodString>;
|
|
658
|
+
identityProviderId: z.ZodString;
|
|
659
|
+
ledgerApi: z.ZodObject<{
|
|
660
|
+
baseUrl: z.ZodURL;
|
|
661
|
+
}, z.core.$strip>;
|
|
662
|
+
auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
663
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
664
|
+
audience: z.ZodString;
|
|
665
|
+
scope: z.ZodString;
|
|
666
|
+
clientId: z.ZodString;
|
|
667
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
668
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
669
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
670
|
+
audience: z.ZodString;
|
|
671
|
+
scope: z.ZodString;
|
|
672
|
+
clientId: z.ZodString;
|
|
673
|
+
clientSecret: z.ZodString;
|
|
674
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
675
|
+
method: z.ZodLiteral<"self_signed">;
|
|
676
|
+
issuer: z.ZodString;
|
|
677
|
+
audience: z.ZodString;
|
|
678
|
+
scope: z.ZodString;
|
|
679
|
+
clientId: z.ZodString;
|
|
680
|
+
clientSecret: z.ZodString;
|
|
681
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
682
|
+
method: z.ZodLiteral<"self_issued">;
|
|
683
|
+
audience: z.ZodString;
|
|
684
|
+
scope: z.ZodString;
|
|
685
|
+
}, z.core.$strip>], "method">;
|
|
686
|
+
adminAuth: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
687
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
688
|
+
audience: z.ZodString;
|
|
689
|
+
scope: z.ZodString;
|
|
690
|
+
clientId: z.ZodString;
|
|
691
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
692
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
693
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
694
|
+
audience: z.ZodString;
|
|
695
|
+
scope: z.ZodString;
|
|
696
|
+
clientId: z.ZodString;
|
|
697
|
+
clientSecret: z.ZodString;
|
|
698
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
699
|
+
method: z.ZodLiteral<"self_signed">;
|
|
700
|
+
issuer: z.ZodString;
|
|
701
|
+
audience: z.ZodString;
|
|
702
|
+
scope: z.ZodString;
|
|
703
|
+
clientId: z.ZodString;
|
|
704
|
+
clientSecret: z.ZodString;
|
|
705
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
706
|
+
method: z.ZodLiteral<"self_issued">;
|
|
707
|
+
audience: z.ZodString;
|
|
708
|
+
scope: z.ZodString;
|
|
709
|
+
}, z.core.$strip>], "method">>;
|
|
710
|
+
serviceAccountAuth: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
711
|
+
method: z.ZodLiteral<"authorization_code">;
|
|
712
|
+
audience: z.ZodString;
|
|
713
|
+
scope: z.ZodString;
|
|
714
|
+
clientId: z.ZodString;
|
|
715
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
716
|
+
method: z.ZodLiteral<"client_credentials">;
|
|
717
|
+
identityProviderId: z.ZodOptional<z.ZodString>;
|
|
718
|
+
audience: z.ZodString;
|
|
719
|
+
scope: z.ZodString;
|
|
720
|
+
clientId: z.ZodString;
|
|
721
|
+
clientSecret: z.ZodString;
|
|
722
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
723
|
+
method: z.ZodLiteral<"self_signed">;
|
|
724
|
+
issuer: z.ZodString;
|
|
725
|
+
audience: z.ZodString;
|
|
726
|
+
scope: z.ZodString;
|
|
727
|
+
clientId: z.ZodString;
|
|
728
|
+
clientSecret: z.ZodString;
|
|
729
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
730
|
+
method: z.ZodLiteral<"self_issued">;
|
|
731
|
+
audience: z.ZodString;
|
|
732
|
+
scope: z.ZodString;
|
|
733
|
+
}, z.core.$strip>], "method">>;
|
|
734
|
+
}, z.core.$strip>>;
|
|
476
735
|
bootstrap: z.ZodObject<{
|
|
477
736
|
idps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
478
737
|
id: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB,eAAO,MAAM,gBAAgB;;;;iBAY3B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;iBAyD7B,CAAA;AAgEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkJnC,CAAA;AAcN,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW1B,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWvB,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,sBAAsB,GAAG,CAAC,CAAC,KAAK,CACxC,OAAO,4BAA4B,CACtC,CAAA;AACD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
package/dist/config/Config.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { storeConfigSchema, bootstrapConfigSchema, networkSchema, } from '@canton-network/core-wallet-store';
|
|
5
5
|
import { storeConfigSchema as signingStoreConfigSchema } from '@canton-network/core-signing-store-sql';
|
|
6
|
-
import { authFromEnvSchema, authSchema } from '@canton-network/core-wallet-auth';
|
|
6
|
+
import { authFromEnvSchema, authSchema, idpSchema, } from '@canton-network/core-wallet-auth';
|
|
7
7
|
import { cantonCaip2Values } from '@canton-network/core-signing-blockdaemon';
|
|
8
8
|
export const kernelInfoSchema = z.object({
|
|
9
9
|
id: z.string(),
|
|
@@ -33,10 +33,10 @@ export const serverConfigSchema = z.object({
|
|
|
33
33
|
.meta({
|
|
34
34
|
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.',
|
|
35
35
|
}),
|
|
36
|
-
// @deprecated, the NodeJS server always
|
|
36
|
+
// @deprecated, the NodeJS server always listens on all network interfaces
|
|
37
37
|
host: z.string().optional().meta({
|
|
38
38
|
deprecated: true,
|
|
39
|
-
description: 'The host interface the server binds to. Deprecated as the service always
|
|
39
|
+
description: 'The host interface the server binds to. Deprecated as the service always listens on all network interfaces. Will be removed in a future release.',
|
|
40
40
|
}),
|
|
41
41
|
// @deprecated since this field does not actually control TLS termination
|
|
42
42
|
tls: z.boolean().optional().meta({
|
|
@@ -56,7 +56,7 @@ export const serverConfigSchema = z.object({
|
|
|
56
56
|
description: 'Express trust proxy setting used to resolve client IP addresses when running behind reverse proxies/load balancers. Set this correctly in production (for example 1 for a single trusted proxy hop). Defaults to false.',
|
|
57
57
|
}),
|
|
58
58
|
admin: z.string().optional().meta({
|
|
59
|
-
description: 'The
|
|
59
|
+
description: 'The user ID of the admin user: the value of the JWT "sub" claim, or of "daml.com.usr" for self-issued tokens. If set, requests from this user will be granted admin privileges.',
|
|
60
60
|
}),
|
|
61
61
|
signingWorker: z
|
|
62
62
|
.object({
|
|
@@ -82,12 +82,29 @@ const loggingConfigSchema = z
|
|
|
82
82
|
description: 'Optional logging configuration. If omitted, defaults will be used.',
|
|
83
83
|
});
|
|
84
84
|
const authFromEnvOrConfig = z.union([authSchema, authFromEnvSchema]);
|
|
85
|
-
const bootstrapFromEnv = bootstrapConfigSchema
|
|
85
|
+
const bootstrapFromEnv = bootstrapConfigSchema
|
|
86
|
+
.extend({
|
|
86
87
|
networks: z.array(networkSchema.extend({
|
|
87
88
|
auth: authFromEnvOrConfig,
|
|
88
89
|
adminAuth: authFromEnvOrConfig.optional(),
|
|
89
90
|
serviceAccountAuth: authFromEnvOrConfig.optional(),
|
|
90
91
|
})),
|
|
92
|
+
})
|
|
93
|
+
.optional()
|
|
94
|
+
.meta({
|
|
95
|
+
deprecated: true,
|
|
96
|
+
description: 'Deprecated, use the top-level idps and networks instead. Identity providers and networks that are only written to the database if it is empty. Move an entry to idps or networks with the same id to keep its existing wallets. Will be removed in a future release.',
|
|
97
|
+
});
|
|
98
|
+
const configNetworkSchema = networkSchema.extend({
|
|
99
|
+
auth: authFromEnvOrConfig,
|
|
100
|
+
adminAuth: authFromEnvOrConfig.optional(),
|
|
101
|
+
serviceAccountAuth: authFromEnvOrConfig.optional(),
|
|
102
|
+
});
|
|
103
|
+
const configIdpsSchema = z.array(idpSchema).default([]).meta({
|
|
104
|
+
description: 'Identity providers managed by this config file. They are written to the database on every start and cannot be changed at runtime.',
|
|
105
|
+
});
|
|
106
|
+
const configNetworksSchema = z.array(configNetworkSchema).default([]).meta({
|
|
107
|
+
description: 'Networks managed by this config file. They are written to the database on every start and cannot be changed at runtime. Each network must reference an identity provider from idps.',
|
|
91
108
|
});
|
|
92
109
|
const secretEnvName = (defaultName, purpose) => z
|
|
93
110
|
.string()
|
|
@@ -215,6 +232,8 @@ export const rawConfigSchema = z.object({
|
|
|
215
232
|
store: storeConfigSchema,
|
|
216
233
|
signingStore: signingStoreConfigSchema.optional(),
|
|
217
234
|
signingProviders: signingProvidersConfigSchema.optional(),
|
|
235
|
+
idps: configIdpsSchema,
|
|
236
|
+
networks: configNetworksSchema,
|
|
218
237
|
bootstrap: bootstrapFromEnv,
|
|
219
238
|
hashingScheme: hashingSchemeSchema,
|
|
220
239
|
});
|
|
@@ -225,6 +244,8 @@ export const configSchema = z.object({
|
|
|
225
244
|
store: storeConfigSchema,
|
|
226
245
|
signingStore: signingStoreConfigSchema.optional(),
|
|
227
246
|
signingProviders: signingProvidersConfigSchema.optional(),
|
|
247
|
+
idps: z.array(idpSchema),
|
|
248
|
+
networks: z.array(networkSchema),
|
|
228
249
|
bootstrap: bootstrapConfigSchema,
|
|
229
250
|
hashingScheme: hashingSchemeSchema,
|
|
230
251
|
});
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { type Config } from './Config.js';
|
|
2
|
+
import type { ServerNoticeReport } from '../notices/server-notices.js';
|
|
3
|
+
export interface LoadedConfig {
|
|
4
|
+
config: Config;
|
|
5
|
+
warnings: ServerNoticeReport[];
|
|
6
|
+
}
|
|
2
7
|
export declare class ConfigUtils {
|
|
3
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Loads and validates the config file. Invalid configs throw, while
|
|
10
|
+
* configs that work but need attention are returned as warnings.
|
|
11
|
+
*/
|
|
12
|
+
static loadConfigFile(filePath: string): LoadedConfig;
|
|
13
|
+
static parseConfig(json: unknown): LoadedConfig;
|
|
4
14
|
}
|
|
5
15
|
interface Urls {
|
|
6
16
|
serviceUrl: string;
|
|
@@ -8,6 +18,11 @@ interface Urls {
|
|
|
8
18
|
dappApiUrl: string;
|
|
9
19
|
userApiUrl: string;
|
|
10
20
|
}
|
|
21
|
+
export interface ConfigManagedIds {
|
|
22
|
+
idpIds: ReadonlySet<string>;
|
|
23
|
+
networkIds: ReadonlySet<string>;
|
|
24
|
+
}
|
|
25
|
+
export declare const configManagedIds: (config: Config) => ConfigManagedIds;
|
|
11
26
|
export declare const deriveUrls: (config: Config, port?: number) => Urls;
|
|
12
27
|
export {};
|
|
13
28
|
//# 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,KAAK,MAAM,EAAmC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"ConfigUtils.d.ts","sourceRoot":"","sources":["../../src/config/ConfigUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAmC,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAQtE,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAA;IAEd,QAAQ,EAAE,kBAAkB,EAAE,CAAA;CACjC;AAED,qBAAa,WAAW;IACpB;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAOpD;IAED,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAM9C;CACJ;AAwUD,UAAU,IAAI;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACrB;AAQD,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3B,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAClC;AAED,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,gBAGhD,CAAA;AAEF,eAAO,MAAM,UAAU,WAAY,MAAM,SAAS,MAAM,KAAG,IAa1D,CAAA"}
|