gdc-common-utils-ts 2.5.19 → 2.5.21

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.
@@ -27,6 +27,8 @@ export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SUBJECT_DID: "did:web:
27
27
  export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SECTION: "LOINC|48765-2";
28
28
  export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_AGREEMENT_PDF_URL: "https://portal.example.org/files/contracts/inter-tenant-contract-acme-lab-001.pdf";
29
29
  export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CONSUMER_PROFESSIONAL_DID: "did:web:api.lab.org:employee:researcher1@lab.org:ISCO-08|2211";
30
+ export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_PROVIDER_AUTHORIZED_SIGNATORY_DID: "did:web:provider-signatory.example.org";
31
+ export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CONSUMER_AUTHORIZED_SIGNATORY_DID: "did:web:consumer-signatory.example.org";
30
32
  export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SMART_SCOPE: "organization/Composition.rs?subject=did:web:api.acme.org:individual:123&section=LOINC|48765-2";
31
33
  export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CLAIMS: Readonly<{
32
34
  readonly "Contract.identifier": "urn:uuid:inter-tenant-access-contract-001";
@@ -37,8 +39,8 @@ export declare const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CLAIMS: Readonly<{
37
39
  readonly "Contract.applies-end": "2027-06-29T00:00:00.000Z";
38
40
  readonly "Contract.provider-organization": "did:web:api.acme.org";
39
41
  readonly "Contract.consumer-organization": "did:web:api.lab.org";
40
- readonly "Contract.provider-authorized-signatory": "did:web:people.acme.org:controllers:primary";
41
- readonly "Contract.consumer-authorized-signatory": "did:web:people.lab.org:controllers:primary";
42
+ readonly "Contract.provider-authorized-signatory": "did:web:provider-signatory.example.org";
43
+ readonly "Contract.consumer-authorized-signatory": "did:web:consumer-signatory.example.org";
42
44
  readonly "Contract.security-label": "organization/Composition.rs";
43
45
  readonly "Contract.term-type": "HRESCH";
44
46
  readonly "Contract.instantiates-uri": "https://portal.example.org/files/contracts/inter-tenant-contract-acme-lab-001.pdf";
@@ -7,7 +7,7 @@ import { ClaimInterTenantAccessContract } from '../models/inter-tenant-access-co
7
7
  import { BundleEntryClaimsContext } from '../models/communication-attached-bundle-session.js';
8
8
  import { buildInterTenantAccessContractCredential, buildInterTenantAccessContractResource, getInterTenantAccessContractBlockchainReference, } from '../utils/inter-tenant-access-contract.js';
9
9
  import { buildMemberAuthorizationUrn, buildOrganizationAuthorizationUrn, } from '../utils/organization-authorization-urn.js';
10
- import { EXAMPLE_API_ORGANIZATION_DID, EXAMPLE_CONTROLLER_DID, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_JURISDICTION, EXAMPLE_RESEARCH_API_ORGANIZATION_DID, EXAMPLE_RESEARCH_CONTROLLER_DID, EXAMPLE_RESEARCH_TENANT_IDENTIFIER, EXAMPLE_SECTOR, EXAMPLE_TENANT_IDENTIFIER, } from './shared.js';
10
+ import { EXAMPLE_API_ORGANIZATION_DID, EXAMPLE_CONTROLLER_DID, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_JURISDICTION, EXAMPLE_RESEARCH_API_ORGANIZATION_DID, EXAMPLE_RESEARCH_TENANT_IDENTIFIER, EXAMPLE_SECTOR, EXAMPLE_TENANT_IDENTIFIER, } from './shared.js';
11
11
  /**
12
12
  * Shared synthetic inter-tenant contract fixtures reused by GW and SDK tests.
13
13
  *
@@ -37,6 +37,8 @@ export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SUBJECT_DID = 'did:web:api.acm
37
37
  export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SECTION = 'LOINC|48765-2';
38
38
  export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_AGREEMENT_PDF_URL = 'https://portal.example.org/files/contracts/inter-tenant-contract-acme-lab-001.pdf';
39
39
  export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CONSUMER_PROFESSIONAL_DID = `${EXAMPLE_RESEARCH_API_ORGANIZATION_DID}:employee:researcher1@lab.org:${EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN}`;
40
+ export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_PROVIDER_AUTHORIZED_SIGNATORY_DID = 'did:web:provider-signatory.example.org';
41
+ export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CONSUMER_AUTHORIZED_SIGNATORY_DID = 'did:web:consumer-signatory.example.org';
40
42
  export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SMART_SCOPE = `${EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SCOPE}?subject=${EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SUBJECT_DID}&section=${EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SECTION}`;
41
43
  export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CLAIMS = Object.freeze({
42
44
  [ClaimInterTenantAccessContract.identifier]: EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_ID,
@@ -47,8 +49,8 @@ export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CLAIMS = Object.freeze({
47
49
  [ClaimInterTenantAccessContract.appliesEnd]: EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_VALID_UNTIL,
48
50
  [ClaimInterTenantAccessContract.providerOrganization]: EXAMPLE_API_ORGANIZATION_DID,
49
51
  [ClaimInterTenantAccessContract.consumerOrganization]: EXAMPLE_RESEARCH_API_ORGANIZATION_DID,
50
- [ClaimInterTenantAccessContract.providerAuthorizedSignatory]: EXAMPLE_CONTROLLER_DID,
51
- [ClaimInterTenantAccessContract.consumerAuthorizedSignatory]: EXAMPLE_RESEARCH_CONTROLLER_DID,
52
+ [ClaimInterTenantAccessContract.providerAuthorizedSignatory]: EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_PROVIDER_AUTHORIZED_SIGNATORY_DID,
53
+ [ClaimInterTenantAccessContract.consumerAuthorizedSignatory]: EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CONSUMER_AUTHORIZED_SIGNATORY_DID,
52
54
  [ClaimInterTenantAccessContract.capability]: EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_SCOPE,
53
55
  [ClaimInterTenantAccessContract.purpose]: EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_PURPOSE,
54
56
  [ClaimInterTenantAccessContract.instantiatesUri]: EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_AGREEMENT_PDF_URL,
@@ -65,13 +67,13 @@ export const EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CREDENTIAL = Object.freeze(bui
65
67
  {
66
68
  type: 'JsonWebSignature2020',
67
69
  proofPurpose: 'contractAgreement',
68
- verificationMethod: `${EXAMPLE_CONTROLLER_DID}#contract-agreement`,
70
+ verificationMethod: `${EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_PROVIDER_AUTHORIZED_SIGNATORY_DID}#contract-agreement`,
69
71
  jws: 'provider-authorized-signatory-proof',
70
72
  },
71
73
  {
72
74
  type: 'JsonWebSignature2020',
73
75
  proofPurpose: 'contractAgreement',
74
- verificationMethod: `${EXAMPLE_RESEARCH_CONTROLLER_DID}#contract-agreement`,
76
+ verificationMethod: `${EXAMPLE_INTER_TENANT_ACCESS_CONTRACT_CONSUMER_AUTHORIZED_SIGNATORY_DID}#contract-agreement`,
75
77
  jws: 'consumer-authorized-signatory-proof',
76
78
  },
77
79
  ],
@@ -51,7 +51,6 @@ export type OrganizationTestNetworkCredentialInput = Readonly<{
51
51
  controllerKeyMaterial: string;
52
52
  applicationId: string;
53
53
  accessPath: 'partner' | 'test-network';
54
- targetNetwork: 'test-network' | 'network';
55
54
  /**
56
55
  * @deprecated Postal-address verification is a separate production-readiness
57
56
  * flow. This compatibility input is ignored and is never embedded in a Test
@@ -64,6 +63,8 @@ export type OrganizationTestNetworkCredentialInput = Readonly<{
64
63
  * Builds the immutable VC that a controller receives out-of-band and attaches
65
64
  * to `Organization/_transaction`. Postal-address verification is deliberately
66
65
  * outside this credential and may be completed independently before production.
66
+ * Test Network scope is expressed by `OrganizationTestNetworkCredential` in
67
+ * the signed `type[]`, not by a non-schema.org credential-subject property.
67
68
  */
68
69
  export declare function buildOrganizationTestNetworkCredential(input: OrganizationTestNetworkCredentialInput): VerifiableCredentialV2;
69
70
  /**
@@ -19,6 +19,8 @@ function required(value, name) {
19
19
  * Builds the immutable VC that a controller receives out-of-band and attaches
20
20
  * to `Organization/_transaction`. Postal-address verification is deliberately
21
21
  * outside this credential and may be completed independently before production.
22
+ * Test Network scope is expressed by `OrganizationTestNetworkCredential` in
23
+ * the signed `type[]`, not by a non-schema.org credential-subject property.
22
24
  */
23
25
  export function buildOrganizationTestNetworkCredential(input) {
24
26
  const applicationId = required(input.applicationId, 'applicationId');
@@ -36,7 +38,6 @@ export function buildOrganizationTestNetworkCredential(input) {
36
38
  id: required(input.subjectDid, 'subjectDid'),
37
39
  applicationId,
38
40
  accessPath: input.accessPath,
39
- targetNetwork: input.targetNetwork,
40
41
  organization: {
41
42
  legalName: required(input.legalName, 'legalName'),
42
43
  identifier: organizationIdentifier,
@@ -31,5 +31,8 @@ export type BuildTestNetworkOrganizationCredentialSetInput = Readonly<{
31
31
  * must still be added to every returned credential.
32
32
  */
33
33
  export declare function buildTestNetworkOrganizationCredentialSet(input: BuildTestNetworkOrganizationCredentialSetInput): TestNetworkOrganizationCredentialSet;
34
- /** Deterministic detached-proof payload for one of the three Test Network VCs. */
34
+ /**
35
+ * Deterministic detached-proof payload for one of the three Test Network VCs.
36
+ * The signed `TestNetworkCredential` type is the sole environment marker.
37
+ */
35
38
  export declare function canonicalizeTestNetworkOrganizationCredential(credential: VerifiableCredentialV2): string;
@@ -37,7 +37,6 @@ export function buildTestNetworkOrganizationCredentialSet(input) {
37
37
  id: `urn:sha256:${required(input.pdfSha256, 'pdfSha256')}`,
38
38
  documentVersion: required(input.documentVersion, 'documentVersion'),
39
39
  applicationId,
40
- targetNetwork: 'test-network',
41
40
  }];
42
41
  const base = {
43
42
  '@context': [W3cCredentialContexts.V2, 'https://schema.org'],
@@ -62,7 +61,6 @@ export function buildTestNetworkOrganizationCredentialSet(input) {
62
61
  ...(identifierType === 'taxID' ? { taxID: organizationIdentifier } : {}),
63
62
  address: { '@type': 'PostalAddress', addressCountry },
64
63
  makesOffer: { '@type': 'Offer', category: serviceCategory },
65
- targetNetwork: 'test-network',
66
64
  },
67
65
  };
68
66
  const representative = {
@@ -87,7 +85,6 @@ export function buildTestNetworkOrganizationCredentialSet(input) {
87
85
  ? { taxID: organizationIdentifier }
88
86
  : { identifier: { additionalType: identifierType, value: organizationIdentifier } }),
89
87
  },
90
- targetNetwork: 'test-network',
91
88
  },
92
89
  };
93
90
  const controller = {
@@ -117,7 +114,6 @@ export function buildTestNetworkOrganizationCredentialSet(input) {
117
114
  hasOccupation: { '@type': 'Occupation', occupationalCategory: 'ISCO-08|1330' },
118
115
  hasCredential: { material: required(input.controllerKeyMaterial, 'controllerKeyMaterial') },
119
116
  },
120
- targetNetwork: 'test-network',
121
117
  },
122
118
  };
123
119
  return [organization, representative, controller];
@@ -132,13 +128,16 @@ function canonicalizeValue(value) {
132
128
  .sort(([left], [right]) => left.localeCompare(right))
133
129
  .map(([key, nested]) => [key, canonicalizeValue(nested)]));
134
130
  }
135
- /** Deterministic detached-proof payload for one of the three Test Network VCs. */
131
+ /**
132
+ * Deterministic detached-proof payload for one of the three Test Network VCs.
133
+ * The signed `TestNetworkCredential` type is the sole environment marker.
134
+ */
136
135
  export function canonicalizeTestNetworkOrganizationCredential(credential) {
137
136
  if (!TestNetworkOrganizationCredentialTypes.some(type => credential.type.includes(type))) {
138
137
  throw new Error('Credential is not a Test Network organization credential.');
139
138
  }
140
- if (credential.credentialSubject?.targetNetwork !== 'test-network') {
141
- throw new Error('Test Network organization credential requires targetNetwork=test-network.');
139
+ if (!credential.type.includes(EnvironmentCredentialTypes.TestNetworkCredential)) {
140
+ throw new Error('Test Network organization credential requires TestNetworkCredential in type[].');
142
141
  }
143
142
  return JSON.stringify(canonicalizeValue(credential));
144
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-common-utils-ts",
3
- "version": "2.5.19",
3
+ "version": "2.5.21",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },