@eudiplo/cli 10.1.0-main.cdfd658 → 10.1.0-main.d5e40bd

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.
Files changed (37) hide show
  1. package/dist/commands/config/portability/action.d.ts.map +1 -1
  2. package/dist/commands/config/portability/action.js +25 -1
  3. package/dist/commands/config/portability/action.js.map +1 -1
  4. package/dist/commands/config/portability/folder-bundle.d.ts +3 -1
  5. package/dist/commands/config/portability/folder-bundle.d.ts.map +1 -1
  6. package/dist/commands/config/portability/folder-bundle.js +18 -7
  7. package/dist/commands/config/portability/folder-bundle.js.map +1 -1
  8. package/dist/commands/config/portability/migrations.d.ts +4 -0
  9. package/dist/commands/config/portability/migrations.d.ts.map +1 -1
  10. package/dist/commands/config/portability/migrations.js +6 -2
  11. package/dist/commands/config/portability/migrations.js.map +1 -1
  12. package/dist/commands/config/validate/action.d.ts.map +1 -1
  13. package/dist/commands/config/validate/action.js +6 -2
  14. package/dist/commands/config/validate/action.js.map +1 -1
  15. package/dist/commands/config/validate/validator.d.ts +17 -1
  16. package/dist/commands/config/validate/validator.d.ts.map +1 -1
  17. package/dist/commands/config/validate/validator.js +101 -15
  18. package/dist/commands/config/validate/validator.js.map +1 -1
  19. package/dist/index.js +1428 -220
  20. package/dist/services/backend-checks.d.ts +10 -1
  21. package/dist/services/backend-checks.d.ts.map +1 -1
  22. package/dist/services/backend-checks.js +38 -1
  23. package/dist/services/backend-checks.js.map +1 -1
  24. package/dist/services/diagnostics.js +1 -1
  25. package/dist/services/diagnostics.js.map +1 -1
  26. package/package.json +1 -1
  27. package/templates/demo-config/clients/presentation-test.json +1 -2
  28. package/templates/demo-config/clients/test.json +1 -1
  29. package/templates/demo-config/presentation/age-over-18.json +1 -1
  30. package/templates/demo-config/presentation/pid.json +1 -1
  31. package/templates/docker-compose.yml +1 -1
  32. package/templates/schemas/ClientConfigFile.schema.json +138 -1
  33. package/templates/schemas/CreateClientDto.schema.json +4 -1
  34. package/templates/schemas/CreateTenantDto.schema.json +5 -2
  35. package/templates/schemas/PresentationConfigCreateDto.schema.json +4 -0
  36. package/templates/schemas/PresentationConfigFile.schema.json +797 -1
  37. package/templates/schemas/UpdateClientDto.schema.json +4 -1
package/dist/index.js CHANGED
@@ -7515,8 +7515,8 @@ var require_formats = __commonJS({
7515
7515
  "use strict";
7516
7516
  Object.defineProperty(exports, "__esModule", { value: true });
7517
7517
  exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
7518
- function fmtDef(validate, compare) {
7519
- return { validate, compare };
7518
+ function fmtDef(validate, compare2) {
7519
+ return { validate, compare: compare2 };
7520
7520
  }
7521
7521
  exports.fullFormats = {
7522
7522
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
@@ -20824,10 +20824,42 @@ function isTrustListEmail(value) {
20824
20824
  return EMAIL.test(value);
20825
20825
  }
20826
20826
 
20827
+ // ../../packages/eudiplo-config-format/dist/client-roles.js
20828
+ var ADMIN_ROLES = ["tenant:admin", "tenants:manage"];
20829
+ var ADDED_ROLES = [
20830
+ { role: "audit:read", for: ["clients:manage"] },
20831
+ { role: "keys:manage", for: ["issuance:manage", "presentation:manage"] }
20832
+ ];
20833
+ var NARROWED_ROLES = ADDED_ROLES.flatMap((added) => added.for);
20834
+ function upgradeRolesToRoleModel11(roles) {
20835
+ if (roles.some((role) => ADMIN_ROLES.includes(role)))
20836
+ return [...roles];
20837
+ const result = [...roles];
20838
+ for (const added of ADDED_ROLES) {
20839
+ if (!result.includes(added.role) && added.for.some((role) => result.includes(role))) {
20840
+ result.push(added.role);
20841
+ }
20842
+ }
20843
+ return result;
20844
+ }
20845
+ function rolesBeforeRoleModel11(roles) {
20846
+ const candidates = [];
20847
+ const trailing = ADDED_ROLES.map((added) => added.role).reverse();
20848
+ let current = [...roles];
20849
+ for (const role of trailing) {
20850
+ if (current.at(-1) === role) {
20851
+ current = current.slice(0, -1);
20852
+ candidates.push(current);
20853
+ }
20854
+ }
20855
+ const same = (a, b) => a.length === b.length && a.every((role, index) => role === b[index]);
20856
+ return candidates.filter((candidate) => same(upgradeRolesToRoleModel11(candidate), roles));
20857
+ }
20858
+
20827
20859
  // ../../packages/eudiplo-config-format/dist/config-format.js
20828
20860
  var CONFIG_FORMATS = {
20829
20861
  Tenant: { slug: "tenant", file: "TenantConfigFile", version: 4 },
20830
- Client: { slug: "client", file: "ClientConfigFile", version: 2 },
20862
+ Client: { slug: "client", file: "ClientConfigFile", version: 3 },
20831
20863
  KmsConfig: { slug: "kms-config", file: "KmsConfigFile", version: 2 },
20832
20864
  KeyChain: { slug: "key-chain", file: "KeyChainConfigFile", version: 4 },
20833
20865
  KeyChainDefaults: {
@@ -20848,7 +20880,7 @@ var CONFIG_FORMATS = {
20848
20880
  PresentationConfig: {
20849
20881
  slug: "presentation-config",
20850
20882
  file: "PresentationConfigFile",
20851
- version: 5
20883
+ version: 6
20852
20884
  },
20853
20885
  AttributeProvider: {
20854
20886
  slug: "attribute-provider",
@@ -20916,6 +20948,8 @@ function bareFileVersion(kind, spec) {
20916
20948
  if (kind === "CredentialConfig")
20917
20949
  return hasClaimFieldFormat(spec.fields) ? 5 : 1;
20918
20950
  if (kind === "PresentationConfig") {
20951
+ if ("allowUntrustedIssuers" in spec)
20952
+ return 6;
20919
20953
  const certificate = spec.registration_cert;
20920
20954
  if (object(certificate) && ("purpose" in certificate || "privacy_policy" in certificate))
20921
20955
  return 5;
@@ -21266,6 +21300,32 @@ function registrationCertificateNotGenerated() {
21266
21300
  message: "EUDIPLO no longer generates issuer registration certificates at the sandbox registrar, so the issuer metadata carries none until registrationCertificate.jwt is set. Request one from the EUDI Hub (Issuer Settings \u2192 Request from EUDI Hub, or POST /api/eudi-hub/registration-certificate/issuer), or set the JWT from another registrar."
21267
21301
  };
21268
21302
  }
21303
+ var presentationConfigV5ToV6 = {
21304
+ id: "presentation-config-v6-allow-untrusted-issuers",
21305
+ kind: "PresentationConfig",
21306
+ from: 5,
21307
+ to: 6,
21308
+ migrate(spec) {
21309
+ if (spec.allowUntrustedIssuers === true)
21310
+ return { spec };
21311
+ const query = object(spec.dcql_query) ? spec.dcql_query : {};
21312
+ const credentials = Array.isArray(query.credentials) ? query.credentials : [];
21313
+ const missing = credentials.filter(object).filter((credential) => !(Array.isArray(credential.trusted_authorities) && credential.trusted_authorities.some((authority) => object(authority) && Array.isArray(authority.values) && authority.values.length > 0))).map((credential) => String(credential.id ?? ""));
21314
+ if (missing.length === 0)
21315
+ return { spec };
21316
+ return {
21317
+ spec,
21318
+ issues: [
21319
+ {
21320
+ severity: "required-input",
21321
+ code: "TRUSTED_AUTHORITY_REQUIRED",
21322
+ path: "/spec/dcql_query/credentials",
21323
+ message: `Credential queries without trusted_authorities: ${missing.join(", ")}. EUDIPLO 11.0 no longer reads SKIP_TRUST_AUTHORITY and refuses this configuration. Add a trust list or an OpenID Federation trust anchor to each, or set $schema to v6 and allowUntrustedIssuers to true to accept credentials of any issuer (development and interoperability tests only).`
21324
+ }
21325
+ ]
21326
+ };
21327
+ }
21328
+ };
21269
21329
  var PRESENTATION_REGISTRATION_CERT_FORM_FIELDS = [
21270
21330
  "registrationCertImportJwt",
21271
21331
  "registrationCertImportId",
@@ -21415,6 +21475,35 @@ var CONFIG_MIGRATIONS = [
21415
21475
  // and keys:manage: a v1 spec is a valid v2 spec.
21416
21476
  migrate: (spec) => ({ spec })
21417
21477
  },
21478
+ {
21479
+ id: "client-v3-role-model",
21480
+ kind: "Client",
21481
+ from: 2,
21482
+ to: 3,
21483
+ // 11.0 narrowed clients:manage and the issuance and presentation
21484
+ // manage roles; the client gets the roles that now hold their rights.
21485
+ migrate: (spec) => {
21486
+ if (!Array.isArray(spec.roles))
21487
+ return { spec };
21488
+ const before = spec.roles;
21489
+ const roles = upgradeRolesToRoleModel11(before);
21490
+ const added = roles.slice(before.length);
21491
+ if (added.length === 0)
21492
+ return { spec };
21493
+ return {
21494
+ spec: { ...spec, roles },
21495
+ issues: [
21496
+ {
21497
+ severity: "warning",
21498
+ code: "CLIENT_ROLES_ADDED",
21499
+ path: "/spec/roles",
21500
+ message: `Added ${added.join(" and ")} so the client keeps its access: clients:manage no longer reads the audit log, and issuance:manage and presentation:manage no longer change key chains. Remove them if the client does not need them.`
21501
+ }
21502
+ ]
21503
+ };
21504
+ },
21505
+ earlierSpecs: (spec) => Array.isArray(spec.roles) ? rolesBeforeRoleModel11(spec.roles).map((roles) => ({ ...spec, roles })) : []
21506
+ },
21418
21507
  {
21419
21508
  id: "kms-config-v2-algorithms",
21420
21509
  kind: "KmsConfig",
@@ -21539,6 +21628,7 @@ var CONFIG_MIGRATIONS = [
21539
21628
  migrate: (spec) => ({ spec })
21540
21629
  },
21541
21630
  presentationConfigV4ToV5,
21631
+ presentationConfigV5ToV6,
21542
21632
  trustListV1ToV2
21543
21633
  ];
21544
21634
  function schemaUrl(kind, version = CONFIG_FORMATS[kind].version) {
@@ -23315,6 +23405,120 @@ async function atomicWriteFile(path2, data) {
23315
23405
  }
23316
23406
  }
23317
23407
 
23408
+ // src/services/backend-checks.ts
23409
+ function compareVersions(cliVersion, backendVersion2) {
23410
+ const name = "version compatibility";
23411
+ const cli = parse3(cliVersion);
23412
+ const backend = parse3(backendVersion2);
23413
+ if (!cli || !backend) {
23414
+ return {
23415
+ name,
23416
+ status: "warn",
23417
+ message: `CLI ${cliVersion} and backend ${backendVersion2} cannot be compared as versions.`
23418
+ };
23419
+ }
23420
+ if (cli.major !== backend.major) {
23421
+ return {
23422
+ name,
23423
+ status: "fail",
23424
+ message: `CLI ${cliVersion} and backend ${backendVersion2} are different major versions. Install a matching CLI with npm install -g @eudiplo/cli@${backend.major}.`
23425
+ };
23426
+ }
23427
+ if (cli.minor !== backend.minor) {
23428
+ return {
23429
+ name,
23430
+ status: "warn",
23431
+ message: `CLI ${cliVersion} and backend ${backendVersion2} differ in minor version; some commands may not be supported.`
23432
+ };
23433
+ }
23434
+ if (compare(cli, LAST_RELEASE_WITHOUT_ESCAPED_FORM) > 0 && compare(backend, LAST_RELEASE_WITHOUT_ESCAPED_FORM) <= 0) {
23435
+ return {
23436
+ name,
23437
+ status: "warn",
23438
+ message: `CLI ${cliVersion} and backend ${backendVersion2} read the escaped form $\${ of configuration files differently; config plan and import of a tenant folder store values containing \${ or $\${ differently. Upgrade the backend to match the CLI.`
23439
+ };
23440
+ }
23441
+ return {
23442
+ name,
23443
+ status: "pass",
23444
+ message: `CLI ${cliVersion} matches backend ${backendVersion2}.`
23445
+ };
23446
+ }
23447
+ var LAST_RELEASE_WITHOUT_ESCAPED_FORM = {
23448
+ major: 10,
23449
+ minor: 1,
23450
+ patch: 0
23451
+ };
23452
+ function escapedFormWarning(backendVersion2) {
23453
+ const backend = backendVersion2 ? parse3(backendVersion2) : void 0;
23454
+ if (!backend || compare(backend, LAST_RELEASE_WITHOUT_ESCAPED_FORM) > 0)
23455
+ return void 0;
23456
+ return `Warning: the backend (${backendVersion2}) does not read the escaped form $\${ of configuration files, which this CLI sends: values containing \${ or $\${ will be stored differently from what the files say. Upgrade the CLI and the backend together.`;
23457
+ }
23458
+ function compare(left, right) {
23459
+ return left.major - right.major || left.minor - right.minor || left.patch - right.patch;
23460
+ }
23461
+ function readBackendVersion(body) {
23462
+ if (typeof body === "object" && body !== null && "version" in body) {
23463
+ const version = body.version;
23464
+ return typeof version === "string" && version ? version : void 0;
23465
+ }
23466
+ return void 0;
23467
+ }
23468
+ function readProviderHealth(body) {
23469
+ if (!Array.isArray(body)) {
23470
+ throw new Error("the provider health response was not a list");
23471
+ }
23472
+ return body.map((entry) => {
23473
+ const record = entry;
23474
+ return {
23475
+ providerId: String(record.providerId ?? "unknown"),
23476
+ type: String(record.type ?? "unknown"),
23477
+ ok: record.ok === true,
23478
+ latencyMs: typeof record.latencyMs === "number" ? record.latencyMs : void 0,
23479
+ error: typeof record.error === "string" ? record.error : void 0
23480
+ };
23481
+ });
23482
+ }
23483
+ function summarizeProviderHealth(providers) {
23484
+ const name = "KMS providers";
23485
+ if (providers.length === 0) {
23486
+ return {
23487
+ name,
23488
+ status: "warn",
23489
+ message: "No KMS providers are registered for this tenant."
23490
+ };
23491
+ }
23492
+ const failing = providers.filter((provider) => !provider.ok);
23493
+ if (failing.length > 0) {
23494
+ return {
23495
+ name,
23496
+ status: "fail",
23497
+ message: `${failing.length}/${providers.length} provider(s) unhealthy: ${failing.map(
23498
+ (provider) => `${provider.providerId} (${provider.type})${provider.error ? ", health check reported an error" : ""}`
23499
+ ).join(", ")}`
23500
+ };
23501
+ }
23502
+ return {
23503
+ name,
23504
+ status: "pass",
23505
+ message: `${providers.length} provider(s) healthy: ${providers.map(
23506
+ (provider) => `${provider.providerId} (${provider.type}${provider.latencyMs === void 0 ? "" : `, ${provider.latencyMs}ms`})`
23507
+ ).join(", ")}`
23508
+ };
23509
+ }
23510
+ function parse3(version) {
23511
+ const match = /^v?(\d+)\.(\d+)\.(\d+)/.exec(version.trim());
23512
+ if (!match) {
23513
+ return void 0;
23514
+ }
23515
+ return {
23516
+ major: Number(match[1]),
23517
+ minor: Number(match[2]),
23518
+ patch: Number(match[3])
23519
+ };
23520
+ }
23521
+
23318
23522
  // src/services/instance-selection.ts
23319
23523
  function resolveInstance(config, parsed) {
23320
23524
  const name = readStringFlag(parsed.flags, "instance") ?? config.defaultInstance;
@@ -33112,6 +33316,146 @@ var CONFIG_SCHEMAS = [
33112
33316
  }
33113
33317
  }
33114
33318
  },
33319
+ {
33320
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
33321
+ "$id": "https://eudiplo.dev/schemas/v3/ClientConfigFile.schema.json",
33322
+ "title": "ClientConfigFile",
33323
+ "type": "object",
33324
+ "properties": {
33325
+ "$schema": {
33326
+ "type": "string",
33327
+ "const": "https://eudiplo.dev/schemas/v3/ClientConfigFile.schema.json"
33328
+ },
33329
+ "metadata": {
33330
+ "type": "object",
33331
+ "properties": {
33332
+ "generation": {
33333
+ "type": "integer",
33334
+ "minimum": 1,
33335
+ "description": "Monotonically increasing configuration generation."
33336
+ },
33337
+ "ownership": {
33338
+ "type": "string",
33339
+ "enum": [
33340
+ "unmanaged",
33341
+ "file-managed"
33342
+ ],
33343
+ "description": "Requested ownership recorded when the document is applied."
33344
+ }
33345
+ },
33346
+ "additionalProperties": false
33347
+ },
33348
+ "spec": {
33349
+ "allOf": [
33350
+ {
33351
+ "$ref": "#/$defs/CreateClientDto"
33352
+ },
33353
+ {
33354
+ "type": "object",
33355
+ "required": [
33356
+ "clientId"
33357
+ ],
33358
+ "properties": {
33359
+ "clientId": {
33360
+ "type": "string",
33361
+ "minLength": 1
33362
+ }
33363
+ }
33364
+ }
33365
+ ]
33366
+ }
33367
+ },
33368
+ "required": [
33369
+ "$schema",
33370
+ "spec"
33371
+ ],
33372
+ "additionalProperties": false,
33373
+ "$defs": {
33374
+ "CreateClientDto": {
33375
+ "type": "object",
33376
+ "properties": {
33377
+ "clientId": {
33378
+ "type": "string",
33379
+ "minLength": 1,
33380
+ "pattern": "^[A-Za-z0-9._:-]+$",
33381
+ "description": "Unique client identifier."
33382
+ },
33383
+ "secret": {
33384
+ "description": "Optional client secret for confidential clients.",
33385
+ "type": "string",
33386
+ "minLength": 1
33387
+ },
33388
+ "description": {
33389
+ "description": "Optional human-readable client description.",
33390
+ "type": "string",
33391
+ "minLength": 1
33392
+ },
33393
+ "roles": {
33394
+ "minItems": 1,
33395
+ "type": "array",
33396
+ "items": {
33397
+ "type": "string",
33398
+ "enum": [
33399
+ "presentation:manage",
33400
+ "presentation:request",
33401
+ "presentation:read",
33402
+ "issuance:manage",
33403
+ "issuance:offer",
33404
+ "issuance:read",
33405
+ "clients:manage",
33406
+ "users:manage",
33407
+ "tenants:manage",
33408
+ "tenant:admin",
33409
+ "registrar:manage",
33410
+ "audit:read",
33411
+ "sessions:read",
33412
+ "credentials:status",
33413
+ "keys:manage",
33414
+ "keys:export"
33415
+ ]
33416
+ },
33417
+ "description": "Roles assigned to the client. At least one role is required."
33418
+ },
33419
+ "allowedPresentationConfigs": {
33420
+ "description": "Optional allow-list of presentation config ids this client can use.",
33421
+ "anyOf": [
33422
+ {
33423
+ "type": "array",
33424
+ "items": {
33425
+ "type": "string",
33426
+ "minLength": 1
33427
+ }
33428
+ },
33429
+ {
33430
+ "type": "null"
33431
+ }
33432
+ ]
33433
+ },
33434
+ "allowedIssuanceConfigs": {
33435
+ "description": "Optional allow-list of issuance config ids this client can use.",
33436
+ "anyOf": [
33437
+ {
33438
+ "type": "array",
33439
+ "items": {
33440
+ "type": "string",
33441
+ "minLength": 1
33442
+ }
33443
+ },
33444
+ {
33445
+ "type": "null"
33446
+ }
33447
+ ]
33448
+ }
33449
+ },
33450
+ "required": [
33451
+ "clientId",
33452
+ "roles"
33453
+ ],
33454
+ "additionalProperties": false,
33455
+ "title": "CreateClientDto"
33456
+ }
33457
+ }
33458
+ },
33115
33459
  {
33116
33460
  "$schema": "https://json-schema.org/draft/2020-12/schema",
33117
33461
  "$id": "https://eudiplo.dev/schemas/v3/CredentialConfigFile.schema.json",
@@ -42692,6 +43036,806 @@ var CONFIG_SCHEMAS = [
42692
43036
  }
42693
43037
  }
42694
43038
  },
43039
+ {
43040
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
43041
+ "$id": "https://eudiplo.dev/schemas/v6/PresentationConfigFile.schema.json",
43042
+ "title": "PresentationConfigFile",
43043
+ "type": "object",
43044
+ "properties": {
43045
+ "$schema": {
43046
+ "type": "string",
43047
+ "const": "https://eudiplo.dev/schemas/v6/PresentationConfigFile.schema.json"
43048
+ },
43049
+ "metadata": {
43050
+ "type": "object",
43051
+ "properties": {
43052
+ "generation": {
43053
+ "type": "integer",
43054
+ "minimum": 1,
43055
+ "description": "Monotonically increasing configuration generation."
43056
+ },
43057
+ "ownership": {
43058
+ "type": "string",
43059
+ "enum": [
43060
+ "unmanaged",
43061
+ "file-managed"
43062
+ ],
43063
+ "description": "Requested ownership recorded when the document is applied."
43064
+ }
43065
+ },
43066
+ "additionalProperties": false
43067
+ },
43068
+ "spec": {
43069
+ "allOf": [
43070
+ {
43071
+ "$ref": "#/$defs/PresentationConfigCreateDto"
43072
+ },
43073
+ {
43074
+ "type": "object",
43075
+ "required": [
43076
+ "id"
43077
+ ],
43078
+ "properties": {
43079
+ "id": {
43080
+ "type": "string",
43081
+ "minLength": 1
43082
+ }
43083
+ }
43084
+ }
43085
+ ]
43086
+ }
43087
+ },
43088
+ "required": [
43089
+ "$schema",
43090
+ "spec"
43091
+ ],
43092
+ "additionalProperties": false,
43093
+ "$defs": {
43094
+ "PresentationConfigCreateDto": {
43095
+ "type": "object",
43096
+ "properties": {
43097
+ "id": {
43098
+ "type": "string",
43099
+ "minLength": 1,
43100
+ "description": "Presentation configuration identifier."
43101
+ },
43102
+ "description": {
43103
+ "description": "Optional presentation configuration description.",
43104
+ "type": [
43105
+ "string",
43106
+ "null"
43107
+ ]
43108
+ },
43109
+ "lifeTime": {
43110
+ "description": "Presentation request lifetime in seconds.",
43111
+ "type": "integer",
43112
+ "minimum": 1,
43113
+ "maximum": 9007199254740991
43114
+ },
43115
+ "skewSeconds": {
43116
+ "description": "Clock skew tolerance in seconds.",
43117
+ "type": "integer",
43118
+ "minimum": 0,
43119
+ "maximum": 9007199254740991
43120
+ },
43121
+ "statusCheckMode": {
43122
+ "description": "Revocation/status check mode.",
43123
+ "type": "string",
43124
+ "enum": [
43125
+ "strict",
43126
+ "best_effort",
43127
+ "disabled"
43128
+ ]
43129
+ },
43130
+ "dcql_query": {
43131
+ "type": "object",
43132
+ "properties": {
43133
+ "credentials": {
43134
+ "minItems": 1,
43135
+ "type": "array",
43136
+ "items": {
43137
+ "oneOf": [
43138
+ {
43139
+ "type": "object",
43140
+ "properties": {
43141
+ "id": {
43142
+ "type": "string",
43143
+ "minLength": 1,
43144
+ "pattern": "^[A-Za-z0-9_-]+$",
43145
+ "description": "Credential query identifier."
43146
+ },
43147
+ "multiple": {
43148
+ "description": "Allow multiple matching credentials.",
43149
+ "type": "boolean"
43150
+ },
43151
+ "claim_sets": {
43152
+ "description": "Optional claim set constraints.",
43153
+ "type": "array",
43154
+ "items": {
43155
+ "type": "array",
43156
+ "items": {
43157
+ "type": "string"
43158
+ }
43159
+ }
43160
+ },
43161
+ "trusted_authorities": {
43162
+ "description": "Optional trusted authority constraints.",
43163
+ "type": "array",
43164
+ "items": {
43165
+ "oneOf": [
43166
+ {
43167
+ "type": "object",
43168
+ "properties": {
43169
+ "type": {
43170
+ "type": "string",
43171
+ "const": "etsi_tl",
43172
+ "description": "Trusted authority type discriminator for ETSI trust lists."
43173
+ },
43174
+ "values": {
43175
+ "type": "array",
43176
+ "items": {
43177
+ "anyOf": [
43178
+ {
43179
+ "type": "object",
43180
+ "properties": {
43181
+ "format": {
43182
+ "description": "Format of the list: a List of Trusted Entities (ETSI TS 119 602) as JWT. Default.",
43183
+ "type": "string",
43184
+ "const": "lote"
43185
+ },
43186
+ "trustListId": {
43187
+ "description": "Optional trust list id reference.",
43188
+ "type": "string"
43189
+ },
43190
+ "url": {
43191
+ "description": "Optional trust list URL reference.",
43192
+ "anyOf": [
43193
+ {
43194
+ "type": "string",
43195
+ "format": "uri"
43196
+ },
43197
+ {
43198
+ "type": "string",
43199
+ "pattern": "^<TENANT_URL>(?:\\/.*)?$"
43200
+ }
43201
+ ]
43202
+ },
43203
+ "verifierKey": {
43204
+ "description": "Optional verifier key material.",
43205
+ "type": "object",
43206
+ "propertyNames": {
43207
+ "type": "string"
43208
+ },
43209
+ "additionalProperties": {}
43210
+ },
43211
+ "verifierX509Der": {
43212
+ "description": "Optional verifier certificate in DER/base64 form.",
43213
+ "type": "string"
43214
+ }
43215
+ },
43216
+ "additionalProperties": false
43217
+ },
43218
+ {
43219
+ "type": "object",
43220
+ "properties": {
43221
+ "format": {
43222
+ "type": "string",
43223
+ "const": "trusted-list",
43224
+ "description": "Format of the list: an ETSI TS 119 612 Trusted List or list of trusted lists as XML."
43225
+ },
43226
+ "url": {
43227
+ "anyOf": [
43228
+ {
43229
+ "type": "string",
43230
+ "format": "uri"
43231
+ },
43232
+ {
43233
+ "type": "string",
43234
+ "pattern": "^<TENANT_URL>(?:\\/.*)?$"
43235
+ }
43236
+ ],
43237
+ "description": "URL of the Trusted List, or of a list of trusted lists (LOTL) whose national lists are followed."
43238
+ },
43239
+ "signingCertificates": {
43240
+ "minItems": 1,
43241
+ "type": "array",
43242
+ "items": {
43243
+ "type": "string",
43244
+ "minLength": 1,
43245
+ "pattern": "^[A-Za-z0-9+/\\s]+={0,2}$"
43246
+ },
43247
+ "description": "Base64 DER certificates one of which must have signed the list: for a list of trusted lists, the signing certificates its operator publishes; for a national list, its scheme operator certificates."
43248
+ },
43249
+ "schemeTerritories": {
43250
+ "description": "For a list of trusted lists: the SchemeTerritory values of the national lists to follow, such as DE. All when absent.",
43251
+ "minItems": 1,
43252
+ "type": "array",
43253
+ "items": {
43254
+ "type": "string",
43255
+ "minLength": 1
43256
+ }
43257
+ }
43258
+ },
43259
+ "required": [
43260
+ "format",
43261
+ "url",
43262
+ "signingCertificates"
43263
+ ],
43264
+ "additionalProperties": false
43265
+ }
43266
+ ],
43267
+ "description": "Reference to a trust list used for authority verification."
43268
+ },
43269
+ "description": "Trust list references for ETSI TL verification."
43270
+ }
43271
+ },
43272
+ "required": [
43273
+ "type",
43274
+ "values"
43275
+ ],
43276
+ "additionalProperties": false
43277
+ },
43278
+ {
43279
+ "type": "object",
43280
+ "properties": {
43281
+ "type": {
43282
+ "type": "string",
43283
+ "const": "openid_federation",
43284
+ "description": "Trusted authority type discriminator for OpenID Federation."
43285
+ },
43286
+ "values": {
43287
+ "type": "array",
43288
+ "items": {
43289
+ "type": "string"
43290
+ },
43291
+ "description": "OpenID Federation authority identifiers."
43292
+ }
43293
+ },
43294
+ "required": [
43295
+ "type",
43296
+ "values"
43297
+ ],
43298
+ "additionalProperties": false
43299
+ }
43300
+ ]
43301
+ }
43302
+ },
43303
+ "format": {
43304
+ "type": "string",
43305
+ "const": "dc+sd-jwt",
43306
+ "description": "Credential format discriminator."
43307
+ },
43308
+ "meta": {
43309
+ "type": "object",
43310
+ "properties": {
43311
+ "vct_values": {
43312
+ "minItems": 1,
43313
+ "type": "array",
43314
+ "items": {
43315
+ "type": "string"
43316
+ },
43317
+ "description": "Accepted VCT values."
43318
+ }
43319
+ },
43320
+ "required": [
43321
+ "vct_values"
43322
+ ],
43323
+ "additionalProperties": false
43324
+ },
43325
+ "claims": {
43326
+ "description": "Optional claim-level constraints.",
43327
+ "type": "array",
43328
+ "items": {
43329
+ "type": "object",
43330
+ "properties": {
43331
+ "id": {
43332
+ "description": "Optional claim query id.",
43333
+ "type": "string"
43334
+ },
43335
+ "path": {
43336
+ "type": "array",
43337
+ "items": {
43338
+ "type": [
43339
+ "string",
43340
+ "number"
43341
+ ]
43342
+ },
43343
+ "description": "Path to the claim value in presented credentials."
43344
+ },
43345
+ "values": {
43346
+ "description": "Optional allowed values for the claim. A disclosed value must equal one of them in type and value.",
43347
+ "minItems": 1,
43348
+ "type": "array",
43349
+ "items": {
43350
+ "anyOf": [
43351
+ {
43352
+ "type": "string"
43353
+ },
43354
+ {
43355
+ "type": "integer",
43356
+ "minimum": -9007199254740991,
43357
+ "maximum": 9007199254740991
43358
+ },
43359
+ {
43360
+ "type": "boolean"
43361
+ }
43362
+ ]
43363
+ }
43364
+ }
43365
+ },
43366
+ "required": [
43367
+ "path"
43368
+ ],
43369
+ "additionalProperties": false
43370
+ }
43371
+ }
43372
+ },
43373
+ "required": [
43374
+ "id",
43375
+ "format",
43376
+ "meta"
43377
+ ],
43378
+ "additionalProperties": false
43379
+ },
43380
+ {
43381
+ "type": "object",
43382
+ "properties": {
43383
+ "id": {
43384
+ "type": "string",
43385
+ "minLength": 1,
43386
+ "pattern": "^[A-Za-z0-9_-]+$",
43387
+ "description": "Credential query identifier."
43388
+ },
43389
+ "multiple": {
43390
+ "description": "Allow multiple matching credentials.",
43391
+ "type": "boolean"
43392
+ },
43393
+ "claim_sets": {
43394
+ "description": "Optional claim set constraints.",
43395
+ "type": "array",
43396
+ "items": {
43397
+ "type": "array",
43398
+ "items": {
43399
+ "type": "string"
43400
+ }
43401
+ }
43402
+ },
43403
+ "trusted_authorities": {
43404
+ "description": "Optional trusted authority constraints.",
43405
+ "type": "array",
43406
+ "items": {
43407
+ "oneOf": [
43408
+ {
43409
+ "type": "object",
43410
+ "properties": {
43411
+ "type": {
43412
+ "type": "string",
43413
+ "const": "etsi_tl",
43414
+ "description": "Trusted authority type discriminator for ETSI trust lists."
43415
+ },
43416
+ "values": {
43417
+ "type": "array",
43418
+ "items": {
43419
+ "anyOf": [
43420
+ {
43421
+ "type": "object",
43422
+ "properties": {
43423
+ "format": {
43424
+ "description": "Format of the list: a List of Trusted Entities (ETSI TS 119 602) as JWT. Default.",
43425
+ "type": "string",
43426
+ "const": "lote"
43427
+ },
43428
+ "trustListId": {
43429
+ "description": "Optional trust list id reference.",
43430
+ "type": "string"
43431
+ },
43432
+ "url": {
43433
+ "description": "Optional trust list URL reference.",
43434
+ "anyOf": [
43435
+ {
43436
+ "type": "string",
43437
+ "format": "uri"
43438
+ },
43439
+ {
43440
+ "type": "string",
43441
+ "pattern": "^<TENANT_URL>(?:\\/.*)?$"
43442
+ }
43443
+ ]
43444
+ },
43445
+ "verifierKey": {
43446
+ "description": "Optional verifier key material.",
43447
+ "type": "object",
43448
+ "propertyNames": {
43449
+ "type": "string"
43450
+ },
43451
+ "additionalProperties": {}
43452
+ },
43453
+ "verifierX509Der": {
43454
+ "description": "Optional verifier certificate in DER/base64 form.",
43455
+ "type": "string"
43456
+ }
43457
+ },
43458
+ "additionalProperties": false
43459
+ },
43460
+ {
43461
+ "type": "object",
43462
+ "properties": {
43463
+ "format": {
43464
+ "type": "string",
43465
+ "const": "trusted-list",
43466
+ "description": "Format of the list: an ETSI TS 119 612 Trusted List or list of trusted lists as XML."
43467
+ },
43468
+ "url": {
43469
+ "anyOf": [
43470
+ {
43471
+ "type": "string",
43472
+ "format": "uri"
43473
+ },
43474
+ {
43475
+ "type": "string",
43476
+ "pattern": "^<TENANT_URL>(?:\\/.*)?$"
43477
+ }
43478
+ ],
43479
+ "description": "URL of the Trusted List, or of a list of trusted lists (LOTL) whose national lists are followed."
43480
+ },
43481
+ "signingCertificates": {
43482
+ "minItems": 1,
43483
+ "type": "array",
43484
+ "items": {
43485
+ "type": "string",
43486
+ "minLength": 1,
43487
+ "pattern": "^[A-Za-z0-9+/\\s]+={0,2}$"
43488
+ },
43489
+ "description": "Base64 DER certificates one of which must have signed the list: for a list of trusted lists, the signing certificates its operator publishes; for a national list, its scheme operator certificates."
43490
+ },
43491
+ "schemeTerritories": {
43492
+ "description": "For a list of trusted lists: the SchemeTerritory values of the national lists to follow, such as DE. All when absent.",
43493
+ "minItems": 1,
43494
+ "type": "array",
43495
+ "items": {
43496
+ "type": "string",
43497
+ "minLength": 1
43498
+ }
43499
+ }
43500
+ },
43501
+ "required": [
43502
+ "format",
43503
+ "url",
43504
+ "signingCertificates"
43505
+ ],
43506
+ "additionalProperties": false
43507
+ }
43508
+ ],
43509
+ "description": "Reference to a trust list used for authority verification."
43510
+ },
43511
+ "description": "Trust list references for ETSI TL verification."
43512
+ }
43513
+ },
43514
+ "required": [
43515
+ "type",
43516
+ "values"
43517
+ ],
43518
+ "additionalProperties": false
43519
+ },
43520
+ {
43521
+ "type": "object",
43522
+ "properties": {
43523
+ "type": {
43524
+ "type": "string",
43525
+ "const": "openid_federation",
43526
+ "description": "Trusted authority type discriminator for OpenID Federation."
43527
+ },
43528
+ "values": {
43529
+ "type": "array",
43530
+ "items": {
43531
+ "type": "string"
43532
+ },
43533
+ "description": "OpenID Federation authority identifiers."
43534
+ }
43535
+ },
43536
+ "required": [
43537
+ "type",
43538
+ "values"
43539
+ ],
43540
+ "additionalProperties": false
43541
+ }
43542
+ ]
43543
+ }
43544
+ },
43545
+ "format": {
43546
+ "type": "string",
43547
+ "const": "mso_mdoc",
43548
+ "description": "Credential format discriminator."
43549
+ },
43550
+ "meta": {
43551
+ "type": "object",
43552
+ "properties": {
43553
+ "doctype_value": {
43554
+ "type": "string",
43555
+ "minLength": 1,
43556
+ "description": "Expected mDoc doctype value."
43557
+ }
43558
+ },
43559
+ "required": [
43560
+ "doctype_value"
43561
+ ],
43562
+ "additionalProperties": false
43563
+ },
43564
+ "claims": {
43565
+ "description": "Optional mDoc claim-level constraints.",
43566
+ "type": "array",
43567
+ "items": {
43568
+ "type": "object",
43569
+ "properties": {
43570
+ "id": {
43571
+ "description": "Optional claim query id.",
43572
+ "type": "string"
43573
+ },
43574
+ "path": {
43575
+ "type": "array",
43576
+ "items": {
43577
+ "type": [
43578
+ "string",
43579
+ "number"
43580
+ ]
43581
+ },
43582
+ "description": "Path to the claim value in presented credentials."
43583
+ },
43584
+ "values": {
43585
+ "description": "Optional allowed values for the claim. A disclosed value must equal one of them in type and value.",
43586
+ "minItems": 1,
43587
+ "type": "array",
43588
+ "items": {
43589
+ "anyOf": [
43590
+ {
43591
+ "type": "string"
43592
+ },
43593
+ {
43594
+ "type": "integer",
43595
+ "minimum": -9007199254740991,
43596
+ "maximum": 9007199254740991
43597
+ },
43598
+ {
43599
+ "type": "boolean"
43600
+ }
43601
+ ]
43602
+ }
43603
+ },
43604
+ "intent_to_retain": {
43605
+ "description": "Whether relying party intends to retain the claim.",
43606
+ "type": "boolean"
43607
+ }
43608
+ },
43609
+ "required": [
43610
+ "path"
43611
+ ],
43612
+ "additionalProperties": false
43613
+ }
43614
+ }
43615
+ },
43616
+ "required": [
43617
+ "id",
43618
+ "format",
43619
+ "meta"
43620
+ ],
43621
+ "additionalProperties": false
43622
+ }
43623
+ ]
43624
+ },
43625
+ "description": "Credential queries requested by the verifier."
43626
+ },
43627
+ "credential_sets": {
43628
+ "description": "Optional higher-level credential set requirements.",
43629
+ "type": "array",
43630
+ "items": {
43631
+ "type": "object",
43632
+ "properties": {
43633
+ "options": {
43634
+ "minItems": 1,
43635
+ "type": "array",
43636
+ "items": {
43637
+ "minItems": 1,
43638
+ "type": "array",
43639
+ "items": {
43640
+ "type": "string"
43641
+ }
43642
+ },
43643
+ "description": "Alternative credential query id combinations."
43644
+ },
43645
+ "required": {
43646
+ "description": "Whether this credential set is mandatory.",
43647
+ "type": "boolean"
43648
+ }
43649
+ },
43650
+ "required": [
43651
+ "options"
43652
+ ],
43653
+ "additionalProperties": false
43654
+ }
43655
+ }
43656
+ },
43657
+ "required": [
43658
+ "credentials"
43659
+ ],
43660
+ "additionalProperties": false,
43661
+ "description": "DCQL query defining requested credentials and claims."
43662
+ },
43663
+ "transaction_data": {
43664
+ "description": "Optional transaction data descriptors.",
43665
+ "anyOf": [
43666
+ {
43667
+ "type": "array",
43668
+ "items": {
43669
+ "type": "object",
43670
+ "properties": {
43671
+ "type": {
43672
+ "type": "string",
43673
+ "description": "Transaction data type identifier."
43674
+ },
43675
+ "credential_ids": {
43676
+ "type": "array",
43677
+ "items": {
43678
+ "type": "string"
43679
+ },
43680
+ "description": "Credential query ids this transaction data applies to."
43681
+ },
43682
+ "payload": {
43683
+ "description": "Transaction details. Required for TS12 SCA transaction data."
43684
+ }
43685
+ },
43686
+ "required": [
43687
+ "type",
43688
+ "credential_ids"
43689
+ ],
43690
+ "additionalProperties": {}
43691
+ }
43692
+ },
43693
+ {
43694
+ "type": "null"
43695
+ }
43696
+ ]
43697
+ },
43698
+ "registration_cert": {
43699
+ "description": "Registration certificate from a registrar, with the purpose and privacy policy it is requested with.",
43700
+ "anyOf": [
43701
+ {
43702
+ "type": "object",
43703
+ "properties": {
43704
+ "jwt": {
43705
+ "description": "Registration certificate JWT issued by a registrar. Attached to every request object as is; it must be valid and authorize every credential the DCQL query requests.",
43706
+ "type": "string",
43707
+ "minLength": 1
43708
+ },
43709
+ "purpose": {
43710
+ "description": "Why the data is requested (GDPR purpose), one text per language. Used when a certificate is requested from a registrar.",
43711
+ "type": "array",
43712
+ "items": {
43713
+ "type": "object",
43714
+ "properties": {
43715
+ "lang": {
43716
+ "type": "string",
43717
+ "minLength": 1,
43718
+ "description": "Language tag of the text, such as en or pt-BR. The EUDI Hub takes two-letter codes only."
43719
+ },
43720
+ "content": {
43721
+ "type": "string",
43722
+ "minLength": 1,
43723
+ "description": "The purpose in that language."
43724
+ }
43725
+ },
43726
+ "required": [
43727
+ "lang",
43728
+ "content"
43729
+ ],
43730
+ "additionalProperties": false
43731
+ }
43732
+ },
43733
+ "privacy_policy": {
43734
+ "description": "URL of the privacy policy that applies to this request. Used when a certificate is requested from a registrar.",
43735
+ "type": "string",
43736
+ "minLength": 1
43737
+ }
43738
+ },
43739
+ "additionalProperties": false
43740
+ },
43741
+ {
43742
+ "type": "null"
43743
+ }
43744
+ ]
43745
+ },
43746
+ "webhookEndpointId": {
43747
+ "description": "Optional webhook endpoint id for presentation callbacks.",
43748
+ "type": [
43749
+ "string",
43750
+ "null"
43751
+ ]
43752
+ },
43753
+ "attached": {
43754
+ "description": "Optional attachments included with presentation requests.",
43755
+ "anyOf": [
43756
+ {
43757
+ "type": "array",
43758
+ "items": {
43759
+ "type": "object",
43760
+ "properties": {
43761
+ "format": {
43762
+ "type": "string",
43763
+ "description": "Attachment format identifier."
43764
+ },
43765
+ "data": {
43766
+ "description": "Attachment payload."
43767
+ },
43768
+ "credential_ids": {
43769
+ "description": "Optional credential query ids bound to this attachment.",
43770
+ "type": "array",
43771
+ "items": {
43772
+ "type": "string"
43773
+ }
43774
+ }
43775
+ },
43776
+ "required": [
43777
+ "format",
43778
+ "data"
43779
+ ],
43780
+ "additionalProperties": false
43781
+ }
43782
+ },
43783
+ {
43784
+ "type": "null"
43785
+ }
43786
+ ]
43787
+ },
43788
+ "redirectUri": {
43789
+ "description": "Optional redirect URI after presentation completion.",
43790
+ "type": [
43791
+ "string",
43792
+ "null"
43793
+ ]
43794
+ },
43795
+ "accessKeyChainId": {
43796
+ "description": "Optional key chain id for access token/auth operations.",
43797
+ "type": [
43798
+ "string",
43799
+ "null"
43800
+ ]
43801
+ },
43802
+ "allowedOrigins": {
43803
+ "description": "Origins (http(s)://host[:port]) of the web pages allowed to request this presentation over the Digital Credentials API. When set, dc-api and iso-18013-7 offers are refused for any other expected_origin, and an offer without expected_origin uses the only listed origin. Unset: any expected_origin is accepted. Not used for uri requests.",
43804
+ "anyOf": [
43805
+ {
43806
+ "maxItems": 100,
43807
+ "type": "array",
43808
+ "items": {
43809
+ "type": "string",
43810
+ "pattern": "^(?:https:\\/\\/(?:[a-z0-9.-]+|\\[[0-9a-f:.]+\\])(?::(?:[1-9]|[1-9][0-9]|[1-35-9][0-9]{2}|4[0-35-9][0-9]|44[0-24-9]|[1-9][0-9]{3,4}))?|http:\\/\\/(?:[a-z0-9.-]+|\\[[0-9a-f:.]+\\])(?::(?:[1-9]|[1-79][0-9]|8[1-9]|[1-9][0-9]{2,4}))?)$"
43811
+ }
43812
+ },
43813
+ {
43814
+ "type": "null"
43815
+ }
43816
+ ]
43817
+ },
43818
+ "readerAuth": {
43819
+ "description": "Whether reader authentication is required for mDoc requests.",
43820
+ "type": [
43821
+ "boolean",
43822
+ "null"
43823
+ ]
43824
+ },
43825
+ "allowUntrustedIssuers": {
43826
+ "description": "Accept DCQL credential queries without trusted_authorities. Credentials of such queries are verified without checking their issuer: any issuer with a valid signature is accepted. For development and interoperability tests only. Defaults to false.",
43827
+ "type": "boolean"
43828
+ }
43829
+ },
43830
+ "required": [
43831
+ "id",
43832
+ "dcql_query"
43833
+ ],
43834
+ "additionalProperties": false,
43835
+ "title": "PresentationConfigCreateDto"
43836
+ }
43837
+ }
43838
+ },
42695
43839
  {
42696
43840
  "$schema": "https://json-schema.org/draft/2020-12/schema",
42697
43841
  "$id": "https://eudiplo.dev/schemas/v7/IssuanceConfigFile.schema.json",
@@ -43494,104 +44638,99 @@ var CONFIG_SCHEMAS = [
43494
44638
  }
43495
44639
  ];
43496
44640
 
43497
- // ../../packages/eudiplo-config-format/dist/config-validator.js
43498
- var DISPLAY_COLOR_PATH = /^\/spec\/config\/display\/\d+\/(?:background|text)_color$/;
43499
- var ajv = new import__.Ajv2020({
43500
- allErrors: true,
43501
- strict: false,
43502
- validateFormats: false
43503
- });
43504
- for (const schema of CONFIG_SCHEMAS)
43505
- ajv.addSchema(schema);
43506
- function validateConfigDocument(document) {
43507
- const file = serializeDocument(document);
43508
- const validate = ajv.getSchema(file.$schema);
43509
- if (!validate)
43510
- throw new Error(`No bundled validator for ${file.$schema}`);
43511
- const issues = [];
43512
- if (!validate(file)) {
43513
- for (const issue of validate.errors ?? [])
43514
- issues.push({
43515
- severity: "error",
43516
- code: "CONFIG_SCHEMA_VALIDATION_FAILED",
43517
- path: issue.instancePath || "/",
43518
- message: issue.keyword === "additionalProperties" ? `Unknown property: ${String(issue.params.additionalProperty)}` : issue.keyword === "pattern" && DISPLAY_COLOR_PATH.test(issue.instancePath) ? DISPLAY_COLOR_MESSAGE : issue.message ?? "Invalid configuration",
43519
- resource: { kind: document.kind, id: resourceId(document) }
43520
- });
43521
- }
43522
- const id = document.kind === "Client" ? document.spec.clientId : document.spec.id;
43523
- if (id !== void 0 && id !== resourceId(document))
43524
- issues.push({
43525
- severity: "error",
43526
- code: "RESOURCE_ID_MISMATCH",
43527
- path: document.kind === "Client" ? "/spec/clientId" : "/spec/id",
43528
- message: "Resource identifier does not match metadata.id"
43529
- });
43530
- issues.push(...configRuleIssues(document));
43531
- return issues;
43532
- }
43533
- function configRuleIssues(document) {
43534
- const display = document.spec.config?.display;
43535
- if (document.kind !== "CredentialConfig" || resolveConfigIdentity(serializeDocument(document)).version < 4 || !Array.isArray(display))
43536
- return [];
43537
- return findDuplicateDisplayLocales(display).map((duplicate) => ({
43538
- severity: "error",
43539
- code: "DISPLAY_LOCALE_DUPLICATE",
43540
- path: `/spec/config/display/${duplicate.index}/locale`,
43541
- message: duplicateDisplayLocaleMessage(duplicate),
43542
- resource: { kind: document.kind, id: resourceId(document) }
43543
- }));
43544
- }
43545
-
43546
44641
  // ../../packages/eudiplo-config-format/dist/config-values.js
43547
44642
  var isVariableChar = (char) => char >= "A" && char <= "Z" || char >= "0" && char <= "9" || char === "_";
43548
- function replacePlaceholders(input, replace) {
44643
+ var isLower = (char) => char >= "a" && char <= "z";
44644
+ var isSourceChar = (char) => isLower(char) || char >= "0" && char <= "9" || char === "-";
44645
+ var LOCATOR_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._~/:@+=,#-");
44646
+ var escapeText = (text) => text.replaceAll("${", () => "$${");
44647
+ function replacePlaceholders(input, replace, escapes = "resolve") {
43549
44648
  let output = "";
44649
+ let text = "";
44650
+ const flush = () => {
44651
+ output += escapes === "keep" ? escapeText(text) : text;
44652
+ text = "";
44653
+ };
43550
44654
  let copied = 0;
44655
+ let noClosingBrace = false;
43551
44656
  let start = input.indexOf("${");
43552
44657
  while (start !== -1) {
43553
- let cursor = start + 2;
43554
- while (cursor < input.length && isVariableChar(input[cursor]))
43555
- cursor++;
43556
- const variable = input.slice(start + 2, cursor);
44658
+ if (escapes !== "none" && start > copied && input[start - 1] === "$") {
44659
+ text += `${input.slice(copied, start - 1)}\${`;
44660
+ copied = start + 2;
44661
+ start = input.indexOf("${", copied);
44662
+ continue;
44663
+ }
44664
+ let token;
43557
44665
  let end = -1;
43558
- let fallback;
43559
- if (variable && input[cursor] === "}")
43560
- end = cursor;
43561
- else if (variable && input[cursor] === ":") {
43562
- end = input.indexOf("}", cursor + 1);
43563
- if (end === -1)
43564
- break;
43565
- fallback = input.slice(cursor + 1, end);
44666
+ let cursor = start + 2;
44667
+ if (isLower(input[cursor] ?? "")) {
44668
+ while (cursor < input.length && isSourceChar(input[cursor]))
44669
+ cursor++;
44670
+ const source = input.slice(start + 2, cursor);
44671
+ if (input[cursor] === ":") {
44672
+ const locatorStart = cursor + 1;
44673
+ cursor = locatorStart;
44674
+ while (cursor < input.length && LOCATOR_CHARS.has(input[cursor]))
44675
+ cursor++;
44676
+ if (cursor > locatorStart && input[cursor] === "}") {
44677
+ end = cursor;
44678
+ token = {
44679
+ type: "reference",
44680
+ match: input.slice(start, end + 1),
44681
+ source,
44682
+ locator: input.slice(locatorStart, end)
44683
+ };
44684
+ }
44685
+ }
44686
+ } else {
44687
+ while (cursor < input.length && isVariableChar(input[cursor]))
44688
+ cursor++;
44689
+ const variable = input.slice(start + 2, cursor);
44690
+ let fallback;
44691
+ if (variable && input[cursor] === "}")
44692
+ end = cursor;
44693
+ else if (variable && input[cursor] === ":" && !noClosingBrace) {
44694
+ end = input.indexOf("}", cursor + 1);
44695
+ if (end === -1)
44696
+ noClosingBrace = true;
44697
+ else
44698
+ fallback = input.slice(cursor + 1, end);
44699
+ }
44700
+ if (end !== -1)
44701
+ token = {
44702
+ type: "variable",
44703
+ match: input.slice(start, end + 1),
44704
+ variable,
44705
+ fallback
44706
+ };
43566
44707
  }
43567
- if (end === -1) {
44708
+ if (!token) {
43568
44709
  start = input.indexOf("${", start + 2);
43569
44710
  continue;
43570
44711
  }
43571
- output += input.slice(copied, start);
43572
- output += replace(input.slice(start, end + 1), variable, fallback);
44712
+ const { match } = token;
44713
+ const replacement = replace(token);
44714
+ text += input.slice(copied, start);
44715
+ if (replacement !== void 0)
44716
+ text += replacement;
44717
+ else if (escapes === "keep") {
44718
+ flush();
44719
+ output += match;
44720
+ } else
44721
+ text += match;
43573
44722
  copied = end + 1;
43574
44723
  start = input.indexOf("${", copied);
43575
44724
  }
43576
- return output + input.slice(copied);
44725
+ text += input.slice(copied);
44726
+ flush();
44727
+ return output;
43577
44728
  }
43578
- function resolveConfigVariables(input, env) {
43579
- const issues = [];
44729
+ function mapStrings(input, change) {
43580
44730
  const seen = /* @__PURE__ */ new WeakMap();
43581
44731
  function visit2(value, path2) {
43582
44732
  if (typeof value === "string")
43583
- return replacePlaceholders(value, (match, variable, fallback) => {
43584
- if (env[variable] !== void 0 && env[variable] !== "")
43585
- return env[variable];
43586
- if (fallback !== void 0)
43587
- return fallback;
43588
- issues.push({
43589
- path: path2 || "/",
43590
- variable,
43591
- message: `Unresolved placeholder \${${variable}}: no environment value or default is available`
43592
- });
43593
- return match;
43594
- });
44733
+ return change(value, path2 || "/");
43595
44734
  if (!value || typeof value !== "object" || value instanceof Uint8Array)
43596
44735
  return value;
43597
44736
  if (seen.has(value))
@@ -43607,7 +44746,43 @@ function resolveConfigVariables(input, env) {
43607
44746
  });
43608
44747
  return output;
43609
44748
  }
43610
- return { value: visit2(input, ""), issues };
44749
+ return visit2(input, "");
44750
+ }
44751
+ function resolveConfigVariables(input, env, escapes = "resolve") {
44752
+ const issues = [];
44753
+ const value = mapStrings(input, (text, path2) => replacePlaceholders(text, (token) => {
44754
+ if (token.type === "reference")
44755
+ return void 0;
44756
+ const { variable, fallback } = token;
44757
+ const found = env[variable];
44758
+ if (found !== void 0 && found !== "")
44759
+ return found;
44760
+ if (fallback !== void 0)
44761
+ return fallback;
44762
+ issues.push({
44763
+ path: path2,
44764
+ variable,
44765
+ message: `Unresolved placeholder \${${variable}}: no environment value or default is available`
44766
+ });
44767
+ return void 0;
44768
+ }, escapes));
44769
+ return { value, issues };
44770
+ }
44771
+ function escapeConfigPlaceholders(input) {
44772
+ return mapStrings(input, escapeText);
44773
+ }
44774
+ function readConfigFileValues(input, escapes = "resolve") {
44775
+ const placeholders = [];
44776
+ const references = [];
44777
+ const value = mapStrings(input, (text, path2) => replacePlaceholders(text, ({ type, match }) => {
44778
+ const whole = match === text;
44779
+ if (type === "reference")
44780
+ references.push({ path: path2, reference: match, whole });
44781
+ else
44782
+ placeholders.push({ path: path2, placeholder: match, whole });
44783
+ return void 0;
44784
+ }, escapes));
44785
+ return { value, placeholders, references };
43611
44786
  }
43612
44787
  function stableConfigJson(value) {
43613
44788
  function sort(item) {
@@ -43673,6 +44848,58 @@ function configChanges(before, after, sensitivePaths = [], prefix = "") {
43673
44848
  return changes;
43674
44849
  }
43675
44850
 
44851
+ // ../../packages/eudiplo-config-format/dist/config-validator.js
44852
+ var DISPLAY_COLOR_PATH = /^\/spec\/config\/display\/\d+\/(?:background|text)_color$/;
44853
+ var ajv = new import__.Ajv2020({
44854
+ allErrors: true,
44855
+ strict: false,
44856
+ validateFormats: false
44857
+ });
44858
+ for (const schema of CONFIG_SCHEMAS)
44859
+ ajv.addSchema(schema);
44860
+ function validateConfigDocument(document) {
44861
+ const file = serializeDocument(document);
44862
+ const validate = ajv.getSchema(file.$schema);
44863
+ if (!validate)
44864
+ throw new Error(`No bundled validator for ${file.$schema}`);
44865
+ const issues = [];
44866
+ if (!validate(file)) {
44867
+ for (const issue of validate.errors ?? [])
44868
+ issues.push({
44869
+ severity: "error",
44870
+ code: "CONFIG_SCHEMA_VALIDATION_FAILED",
44871
+ path: issue.instancePath || "/",
44872
+ message: issue.keyword === "additionalProperties" ? `Unknown property: ${String(issue.params.additionalProperty)}` : issue.keyword === "pattern" && DISPLAY_COLOR_PATH.test(issue.instancePath) ? DISPLAY_COLOR_MESSAGE : issue.message ?? "Invalid configuration",
44873
+ resource: { kind: document.kind, id: resourceId(document) }
44874
+ });
44875
+ }
44876
+ const id = document.kind === "Client" ? document.spec.clientId : document.spec.id;
44877
+ if (id !== void 0 && id !== resourceId(document))
44878
+ issues.push({
44879
+ severity: "error",
44880
+ code: "RESOURCE_ID_MISMATCH",
44881
+ path: document.kind === "Client" ? "/spec/clientId" : "/spec/id",
44882
+ message: "Resource identifier does not match metadata.id"
44883
+ });
44884
+ issues.push(...configRuleIssues(document));
44885
+ return issues;
44886
+ }
44887
+ function validateConfigFile(document) {
44888
+ return validateConfigDocument(document.kind === "KmsConfig" ? document : { ...document, spec: readConfigFileValues(document.spec).value });
44889
+ }
44890
+ function configRuleIssues(document) {
44891
+ const display = document.spec.config?.display;
44892
+ if (document.kind !== "CredentialConfig" || resolveConfigIdentity(serializeDocument(document)).version < 4 || !Array.isArray(display))
44893
+ return [];
44894
+ return findDuplicateDisplayLocales(display).map((duplicate) => ({
44895
+ severity: "error",
44896
+ code: "DISPLAY_LOCALE_DUPLICATE",
44897
+ path: `/spec/config/display/${duplicate.index}/locale`,
44898
+ message: duplicateDisplayLocaleMessage(duplicate),
44899
+ resource: { kind: document.kind, id: resourceId(document) }
44900
+ }));
44901
+ }
44902
+
43676
44903
  // ../../packages/eudiplo-config-format/dist/tenant-folder.js
43677
44904
  var TENANT_FOLDER_IMAGES = "images";
43678
44905
  var IMAGE_CONTENT_TYPES = {
@@ -43705,7 +44932,7 @@ async function discoverTenantDirectories(rootPath) {
43705
44932
  const entries = await readdir(rootPath, { withFileTypes: true });
43706
44933
  return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareCodePoints);
43707
44934
  }
43708
- async function validateTenantsRoot(rootPath, schemas, env) {
44935
+ async function validateTenantsRoot(rootPath, schemas, env, options = {}) {
43709
44936
  if (!existsSync(rootPath)) {
43710
44937
  throw new Error(`Configuration root not found: ${rootPath}`);
43711
44938
  }
@@ -43717,7 +44944,8 @@ async function validateTenantsRoot(rootPath, schemas, env) {
43717
44944
  join4(rootPath, tenantId),
43718
44945
  tenantId,
43719
44946
  schemas,
43720
- env
44947
+ env,
44948
+ options
43721
44949
  )
43722
44950
  );
43723
44951
  }
@@ -43732,7 +44960,9 @@ async function validateTenantDirectory(tenantPath, tenantId, schemas, env, optio
43732
44960
  env,
43733
44961
  errors: [],
43734
44962
  unresolved: [],
44963
+ warnings: [],
43735
44964
  allowUnresolvedPlaceholders: options.allowUnresolvedPlaceholders,
44965
+ folderVariablePolicy: options.folderVariablePolicy,
43736
44966
  resourceCounts: {},
43737
44967
  files: 0
43738
44968
  };
@@ -43743,9 +44973,12 @@ async function validateTenantDirectory(tenantPath, tenantId, schemas, env, optio
43743
44973
  await validateDirectoryEntry(tenantPath, entry, state);
43744
44974
  }
43745
44975
  }
43746
- const warnings = RETIRED_TENANT_FOLDER_FILES.filter(
43747
- ({ file }) => existsSync(join4(tenantPath, file))
43748
- ).map(({ file, issue }) => ({ file, message: issue.message }));
44976
+ const warnings = [
44977
+ ...RETIRED_TENANT_FOLDER_FILES.filter(
44978
+ ({ file }) => existsSync(join4(tenantPath, file))
44979
+ ).map(({ file, issue }) => ({ file, message: issue.message })),
44980
+ ...state.warnings
44981
+ ];
43749
44982
  return {
43750
44983
  id: tenantId,
43751
44984
  valid: state.errors.length === 0,
@@ -43826,16 +45059,15 @@ async function recordValidationOutcome(filePath, relativeFile, resourceType, sch
43826
45059
  filePath,
43827
45060
  relativeFile,
43828
45061
  schemaFile,
43829
- state.getValidator,
43830
- state.env,
43831
- state.errors,
43832
- state.allowUnresolvedPlaceholders ? state.unresolved : state.errors
45062
+ state
43833
45063
  );
43834
45064
  if (isValid) {
43835
45065
  state.resourceCounts[resourceType] = (state.resourceCounts[resourceType] ?? 0) + 1;
43836
45066
  }
43837
45067
  }
43838
- async function validateResourceFile(filePath, relativeFile, schemaFile, getValidator, env, errors, placeholderIssues) {
45068
+ async function validateResourceFile(filePath, relativeFile, schemaFile, state) {
45069
+ const { errors, getValidator } = state;
45070
+ const kind = kindForSchemaFile(schemaFile);
43839
45071
  let raw;
43840
45072
  try {
43841
45073
  raw = await readFile4(filePath, "utf8");
@@ -43854,12 +45086,7 @@ async function validateResourceFile(filePath, relativeFile, schemaFile, getValid
43854
45086
  return false;
43855
45087
  }
43856
45088
  const errorsBefore = errors.length;
43857
- let resolved = resolvePlaceholders(
43858
- payload,
43859
- env,
43860
- relativeFile,
43861
- placeholderIssues
43862
- );
45089
+ let resolved = resolvePlaceholders(payload, relativeFile, kind, state);
43863
45090
  if (errors.length > errorsBefore) {
43864
45091
  return false;
43865
45092
  }
@@ -43887,7 +45114,6 @@ async function validateResourceFile(filePath, relativeFile, schemaFile, getValid
43887
45114
  return false;
43888
45115
  }
43889
45116
  } else {
43890
- const kind = kindForSchemaFile(schemaFile);
43891
45117
  if (kind && resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
43892
45118
  const spec = structuredClone(resolved);
43893
45119
  if (kind === "KeyChain" && spec.key && !spec.keySource) {
@@ -43948,17 +45174,62 @@ function formatErrorPath(issue) {
43948
45174
  const missingProperty = issue.params?.missingProperty;
43949
45175
  return missingProperty;
43950
45176
  }
43951
- function resolvePlaceholders(value, env, file, errors) {
43952
- const result = resolveConfigVariables(value, env);
45177
+ function resolvePlaceholders(value, file, kind, state) {
45178
+ const kms = kind === "KmsConfig";
45179
+ const named = /* @__PURE__ */ new Set();
45180
+ const env = new Proxy(state.env, {
45181
+ get: (target, name) => {
45182
+ if (typeof name !== "string") return void 0;
45183
+ named.add(name);
45184
+ return target[name];
45185
+ }
45186
+ });
45187
+ const result = resolveConfigVariables(value, env, kms ? "none" : "resolve");
45188
+ const refused = /* @__PURE__ */ new Set();
45189
+ if (state.folderVariablePolicy)
45190
+ for (const variable of [...named].sort(compareCodePoints)) {
45191
+ const check = checkFolderVariable(variable, kms);
45192
+ if (check?.refused) {
45193
+ refused.add(variable);
45194
+ state.errors.push({ file, message: check.message, variable });
45195
+ } else if (check)
45196
+ state.warnings.push({ file, message: check.message, variable });
45197
+ }
45198
+ const placeholderIssues = state.allowUnresolvedPlaceholders ? state.unresolved : state.errors;
43953
45199
  for (const issue of result.issues)
43954
- errors.push({
43955
- file,
43956
- path: issue.path,
43957
- message: issue.message,
43958
- variable: issue.variable
43959
- });
45200
+ if (!refused.has(issue.variable))
45201
+ placeholderIssues.push({
45202
+ file,
45203
+ path: issue.path,
45204
+ message: issue.message,
45205
+ variable: issue.variable
45206
+ });
43960
45207
  return result.value;
43961
45208
  }
45209
+ var CLOUD_CREDENTIAL_VARIABLES = /* @__PURE__ */ new Map([
45210
+ ["AWS_ACCESS_KEY_ID", "AWS"],
45211
+ ["AWS_SECRET_ACCESS_KEY", "AWS"],
45212
+ ["AWS_SESSION_TOKEN", "AWS"],
45213
+ ["AWS_CONTAINER_AUTHORIZATION_TOKEN", "AWS"],
45214
+ ["AZURE_CLIENT_SECRET", "Azure"],
45215
+ ["AZURE_CLIENT_CERTIFICATE_PASSWORD", "Azure"],
45216
+ ["AZURE_PASSWORD", "Azure"]
45217
+ ]);
45218
+ function checkFolderVariable(variable, kms) {
45219
+ if (variable === "PUBLIC_URL") return void 0;
45220
+ if (kms)
45221
+ return {
45222
+ refused: false,
45223
+ message: `\${${variable}} is resolved only if the instance lists ${variable} in KMS_TENANT_VARIABLES, which cannot name a setting of EUDIPLO itself`
45224
+ };
45225
+ const provider = CLOUD_CREDENTIAL_VARIABLES.get(variable);
45226
+ if (provider)
45227
+ return {
45228
+ refused: true,
45229
+ message: `\${${variable}} holds the ${provider} credentials of the instance, which a file of a tenant folder cannot use`
45230
+ };
45231
+ return void 0;
45232
+ }
43962
45233
 
43963
45234
  // src/commands/config/portability/folder-bundle.ts
43964
45235
  import { createHash as createHash3 } from "node:crypto";
@@ -43990,13 +45261,13 @@ import {
43990
45261
 
43991
45262
  // src/commands/config/portability/migrations.ts
43992
45263
  function upgradeDocument(input) {
43993
- const result = migrateDocument(input, validateConfigDocument);
45264
+ const result = migrateDocument(input, validateConfigFile);
43994
45265
  return { ...result, document: serializeDocument(result.document) };
43995
45266
  }
43996
45267
 
43997
45268
  // src/commands/config/portability/upgrade.ts
43998
45269
  var codec = new ConfigBundleCodec();
43999
- function parse3(text, path2) {
45270
+ function parse4(text, path2) {
44000
45271
  try {
44001
45272
  return JSON.parse(text);
44002
45273
  } catch {
@@ -44129,7 +45400,7 @@ async function upgradeFolder(source, parsed, context) {
44129
45400
  for (const file of await folderFiles(source)) {
44130
45401
  if (extname(file) !== ".json" || relative2(source, file).split(sep2).includes("images"))
44131
45402
  continue;
44132
- const input = parse3(await readFile5(file, "utf8"), file);
45403
+ const input = parse4(await readFile5(file, "utf8"), file);
44133
45404
  const path2 = relative2(source, file).split(sep2).join("/");
44134
45405
  const retired = RETIRED_TENANT_FOLDER_FILES.find(
44135
45406
  (entry) => path2 === entry.file || path2.endsWith(`/${entry.file}`)
@@ -44219,7 +45490,7 @@ async function upgradeFile(parsed, context) {
44219
45490
  );
44220
45491
  if (info.isDirectory()) return upgradeFolder(source, parsed, context);
44221
45492
  const zipped = extname(source).toLowerCase() === ".zip";
44222
- const input = zipped ? codec.decode(await readFile5(source)) : parse3(await readFile5(source, "utf8"), source);
45493
+ const input = zipped ? codec.decode(await readFile5(source)) : parse4(await readFile5(source, "utf8"), source);
44223
45494
  const output = upgradeJson(input, source, context);
44224
45495
  const changed = report(input, output, name, parsed, context);
44225
45496
  if (parsed.flags.check === true) return changed ? 1 : 0;
@@ -44270,10 +45541,14 @@ function folderEnvironment(allowList, source) {
44270
45541
  }
44271
45542
  var VALUE_KEYS = /* @__PURE__ */ new Set(["before", "after", "message"]);
44272
45543
  function maskFilledText(text, filled) {
44273
- const secrets = [...filled].map(([variable, secret]) => ({
44274
- secret,
44275
- placeholder: `\${${variable}}`
44276
- })).sort((left, right) => right.secret.length - left.secret.length);
45544
+ const secrets = [...filled].flatMap(([variable, secret]) => {
45545
+ const placeholder = `\${${variable}}`;
45546
+ const escaped = escapeConfigPlaceholders(secret);
45547
+ return escaped === secret ? [{ secret, placeholder }] : [
45548
+ { secret, placeholder },
45549
+ { secret: escaped, placeholder }
45550
+ ];
45551
+ }).sort((left, right) => right.secret.length - left.secret.length);
44277
45552
  for (const { secret, placeholder } of secrets) {
44278
45553
  if (text === secret) return placeholder;
44279
45554
  if (secret.length >= MIN_MASKED_LENGTH)
@@ -44402,7 +45677,11 @@ async function resourceFiles(tenantRoot, resource) {
44402
45677
  }
44403
45678
  async function loadDocument(tenantRoot, file, kind, env) {
44404
45679
  const payload = JSON.parse(await readFile6(join6(tenantRoot, file), "utf8"));
44405
- const resolved = resolveConfigVariables(payload, env).value;
45680
+ const resolved = resolveConfigVariables(
45681
+ payload,
45682
+ env,
45683
+ kind === "KmsConfig" ? "none" : "keep"
45684
+ ).value;
44406
45685
  const document = normalizeDocument(
44407
45686
  isConfigDocument(resolved) ? resolved : wrapBare(kind, resolved, file)
44408
45687
  );
@@ -44622,7 +45901,7 @@ async function runPortabilityCommand(action, config, parsed, context) {
44622
45901
  const allowEnv = readStringFlag(parsed.flags, "allow-env");
44623
45902
  if (allowEnv !== void 0 && !folder)
44624
45903
  throw new Error(
44625
- "--allow-env applies to a tenant folder only; a bundle's placeholders are resolved by the server."
45904
+ "--allow-env applies to a tenant folder only; replace the placeholders of a bundle with their values."
44626
45905
  );
44627
45906
  const folderEnv = folderEnvironment(allowEnv, context.env);
44628
45907
  if (folder) {
@@ -44695,6 +45974,13 @@ async function runPortabilityCommand(action, config, parsed, context) {
44695
45974
  body = JSON.stringify(bundle);
44696
45975
  headers = { ...headers, "content-type": "application/json" };
44697
45976
  }
45977
+ if (folder) {
45978
+ const warning = escapedFormWarning(
45979
+ await backendVersion(baseUrl, authHeaders, context)
45980
+ );
45981
+ if (warning) context.stderr.write(`${warning}
45982
+ `);
45983
+ }
44698
45984
  const response = await context.fetch(
44699
45985
  `${baseUrl}/api/config-bundles/${endpoint}?${query}`,
44700
45986
  { method: "POST", headers, body }
@@ -44756,6 +46042,17 @@ async function runPortabilityCommand(action, config, parsed, context) {
44756
46042
  `);
44757
46043
  return result.applicable === false ? 1 : 0;
44758
46044
  }
46045
+ async function backendVersion(baseUrl, headers, context) {
46046
+ try {
46047
+ const response = await context.fetch(`${baseUrl}/api/version`, {
46048
+ headers
46049
+ });
46050
+ if (!response.ok) return void 0;
46051
+ return readBackendVersion(await response.json());
46052
+ } catch {
46053
+ return void 0;
46054
+ }
46055
+ }
44759
46056
  async function exportFolder(baseUrl, headers, output, context) {
44760
46057
  const response = await context.fetch(
44761
46058
  `${baseUrl}/api/config-bundles/export?format=zip`,
@@ -45272,9 +46569,13 @@ async function validateTenantConfig(scope, parsed, context) {
45272
46569
  rootPath,
45273
46570
  basename6(rootPath),
45274
46571
  schemas,
45275
- context.env
46572
+ context.env,
46573
+ // As the backend loads the folder from CONFIG_FOLDER.
46574
+ { folderVariablePolicy: true }
45276
46575
  )
45277
- ] : await validateTenantsRoot(rootPath, schemas, context.env);
46576
+ ] : await validateTenantsRoot(rootPath, schemas, context.env, {
46577
+ folderVariablePolicy: true
46578
+ });
45278
46579
  context.stdout.write(
45279
46580
  format2 === "json" ? `${JSON.stringify(buildJsonReport(results), null, 2)}
45280
46581
  ` : formatTextReport(scope, rootPath, results)
@@ -46946,7 +48247,7 @@ function createDeploymentCommands(context, setExitCode) {
46946
48247
  // package.json
46947
48248
  var package_default = {
46948
48249
  name: "@eudiplo/cli",
46949
- version: "10.1.0-main.cdfd658",
48250
+ version: "10.1.0-main.d5e40bd",
46950
48251
  description: "Deployment-aware command line tools for EUDIPLO",
46951
48252
  private: false,
46952
48253
  type: "module",
@@ -47084,99 +48385,6 @@ function withTrailingSlash(url) {
47084
48385
  return url.href.endsWith("/") ? url : new URL(`${url.href}/`);
47085
48386
  }
47086
48387
 
47087
- // src/services/backend-checks.ts
47088
- function compareVersions(cliVersion, backendVersion) {
47089
- const name = "version compatibility";
47090
- const cli = parse4(cliVersion);
47091
- const backend = parse4(backendVersion);
47092
- if (!cli || !backend) {
47093
- return {
47094
- name,
47095
- status: "warn",
47096
- message: `CLI ${cliVersion} and backend ${backendVersion} cannot be compared as versions.`
47097
- };
47098
- }
47099
- if (cli.major !== backend.major) {
47100
- return {
47101
- name,
47102
- status: "fail",
47103
- message: `CLI ${cliVersion} and backend ${backendVersion} are different major versions. Install a matching CLI with npm install -g @eudiplo/cli@${backend.major}.`
47104
- };
47105
- }
47106
- if (cli.minor !== backend.minor) {
47107
- return {
47108
- name,
47109
- status: "warn",
47110
- message: `CLI ${cliVersion} and backend ${backendVersion} differ in minor version; some commands may not be supported.`
47111
- };
47112
- }
47113
- return {
47114
- name,
47115
- status: "pass",
47116
- message: `CLI ${cliVersion} matches backend ${backendVersion}.`
47117
- };
47118
- }
47119
- function readBackendVersion(body) {
47120
- if (typeof body === "object" && body !== null && "version" in body) {
47121
- const version = body.version;
47122
- return typeof version === "string" && version ? version : void 0;
47123
- }
47124
- return void 0;
47125
- }
47126
- function readProviderHealth(body) {
47127
- if (!Array.isArray(body)) {
47128
- throw new Error("the provider health response was not a list");
47129
- }
47130
- return body.map((entry) => {
47131
- const record = entry;
47132
- return {
47133
- providerId: String(record.providerId ?? "unknown"),
47134
- type: String(record.type ?? "unknown"),
47135
- ok: record.ok === true,
47136
- latencyMs: typeof record.latencyMs === "number" ? record.latencyMs : void 0,
47137
- error: typeof record.error === "string" ? record.error : void 0
47138
- };
47139
- });
47140
- }
47141
- function summarizeProviderHealth(providers) {
47142
- const name = "KMS providers";
47143
- if (providers.length === 0) {
47144
- return {
47145
- name,
47146
- status: "warn",
47147
- message: "No KMS providers are registered for this tenant."
47148
- };
47149
- }
47150
- const failing = providers.filter((provider) => !provider.ok);
47151
- if (failing.length > 0) {
47152
- return {
47153
- name,
47154
- status: "fail",
47155
- message: `${failing.length}/${providers.length} provider(s) unhealthy: ${failing.map(
47156
- (provider) => `${provider.providerId} (${provider.type})${provider.error ? ", health check reported an error" : ""}`
47157
- ).join(", ")}`
47158
- };
47159
- }
47160
- return {
47161
- name,
47162
- status: "pass",
47163
- message: `${providers.length} provider(s) healthy: ${providers.map(
47164
- (provider) => `${provider.providerId} (${provider.type}${provider.latencyMs === void 0 ? "" : `, ${provider.latencyMs}ms`})`
47165
- ).join(", ")}`
47166
- };
47167
- }
47168
- function parse4(version) {
47169
- const match = /^v?(\d+)\.(\d+)\.(\d+)/.exec(version.trim());
47170
- if (!match) {
47171
- return void 0;
47172
- }
47173
- return {
47174
- major: Number(match[1]),
47175
- minor: Number(match[2]),
47176
- patch: Number(match[3])
47177
- };
47178
- }
47179
-
47180
48388
  // src/services/tls-expiry.ts
47181
48389
  import { connect } from "node:tls";
47182
48390
  var defaultExpiryWarningDays = 30;
@@ -47356,15 +48564,15 @@ var versionCompatibilityCheck = {
47356
48564
  message: `The backend version could not be read: ${response.reason}`
47357
48565
  };
47358
48566
  }
47359
- const backendVersion = readBackendVersion(response.body);
47360
- if (!backendVersion) {
48567
+ const backendVersion2 = readBackendVersion(response.body);
48568
+ if (!backendVersion2) {
47361
48569
  return {
47362
48570
  name: "version compatibility",
47363
48571
  status: "warn",
47364
48572
  message: "The backend did not report a version."
47365
48573
  };
47366
48574
  }
47367
- return compareVersions(package_default.version, backendVersion);
48575
+ return compareVersions(package_default.version, backendVersion2);
47368
48576
  })
47369
48577
  };
47370
48578
  var kmsHealthCheck = {
@@ -47394,7 +48602,7 @@ var kmsHealthCheck = {
47394
48602
  return {
47395
48603
  name: "KMS providers",
47396
48604
  status: "skip",
47397
- message: `Needs a tenant client with issuance:manage, presentation:manage or keys:manage (${response.reason}).`
48605
+ message: `Needs a tenant client with issuance:read, presentation:read or keys:manage, or a role that includes one of them (${response.reason}).`
47398
48606
  };
47399
48607
  }
47400
48608
  return {