gdc-common-utils-ts 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/constants/cryptography.d.ts +23 -0
- package/dist/constants/cryptography.js +13 -0
- package/dist/constants/eu-countries.d.ts +36 -0
- package/dist/constants/eu-countries.js +69 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/schemaorg.d.ts +34 -0
- package/dist/constants/schemaorg.js +35 -0
- package/dist/constants/service-capabilities.d.ts +5 -0
- package/dist/constants/service-capabilities.js +9 -0
- package/dist/constants/urn.d.ts +11 -0
- package/dist/constants/urn.js +11 -0
- package/dist/examples/dataspace-discovery.d.ts +88 -0
- package/dist/examples/dataspace-discovery.js +129 -0
- package/dist/examples/ica-activation-proof.d.ts +29 -20
- package/dist/examples/ica-activation-proof.js +35 -25
- package/dist/examples/index.d.ts +1 -0
- package/dist/examples/index.js +1 -0
- package/dist/examples/shared.d.ts +20 -0
- package/dist/examples/shared.js +16 -0
- package/dist/interfaces/Cryptography.types.d.ts +9 -1
- package/dist/models/dataspace-discovery.d.ts +66 -0
- package/dist/models/dataspace-discovery.js +9 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/utils/dataspace-discovery.d.ts +146 -0
- package/dist/utils/dataspace-discovery.js +341 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/vp-token.d.ts +24 -1
- package/dist/utils/vp-token.js +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,6 +86,9 @@ import { JweObject, JwtCompactParts } from 'gdc-common-utils-ts/models';
|
|
|
86
86
|
|
|
87
87
|
## Cross-Repo Task Docs
|
|
88
88
|
|
|
89
|
+
- [docs/DATASPACE_DISCOVERY_ROADMAP.md](docs/DATASPACE_DISCOVERY_ROADMAP.md)
|
|
90
|
+
- cross-repo contract for dataspace discovery semantics, EU coverage
|
|
91
|
+
inference, shared DTOs, and parameterized examples
|
|
89
92
|
- [docs/consent-access-matrix-task.md](docs/consent-access-matrix-task.md)
|
|
90
93
|
- next-step design/task document for active consent aggregation, explicit deny precedence, controller views, permission-request communications, and SMART access evaluation
|
|
91
94
|
|
|
@@ -14,6 +14,29 @@ export declare const CommunicationKeyPurposes: {
|
|
|
14
14
|
readonly CommunicationSignature: "comm_sig";
|
|
15
15
|
readonly VerifiableCredentialSignature: "vc_sign";
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Classical JOSE signature algorithms currently recognized across GDC VP/JWT
|
|
19
|
+
* examples and gateway trust adapters.
|
|
20
|
+
*
|
|
21
|
+
* Notes:
|
|
22
|
+
* - `ES256K` is the JOSE name for ECDSA over `secp256k1`
|
|
23
|
+
* - `ES384` remains the common P-384 legacy example in current GW fixtures
|
|
24
|
+
*/
|
|
25
|
+
export declare const ClassicalJoseSignatureAlgorithms: {
|
|
26
|
+
readonly Es256: "ES256";
|
|
27
|
+
readonly Es256K: "ES256K";
|
|
28
|
+
readonly Es384: "ES384";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* JOSE signature algorithms accepted by shared VP/JWT helpers.
|
|
32
|
+
*
|
|
33
|
+
* This intentionally covers both:
|
|
34
|
+
* - classical ECDSA JOSE algorithms (`ES256`, `ES256K`, `ES384`)
|
|
35
|
+
* - post-quantum ML-DSA JOSE algorithm labels already used by GW
|
|
36
|
+
*
|
|
37
|
+
* Use this type when a helper builds or documents a JWS/JWT/VP proof header.
|
|
38
|
+
*/
|
|
39
|
+
export type JoseSignatureAlgorithm = typeof ClassicalJoseSignatureAlgorithms[keyof typeof ClassicalJoseSignatureAlgorithms] | MldsaAlg;
|
|
17
40
|
/**
|
|
18
41
|
* Default post-quantum signing algorithms used for communication bootstrap.
|
|
19
42
|
*/
|
|
@@ -15,6 +15,19 @@ export const CommunicationKeyPurposes = {
|
|
|
15
15
|
CommunicationSignature: 'comm_sig',
|
|
16
16
|
VerifiableCredentialSignature: 'vc_sign',
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Classical JOSE signature algorithms currently recognized across GDC VP/JWT
|
|
20
|
+
* examples and gateway trust adapters.
|
|
21
|
+
*
|
|
22
|
+
* Notes:
|
|
23
|
+
* - `ES256K` is the JOSE name for ECDSA over `secp256k1`
|
|
24
|
+
* - `ES384` remains the common P-384 legacy example in current GW fixtures
|
|
25
|
+
*/
|
|
26
|
+
export const ClassicalJoseSignatureAlgorithms = {
|
|
27
|
+
Es256: 'ES256',
|
|
28
|
+
Es256K: 'ES256K',
|
|
29
|
+
Es384: 'ES384',
|
|
30
|
+
};
|
|
18
31
|
/**
|
|
19
32
|
* Default post-quantum signing algorithms used for communication bootstrap.
|
|
20
33
|
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ISO 3166-1 alpha-2 country codes that currently belong to the European Union.
|
|
3
|
+
*
|
|
4
|
+
* This list is intentionally kept in a runtime-neutral shared package because
|
|
5
|
+
* dataspace discovery may need to infer a broader coverage scope such as `EU`
|
|
6
|
+
* from the semantic country carried in a VC `credentialSubject`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EU_COUNTRY_CODES: readonly ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE"];
|
|
9
|
+
export type EuCountryCode = typeof EU_COUNTRY_CODES[number];
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes a country code into canonical uppercase ISO-2 form.
|
|
12
|
+
*
|
|
13
|
+
* @param countryCode Country code from `credentialSubject.address.addressCountry`
|
|
14
|
+
* or the flattened operational projection.
|
|
15
|
+
* @returns Uppercase ISO-2 form or an empty string when the input is blank.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* normalizeCountryCode('es');
|
|
20
|
+
* // 'ES'
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalizeCountryCode(countryCode: string | undefined | null): string;
|
|
24
|
+
/**
|
|
25
|
+
* Checks whether the supplied country code belongs to the current EU member set.
|
|
26
|
+
*
|
|
27
|
+
* @param countryCode ISO-2 country code to evaluate.
|
|
28
|
+
* @returns `true` when the normalized code belongs to `EU_COUNTRY_CODES`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* isEuCountryCode('ES');
|
|
33
|
+
* // true
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function isEuCountryCode(countryCode: string | undefined | null): boolean;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
/**
|
|
3
|
+
* ISO 3166-1 alpha-2 country codes that currently belong to the European Union.
|
|
4
|
+
*
|
|
5
|
+
* This list is intentionally kept in a runtime-neutral shared package because
|
|
6
|
+
* dataspace discovery may need to infer a broader coverage scope such as `EU`
|
|
7
|
+
* from the semantic country carried in a VC `credentialSubject`.
|
|
8
|
+
*/
|
|
9
|
+
export const EU_COUNTRY_CODES = Object.freeze([
|
|
10
|
+
'AT',
|
|
11
|
+
'BE',
|
|
12
|
+
'BG',
|
|
13
|
+
'HR',
|
|
14
|
+
'CY',
|
|
15
|
+
'CZ',
|
|
16
|
+
'DK',
|
|
17
|
+
'EE',
|
|
18
|
+
'FI',
|
|
19
|
+
'FR',
|
|
20
|
+
'DE',
|
|
21
|
+
'GR',
|
|
22
|
+
'HU',
|
|
23
|
+
'IE',
|
|
24
|
+
'IT',
|
|
25
|
+
'LV',
|
|
26
|
+
'LT',
|
|
27
|
+
'LU',
|
|
28
|
+
'MT',
|
|
29
|
+
'NL',
|
|
30
|
+
'PL',
|
|
31
|
+
'PT',
|
|
32
|
+
'RO',
|
|
33
|
+
'SK',
|
|
34
|
+
'SI',
|
|
35
|
+
'ES',
|
|
36
|
+
'SE',
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* Normalizes a country code into canonical uppercase ISO-2 form.
|
|
40
|
+
*
|
|
41
|
+
* @param countryCode Country code from `credentialSubject.address.addressCountry`
|
|
42
|
+
* or the flattened operational projection.
|
|
43
|
+
* @returns Uppercase ISO-2 form or an empty string when the input is blank.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* normalizeCountryCode('es');
|
|
48
|
+
* // 'ES'
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function normalizeCountryCode(countryCode) {
|
|
52
|
+
return String(countryCode || '').trim().toUpperCase();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Checks whether the supplied country code belongs to the current EU member set.
|
|
56
|
+
*
|
|
57
|
+
* @param countryCode ISO-2 country code to evaluate.
|
|
58
|
+
* @returns `true` when the normalized code belongs to `EU_COUNTRY_CODES`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* isEuCountryCode('ES');
|
|
63
|
+
* // true
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function isEuCountryCode(countryCode) {
|
|
67
|
+
const normalized = normalizeCountryCode(countryCode);
|
|
68
|
+
return normalized ? EU_COUNTRY_CODES.includes(normalized) : false;
|
|
69
|
+
}
|
|
@@ -3,6 +3,7 @@ export * from './communication';
|
|
|
3
3
|
export * from './cryptography';
|
|
4
4
|
export * from './device';
|
|
5
5
|
export * from './did-services';
|
|
6
|
+
export * from './eu-countries';
|
|
6
7
|
export * from './fhir-code-systems';
|
|
7
8
|
export * from './fhir-resource-types';
|
|
8
9
|
export * from './fhir-versions';
|
|
@@ -14,4 +15,5 @@ export * from './network';
|
|
|
14
15
|
export * from './sectors';
|
|
15
16
|
export * from './smart';
|
|
16
17
|
export * from './service-capabilities';
|
|
18
|
+
export * from './urn';
|
|
17
19
|
export * from './verifiable-credentials';
|
package/dist/constants/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './communication.js';
|
|
|
3
3
|
export * from './cryptography.js';
|
|
4
4
|
export * from './device.js';
|
|
5
5
|
export * from './did-services.js';
|
|
6
|
+
export * from './eu-countries.js';
|
|
6
7
|
export * from './fhir-code-systems.js';
|
|
7
8
|
export * from './fhir-resource-types.js';
|
|
8
9
|
export * from './fhir-versions.js';
|
|
@@ -14,4 +15,5 @@ export * from './network.js';
|
|
|
14
15
|
export * from './sectors.js';
|
|
15
16
|
export * from './smart.js';
|
|
16
17
|
export * from './service-capabilities.js';
|
|
18
|
+
export * from './urn.js';
|
|
17
19
|
export * from './verifiable-credentials.js';
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import { ParameterData } from "../models/params";
|
|
2
2
|
export declare enum ClaimsServiceSchemaorg {
|
|
3
|
+
areaServed = "org.schema.Service.areaServed",
|
|
3
4
|
category = "org.schema.Service.category",
|
|
4
5
|
identifier = "org.schema.Service.identifier",
|
|
5
6
|
serviceType = "org.schema.Service.serviceType",
|
|
6
7
|
termsOfService = "org.schema.Service.termsOfService",
|
|
7
8
|
url = "org.schema.Service.url"
|
|
8
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Canonical claim names used by the current GDC profile when a VC models a
|
|
12
|
+
* `schema.org/SoftwareApplication`.
|
|
13
|
+
*
|
|
14
|
+
* Contract note:
|
|
15
|
+
* - `material` is the public cryptographic material of the software
|
|
16
|
+
* application in the current GDC profile, typically the communication
|
|
17
|
+
* signing key id bound by ICA to the software/application instance
|
|
18
|
+
* - when that identifier is expressed as a JWK thumbprint, RFC 7638 defines
|
|
19
|
+
* the canonical thumbprint calculation over the public signing /
|
|
20
|
+
* verification JWK and RFC 9278 defines the canonical URN form
|
|
21
|
+
* `urn:ietf:params:oauth:jwk-thumbprint:sha-256:<base64url>`
|
|
22
|
+
* - the controller-side signature belongs to the prior ICA registration step,
|
|
23
|
+
* not to every later app-service operational proof
|
|
24
|
+
*/
|
|
25
|
+
export declare enum ClaimsSoftwareApplicationSchemaorg {
|
|
26
|
+
id = "org.schema.SoftwareApplication.id",
|
|
27
|
+
name = "org.schema.SoftwareApplication.name",
|
|
28
|
+
url = "org.schema.SoftwareApplication.url",
|
|
29
|
+
sameAs = "org.schema.SoftwareApplication.sameAs",
|
|
30
|
+
/** Communication signing key id bound by the ICA-issued SoftwareApplication VC. */
|
|
31
|
+
material = "org.schema.SoftwareApplication.material"
|
|
32
|
+
}
|
|
9
33
|
/**
|
|
10
34
|
* Defines the canonical claim names for the 'org.schema' context,
|
|
11
35
|
* based on Schema.org vocabulary.
|
|
@@ -39,6 +63,16 @@ export declare enum ClaimsOrganizationSchemaorg {
|
|
|
39
63
|
email = "org.schema.Organization.email",
|
|
40
64
|
/** Public contact phone */
|
|
41
65
|
telephone = "org.schema.Organization.telephone",
|
|
66
|
+
/**
|
|
67
|
+
* Public cryptographic material of the organization in VC/profile payloads.
|
|
68
|
+
*
|
|
69
|
+
* When represented as a JWK thumbprint identifier:
|
|
70
|
+
* - RFC 7638 defines the canonical thumbprint calculation over the public
|
|
71
|
+
* signing / verification JWK
|
|
72
|
+
* - RFC 9278 defines the canonical URN form
|
|
73
|
+
* `urn:ietf:params:oauth:jwk-thumbprint:sha-256:<base64url>`
|
|
74
|
+
*/
|
|
75
|
+
hasCredentialMaterial = "org.schema.Organization.hasCredential.material",
|
|
42
76
|
/** Individual/family owner email used by subject-index registration flows. */
|
|
43
77
|
ownerEmail = "org.schema.Organization.owner.email",
|
|
44
78
|
/** Individual/family owner telephone used by subject-index registration flows. */
|
|
@@ -2,12 +2,37 @@
|
|
|
2
2
|
// File: src/models/schemaorg.ts
|
|
3
3
|
export var ClaimsServiceSchemaorg;
|
|
4
4
|
(function (ClaimsServiceSchemaorg) {
|
|
5
|
+
ClaimsServiceSchemaorg["areaServed"] = "org.schema.Service.areaServed";
|
|
5
6
|
ClaimsServiceSchemaorg["category"] = "org.schema.Service.category";
|
|
6
7
|
ClaimsServiceSchemaorg["identifier"] = "org.schema.Service.identifier";
|
|
7
8
|
ClaimsServiceSchemaorg["serviceType"] = "org.schema.Service.serviceType";
|
|
8
9
|
ClaimsServiceSchemaorg["termsOfService"] = "org.schema.Service.termsOfService";
|
|
9
10
|
ClaimsServiceSchemaorg["url"] = "org.schema.Service.url";
|
|
10
11
|
})(ClaimsServiceSchemaorg || (ClaimsServiceSchemaorg = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Canonical claim names used by the current GDC profile when a VC models a
|
|
14
|
+
* `schema.org/SoftwareApplication`.
|
|
15
|
+
*
|
|
16
|
+
* Contract note:
|
|
17
|
+
* - `material` is the public cryptographic material of the software
|
|
18
|
+
* application in the current GDC profile, typically the communication
|
|
19
|
+
* signing key id bound by ICA to the software/application instance
|
|
20
|
+
* - when that identifier is expressed as a JWK thumbprint, RFC 7638 defines
|
|
21
|
+
* the canonical thumbprint calculation over the public signing /
|
|
22
|
+
* verification JWK and RFC 9278 defines the canonical URN form
|
|
23
|
+
* `urn:ietf:params:oauth:jwk-thumbprint:sha-256:<base64url>`
|
|
24
|
+
* - the controller-side signature belongs to the prior ICA registration step,
|
|
25
|
+
* not to every later app-service operational proof
|
|
26
|
+
*/
|
|
27
|
+
export var ClaimsSoftwareApplicationSchemaorg;
|
|
28
|
+
(function (ClaimsSoftwareApplicationSchemaorg) {
|
|
29
|
+
ClaimsSoftwareApplicationSchemaorg["id"] = "org.schema.SoftwareApplication.id";
|
|
30
|
+
ClaimsSoftwareApplicationSchemaorg["name"] = "org.schema.SoftwareApplication.name";
|
|
31
|
+
ClaimsSoftwareApplicationSchemaorg["url"] = "org.schema.SoftwareApplication.url";
|
|
32
|
+
ClaimsSoftwareApplicationSchemaorg["sameAs"] = "org.schema.SoftwareApplication.sameAs";
|
|
33
|
+
/** Communication signing key id bound by the ICA-issued SoftwareApplication VC. */
|
|
34
|
+
ClaimsSoftwareApplicationSchemaorg["material"] = "org.schema.SoftwareApplication.material";
|
|
35
|
+
})(ClaimsSoftwareApplicationSchemaorg || (ClaimsSoftwareApplicationSchemaorg = {}));
|
|
11
36
|
/**
|
|
12
37
|
* Defines the canonical claim names for the 'org.schema' context,
|
|
13
38
|
* based on Schema.org vocabulary.
|
|
@@ -42,6 +67,16 @@ export var ClaimsOrganizationSchemaorg;
|
|
|
42
67
|
ClaimsOrganizationSchemaorg["email"] = "org.schema.Organization.email";
|
|
43
68
|
/** Public contact phone */
|
|
44
69
|
ClaimsOrganizationSchemaorg["telephone"] = "org.schema.Organization.telephone";
|
|
70
|
+
/**
|
|
71
|
+
* Public cryptographic material of the organization in VC/profile payloads.
|
|
72
|
+
*
|
|
73
|
+
* When represented as a JWK thumbprint identifier:
|
|
74
|
+
* - RFC 7638 defines the canonical thumbprint calculation over the public
|
|
75
|
+
* signing / verification JWK
|
|
76
|
+
* - RFC 9278 defines the canonical URN form
|
|
77
|
+
* `urn:ietf:params:oauth:jwk-thumbprint:sha-256:<base64url>`
|
|
78
|
+
*/
|
|
79
|
+
ClaimsOrganizationSchemaorg["hasCredentialMaterial"] = "org.schema.Organization.hasCredential.material";
|
|
45
80
|
/** Individual/family owner email used by subject-index registration flows. */
|
|
46
81
|
ClaimsOrganizationSchemaorg["ownerEmail"] = "org.schema.Organization.owner.email";
|
|
47
82
|
/** Individual/family owner telephone used by subject-index registration flows. */
|
|
@@ -75,3 +75,8 @@ export declare function getServiceCapabilityFamily(value: string | undefined): s
|
|
|
75
75
|
* family.
|
|
76
76
|
*/
|
|
77
77
|
export declare function hasServiceCapabilityFamily(value: unknown, family: ServiceCapabilityFamilyValue | string): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Returns whether a capability token denotes a discoverable provider/service
|
|
80
|
+
* role rather than a reader-only role.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isProviderServiceCapability(value: string | undefined | null): boolean;
|
|
@@ -94,3 +94,12 @@ export function hasServiceCapabilityFamily(value, family) {
|
|
|
94
94
|
return false;
|
|
95
95
|
return parseServiceCapabilityTokens(value).some((item) => getServiceCapabilityFamily(item) === normalizedFamily);
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns whether a capability token denotes a discoverable provider/service
|
|
99
|
+
* role rather than a reader-only role.
|
|
100
|
+
*/
|
|
101
|
+
export function isProviderServiceCapability(value) {
|
|
102
|
+
const normalized = String(value || '').trim().toLowerCase();
|
|
103
|
+
return normalized === ServiceCapabilityToken.IndexProvider
|
|
104
|
+
|| normalized === ServiceCapabilityToken.DigitalTwinProvider;
|
|
105
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical URN prefixes reused across bootstrap and proof examples.
|
|
3
|
+
*
|
|
4
|
+
* The JWK thumbprint URI prefix below follows RFC 9278 and is intended for
|
|
5
|
+
* cases where a key identifier is represented as a normalized URI instead of
|
|
6
|
+
* as a bare base64url thumbprint value.
|
|
7
|
+
*/
|
|
8
|
+
export declare const UrnPrefixes: Readonly<{
|
|
9
|
+
readonly JwkThumbprintSha256KeyId: "urn:ietf:params:oauth:jwk-thumbprint:sha-256:";
|
|
10
|
+
}>;
|
|
11
|
+
export type UrnPrefix = typeof UrnPrefixes[keyof typeof UrnPrefixes];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
/**
|
|
3
|
+
* Canonical URN prefixes reused across bootstrap and proof examples.
|
|
4
|
+
*
|
|
5
|
+
* The JWK thumbprint URI prefix below follows RFC 9278 and is intended for
|
|
6
|
+
* cases where a key identifier is represented as a normalized URI instead of
|
|
7
|
+
* as a bare base64url thumbprint value.
|
|
8
|
+
*/
|
|
9
|
+
export const UrnPrefixes = Object.freeze({
|
|
10
|
+
JwkThumbprintSha256KeyId: 'urn:ietf:params:oauth:jwk-thumbprint:sha-256:',
|
|
11
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { HostingOperatorDiscoveryCatalog, PublishedProviderCatalogRecord } from '../models/dataspace-discovery';
|
|
2
|
+
export type ExampleDataspaceCredentialSubjectInput = Readonly<{
|
|
3
|
+
did?: string;
|
|
4
|
+
serviceTypes?: readonly string[];
|
|
5
|
+
categories?: readonly string[];
|
|
6
|
+
areaServed?: readonly string[];
|
|
7
|
+
addressCountry?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a synthetic hosting-operator semantic `credentialSubject`.
|
|
11
|
+
*
|
|
12
|
+
* This example is parameterized on purpose: public docs/tests must not hardcode
|
|
13
|
+
* business identities when demonstrating dataspace discovery semantics.
|
|
14
|
+
*
|
|
15
|
+
* @param input Optional overrides for the synthetic subject.
|
|
16
|
+
* @returns Schema.org-shaped semantic subject with service metadata.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildExampleHostingOperatorCredentialSubject(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
19
|
+
id: string;
|
|
20
|
+
serviceType: string;
|
|
21
|
+
category: string;
|
|
22
|
+
areaServed: {
|
|
23
|
+
'@type': string;
|
|
24
|
+
name: string;
|
|
25
|
+
}[];
|
|
26
|
+
address: {
|
|
27
|
+
addressCountry: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Builds a synthetic tenant-service semantic `credentialSubject`.
|
|
32
|
+
*
|
|
33
|
+
* @param input Optional overrides for the synthetic tenant subject.
|
|
34
|
+
* @returns Schema.org-shaped semantic subject with public service metadata.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildExampleTenantServiceCredentialSubject(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
37
|
+
id: string;
|
|
38
|
+
serviceType: string;
|
|
39
|
+
category: string;
|
|
40
|
+
areaServed: {
|
|
41
|
+
'@type': string;
|
|
42
|
+
name: string;
|
|
43
|
+
}[];
|
|
44
|
+
address: {
|
|
45
|
+
addressCountry: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Builds the flattened `meta.claims` projection for a hosting-operator semantic
|
|
50
|
+
* subject.
|
|
51
|
+
*
|
|
52
|
+
* @param input Optional overrides for the synthetic projection.
|
|
53
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildExampleHostingOperatorMetaClaims(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
56
|
+
"org.schema.Service.serviceType": string | undefined;
|
|
57
|
+
"org.schema.Service.category": string;
|
|
58
|
+
"org.schema.Service.areaServed": string;
|
|
59
|
+
"org.schema.Organization.address.addressCountry": string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Builds the flattened `meta.claims` projection for a tenant-service semantic
|
|
63
|
+
* subject.
|
|
64
|
+
*
|
|
65
|
+
* @param input Optional overrides for the synthetic projection.
|
|
66
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildExampleTenantServiceMetaClaims(input?: ExampleDataspaceCredentialSubjectInput): {
|
|
69
|
+
"org.schema.Service.serviceType": string | undefined;
|
|
70
|
+
"org.schema.Service.category": string;
|
|
71
|
+
"org.schema.Service.areaServed": string;
|
|
72
|
+
"org.schema.Organization.address.addressCountry": string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Builds a synthetic published-provider record as it would appear in a host
|
|
76
|
+
* service-autodiscovery catalog.
|
|
77
|
+
*
|
|
78
|
+
* @param input Optional overrides for the synthetic provider publication.
|
|
79
|
+
* @returns Shared host-catalog provider entry.
|
|
80
|
+
*/
|
|
81
|
+
export declare function buildExamplePublishedProviderCatalogRecord(input?: ExampleDataspaceCredentialSubjectInput): PublishedProviderCatalogRecord;
|
|
82
|
+
/**
|
|
83
|
+
* Builds a synthetic host/operator service-autodiscovery catalog.
|
|
84
|
+
*
|
|
85
|
+
* @param providers Optional published providers to include.
|
|
86
|
+
* @returns Shared catalog DTO for host-side public service autodiscovery.
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildExampleHostingOperatorDiscoveryCatalog(providers?: ReadonlyArray<PublishedProviderCatalogRecord>): HostingOperatorDiscoveryCatalog;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { ClaimsOrganizationSchemaorg, ClaimsServiceSchemaorg } from '../constants/schemaorg.js';
|
|
3
|
+
import { serializeServiceCapabilityTokens, ServiceCapabilityToken } from '../constants/service-capabilities.js';
|
|
4
|
+
import { EXAMPLE_HOSTING_OPERATOR_CATALOG_URL, EXAMPLE_HOSTING_OPERATOR_DID, EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL, EXAMPLE_JURISDICTION, EXAMPLE_SECTOR, EXAMPLE_TENANT_SERVICE_DID, } from './shared.js';
|
|
5
|
+
function firstOrCsv(values) {
|
|
6
|
+
return values.length <= 1 ? (values[0] || '') : values.join(',');
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Builds a synthetic hosting-operator semantic `credentialSubject`.
|
|
10
|
+
*
|
|
11
|
+
* This example is parameterized on purpose: public docs/tests must not hardcode
|
|
12
|
+
* business identities when demonstrating dataspace discovery semantics.
|
|
13
|
+
*
|
|
14
|
+
* @param input Optional overrides for the synthetic subject.
|
|
15
|
+
* @returns Schema.org-shaped semantic subject with service metadata.
|
|
16
|
+
*/
|
|
17
|
+
export function buildExampleHostingOperatorCredentialSubject(input = {}) {
|
|
18
|
+
const serviceTypes = input.serviceTypes || [
|
|
19
|
+
ServiceCapabilityToken.IndexProvider,
|
|
20
|
+
ServiceCapabilityToken.DigitalTwinProvider,
|
|
21
|
+
];
|
|
22
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
23
|
+
const areaServed = input.areaServed || ['EU', EXAMPLE_JURISDICTION];
|
|
24
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
25
|
+
return {
|
|
26
|
+
id: input.did || 'did:web:host.example.org',
|
|
27
|
+
serviceType: firstOrCsv(serviceTypes),
|
|
28
|
+
category: firstOrCsv(categories),
|
|
29
|
+
areaServed: areaServed.map((name) => ({ '@type': 'AdministrativeArea', name })),
|
|
30
|
+
address: {
|
|
31
|
+
addressCountry,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds a synthetic tenant-service semantic `credentialSubject`.
|
|
37
|
+
*
|
|
38
|
+
* @param input Optional overrides for the synthetic tenant subject.
|
|
39
|
+
* @returns Schema.org-shaped semantic subject with public service metadata.
|
|
40
|
+
*/
|
|
41
|
+
export function buildExampleTenantServiceCredentialSubject(input = {}) {
|
|
42
|
+
const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
|
|
43
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
44
|
+
const areaServed = input.areaServed || ['EU'];
|
|
45
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
46
|
+
return {
|
|
47
|
+
id: input.did || 'did:web:provider.example.org',
|
|
48
|
+
serviceType: firstOrCsv(serviceTypes),
|
|
49
|
+
category: firstOrCsv(categories),
|
|
50
|
+
areaServed: areaServed.map((name) => ({ '@type': 'AdministrativeArea', name })),
|
|
51
|
+
address: {
|
|
52
|
+
addressCountry,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Builds the flattened `meta.claims` projection for a hosting-operator semantic
|
|
58
|
+
* subject.
|
|
59
|
+
*
|
|
60
|
+
* @param input Optional overrides for the synthetic projection.
|
|
61
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
62
|
+
*/
|
|
63
|
+
export function buildExampleHostingOperatorMetaClaims(input = {}) {
|
|
64
|
+
const serviceTypes = input.serviceTypes || [
|
|
65
|
+
ServiceCapabilityToken.IndexProvider,
|
|
66
|
+
ServiceCapabilityToken.DigitalTwinProvider,
|
|
67
|
+
];
|
|
68
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
69
|
+
const areaServed = input.areaServed || ['EU', EXAMPLE_JURISDICTION];
|
|
70
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
71
|
+
return {
|
|
72
|
+
[ClaimsServiceSchemaorg.serviceType]: serializeServiceCapabilityTokens(serviceTypes),
|
|
73
|
+
[ClaimsServiceSchemaorg.category]: firstOrCsv(categories),
|
|
74
|
+
[ClaimsServiceSchemaorg.areaServed]: firstOrCsv(areaServed),
|
|
75
|
+
[ClaimsOrganizationSchemaorg.addressCountry]: addressCountry,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Builds the flattened `meta.claims` projection for a tenant-service semantic
|
|
80
|
+
* subject.
|
|
81
|
+
*
|
|
82
|
+
* @param input Optional overrides for the synthetic projection.
|
|
83
|
+
* @returns Flat operational claims derived from the semantic subject.
|
|
84
|
+
*/
|
|
85
|
+
export function buildExampleTenantServiceMetaClaims(input = {}) {
|
|
86
|
+
const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
|
|
87
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
88
|
+
const areaServed = input.areaServed || ['EU'];
|
|
89
|
+
const addressCountry = input.addressCountry || EXAMPLE_JURISDICTION;
|
|
90
|
+
return {
|
|
91
|
+
[ClaimsServiceSchemaorg.serviceType]: serializeServiceCapabilityTokens(serviceTypes),
|
|
92
|
+
[ClaimsServiceSchemaorg.category]: firstOrCsv(categories),
|
|
93
|
+
[ClaimsServiceSchemaorg.areaServed]: firstOrCsv(areaServed),
|
|
94
|
+
[ClaimsOrganizationSchemaorg.addressCountry]: addressCountry,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Builds a synthetic published-provider record as it would appear in a host
|
|
99
|
+
* service-autodiscovery catalog.
|
|
100
|
+
*
|
|
101
|
+
* @param input Optional overrides for the synthetic provider publication.
|
|
102
|
+
* @returns Shared host-catalog provider entry.
|
|
103
|
+
*/
|
|
104
|
+
export function buildExamplePublishedProviderCatalogRecord(input = {}) {
|
|
105
|
+
const serviceTypes = input.serviceTypes || [ServiceCapabilityToken.IndexProvider];
|
|
106
|
+
const categories = input.categories || [EXAMPLE_SECTOR];
|
|
107
|
+
const areaServed = input.areaServed || ['EU'];
|
|
108
|
+
return {
|
|
109
|
+
providerDid: input.did || EXAMPLE_TENANT_SERVICE_DID,
|
|
110
|
+
serviceType: serviceTypes[0] || ServiceCapabilityToken.IndexProvider,
|
|
111
|
+
category: categories[0] || EXAMPLE_SECTOR,
|
|
112
|
+
areaServed: areaServed[0] || 'EU',
|
|
113
|
+
endpointUrl: EXAMPLE_PROVIDER_PUBLISHED_ENDPOINT_URL,
|
|
114
|
+
catalogUrl: EXAMPLE_HOSTING_OPERATOR_CATALOG_URL,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Builds a synthetic host/operator service-autodiscovery catalog.
|
|
119
|
+
*
|
|
120
|
+
* @param providers Optional published providers to include.
|
|
121
|
+
* @returns Shared catalog DTO for host-side public service autodiscovery.
|
|
122
|
+
*/
|
|
123
|
+
export function buildExampleHostingOperatorDiscoveryCatalog(providers = [buildExamplePublishedProviderCatalogRecord()]) {
|
|
124
|
+
return {
|
|
125
|
+
hostingOperatorDid: EXAMPLE_HOSTING_OPERATOR_DID,
|
|
126
|
+
catalogUrl: EXAMPLE_HOSTING_OPERATOR_CATALOG_URL,
|
|
127
|
+
providers: [...providers],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -2,33 +2,42 @@
|
|
|
2
2
|
* Shared synthetic ICA activation-proof fixtures reused by docs/tests.
|
|
3
3
|
*
|
|
4
4
|
* Contract note:
|
|
5
|
-
* -
|
|
6
|
-
*
|
|
5
|
+
* - controller-signing/audience ids and VC subtype names must be imported from
|
|
6
|
+
* this module instead of re-hardcoded
|
|
7
|
+
* inline
|
|
7
8
|
* - the representative `hasCredential.material` shape below reflects the
|
|
8
9
|
* current `activation-policy` helper contract; if ICA finalizes a different
|
|
9
10
|
* VC shape, update this module first and then the dependent helpers/tests
|
|
11
|
+
*
|
|
12
|
+
* Modeling note:
|
|
13
|
+
* - this onboarding example intentionally anchors the business subject on the
|
|
14
|
+
* organization tax ID rather than on a pre-existing provider DID
|
|
15
|
+
* - the VP envelope uses a synthetic RFC 7638-style JWK-thumbprint urn and a
|
|
16
|
+
* host id, which better matches the initial registration stage than a
|
|
17
|
+
* synthetic did:web
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Synthetic JWK-thumbprint-based signing key id for the organization
|
|
21
|
+
* controller who signs the initial legal-onboarding VP.
|
|
10
22
|
*/
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const EXAMPLE_ICA_REPRESENTATIVE_ROLE_CODE: "RESPRSN";
|
|
18
|
-
export declare const EXAMPLE_ICA_REPRESENTATIVE_BINDING_MATERIAL: "controller-sig-kid";
|
|
19
|
-
export declare const EXAMPLE_ICA_ORGANIZATION_CREDENTIAL: Readonly<{
|
|
23
|
+
export declare const EXAMPLE_ORG_CONTROLLER_SIGNING_KEY_ID: "urn:ietf:params:oauth:jwk-thumbprint:sha-256:Q0ZfM0V4YW1wbGVUaHVtYnByaW50X2Jhc2U2NHVybA";
|
|
24
|
+
export declare const EXAMPLE_PRESENTATION_AUDIENCE_HOST_ID: "host:node-operator-es";
|
|
25
|
+
export declare const EXAMPLE_ORGANIZATION_TAX_ID: "ESB00112233";
|
|
26
|
+
export declare const EXAMPLE_REPRESENTATIVE_ROLE_CODE: "RESPRSN";
|
|
27
|
+
export declare const EXAMPLE_ORGANIZATION_ID: "ESB00112233";
|
|
28
|
+
export declare const EXAMPLE_ORG_ACTIVATION_ORGANIZATION_CREDENTIAL: Readonly<{
|
|
20
29
|
'@context': string[];
|
|
21
30
|
type: ("VerifiableCredential" | "OrganizationCredential")[];
|
|
22
31
|
credentialSubject: {
|
|
23
|
-
id: "
|
|
32
|
+
id: "ESB00112233";
|
|
24
33
|
taxID: "ESB00112233";
|
|
25
34
|
};
|
|
26
35
|
}>;
|
|
27
|
-
export declare const
|
|
36
|
+
export declare const EXAMPLE_ORG_ACTIVATION_LEGAL_REPRESENTATIVE_CREDENTIAL: Readonly<{
|
|
28
37
|
'@context': string[];
|
|
29
38
|
type: ("VerifiableCredential" | "LegalRepresentativeCredential")[];
|
|
30
39
|
credentialSubject: {
|
|
31
|
-
id: "
|
|
40
|
+
id: "urn:ietf:params:oauth:jwk-thumbprint:sha-256:Q0ZfM0V4YW1wbGVUaHVtYnByaW50X2Jhc2U2NHVybA";
|
|
32
41
|
memberOf: {
|
|
33
42
|
taxID: "ESB00112233";
|
|
34
43
|
};
|
|
@@ -38,18 +47,18 @@ export declare const EXAMPLE_ICA_LEGAL_REPRESENTATIVE_CREDENTIAL: Readonly<{
|
|
|
38
47
|
};
|
|
39
48
|
};
|
|
40
49
|
hasCredential: {
|
|
41
|
-
material: "
|
|
50
|
+
material: "urn:ietf:params:oauth:jwk-thumbprint:sha-256:Q0ZfM0V4YW1wbGVUaHVtYnByaW50X2Jhc2U2NHVybA";
|
|
42
51
|
};
|
|
43
52
|
};
|
|
44
53
|
}>;
|
|
45
|
-
export declare const
|
|
46
|
-
iss: "
|
|
47
|
-
sub: "
|
|
48
|
-
aud: "
|
|
54
|
+
export declare const EXAMPLE_ORG_ACTIVATION_PROOF_VP_PAYLOAD: Readonly<{
|
|
55
|
+
iss: "urn:ietf:params:oauth:jwk-thumbprint:sha-256:Q0ZfM0V4YW1wbGVUaHVtYnByaW50X2Jhc2U2NHVybA";
|
|
56
|
+
sub: "ESB00112233";
|
|
57
|
+
aud: "host:node-operator-es";
|
|
49
58
|
vp: {
|
|
50
59
|
'@context': "https://www.w3.org/2018/credentials/v1"[];
|
|
51
60
|
type: "VerifiablePresentation"[];
|
|
52
|
-
holder: "
|
|
61
|
+
holder: "urn:ietf:params:oauth:jwk-thumbprint:sha-256:Q0ZfM0V4YW1wbGVUaHVtYnByaW50X2Jhc2U2NHVybA";
|
|
53
62
|
verifiableCredential: string[];
|
|
54
63
|
};
|
|
55
64
|
}>;
|