gdc-common-utils-ts 2.5.20 → 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.
@@ -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.20",
3
+ "version": "2.5.21",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },