gdc-common-utils-ts 2.4.1 → 2.5.1

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 (41) hide show
  1. package/README.md +15 -6
  2. package/dist/constants/healthcare.d.ts +13 -12
  3. package/dist/constants/healthcare.js +25 -25
  4. package/dist/constants/schemaorg.d.ts +2 -0
  5. package/dist/constants/schemaorg.js +2 -0
  6. package/dist/constants/verifiable-credentials.d.ts +8 -0
  7. package/dist/constants/verifiable-credentials.js +10 -0
  8. package/dist/examples/employee.d.ts +1 -1
  9. package/dist/examples/employee.js +2 -2
  10. package/dist/examples/ica-activation-proof.d.ts +1 -3
  11. package/dist/examples/ica-activation-proof.js +1 -3
  12. package/dist/examples/ica-verify-response.d.ts +2 -2
  13. package/dist/examples/ica-verify-response.js +1 -1
  14. package/dist/models/device-license.d.ts +2 -2
  15. package/dist/models/did.d.ts +2 -0
  16. package/dist/models/index.d.ts +1 -0
  17. package/dist/models/index.js +1 -0
  18. package/dist/models/subject-identifier-ledger.d.ts +13 -2
  19. package/dist/models/subject-identity.d.ts +36 -0
  20. package/dist/models/subject-identity.js +1 -0
  21. package/dist/utils/activation-policy.d.ts +2 -5
  22. package/dist/utils/activation-policy.js +4 -12
  23. package/dist/utils/actor-identifier.d.ts +9 -13
  24. package/dist/utils/actor-identifier.js +20 -21
  25. package/dist/utils/index.d.ts +2 -0
  26. package/dist/utils/index.js +2 -0
  27. package/dist/utils/jwk-thumbprint.d.ts +8 -0
  28. package/dist/utils/jwk-thumbprint.js +11 -0
  29. package/dist/utils/legal-organization-onboarding-editor.d.ts +2 -0
  30. package/dist/utils/legal-organization-onboarding-editor.js +1 -3
  31. package/dist/utils/legal-organization-verification-result.d.ts +45 -0
  32. package/dist/utils/legal-organization-verification-result.js +78 -0
  33. package/dist/utils/legal-organization-verification-transaction.d.ts +13 -0
  34. package/dist/utils/legal-organization-verification-transaction.js +6 -0
  35. package/dist/utils/organization-registration-authorization.d.ts +65 -0
  36. package/dist/utils/organization-registration-authorization.js +112 -0
  37. package/dist/utils/subject-identity.d.ts +30 -0
  38. package/dist/utils/subject-identity.js +127 -0
  39. package/dist/utils/vp-token.d.ts +14 -0
  40. package/dist/utils/vp-token.js +19 -1
  41. package/package.json +1 -1
@@ -102,6 +102,13 @@ export declare function getOrganizationCredentialFromVpToken(vpToken: string): V
102
102
  * @param vpToken Compact VP token or raw JSON string.
103
103
  */
104
104
  export declare function getLegalRepresentativeCredentialFromVpToken(vpToken: string): VpCredential | undefined;
105
+ /**
106
+ * Extracts the organization-controller service credential from a VP token
107
+ * when present. It never substitutes a legal-representative credential.
108
+ *
109
+ * @param vpToken Compact VP token or raw JSON string.
110
+ */
111
+ export declare function getOrganizationControllerCredentialFromVpToken(vpToken: string): VpCredential | undefined;
105
112
  /**
106
113
  * Appends an organization activation credential after validating its VC type.
107
114
  *
@@ -115,6 +122,13 @@ export declare function addOrganizationCredential(vpPayload: VpTokenPayload, vc:
115
122
  * Accepts compact VC strings, raw JSON VC strings, or VC JSON objects.
116
123
  */
117
124
  export declare function addLegalRepresentativeCredential(vpPayload: VpTokenPayload, vc: VpCredentialInput): VpTokenPayload;
125
+ /**
126
+ * Appends an organization-controller service credential after validating its
127
+ * VC type independently from the legal-representative credential type.
128
+ *
129
+ * Accepts compact VC strings, raw JSON VC strings, or VC JSON objects.
130
+ */
131
+ export declare function addOrganizationControllerCredential(vpPayload: VpTokenPayload, vc: VpCredentialInput): VpTokenPayload;
118
132
  export declare function prepareForSignature(header: VpTokenHeader, payload: VpTokenPayload): {
119
133
  encodedHeader: string;
120
134
  encodedPayload: string;
@@ -1,5 +1,5 @@
1
1
  import { buildJwtCompact, prepareJwtBytesForSignature, prepareJwtForSignature } from './jwt.js';
2
- import { ORGANIZATION_ACTIVATION_VC_TYPES, REPRESENTATIVE_ACTIVATION_VC_TYPES, W3cCredentialContexts, W3cCredentialTypes, } from '../constants/verifiable-credentials.js';
2
+ import { ORGANIZATION_ACTIVATION_VC_TYPES, ORGANIZATION_CONTROLLER_ACTIVATION_VC_TYPES, REPRESENTATIVE_ACTIVATION_VC_TYPES, W3cCredentialContexts, W3cCredentialTypes, } from '../constants/verifiable-credentials.js';
3
3
  function fallbackId() {
4
4
  const rand = Math.random().toString(36).slice(2, 10);
5
5
  return `id-${Date.now()}-${rand}`;
@@ -189,6 +189,15 @@ export function getOrganizationCredentialFromVpToken(vpToken) {
189
189
  export function getLegalRepresentativeCredentialFromVpToken(vpToken) {
190
190
  return getVpCredentialByAnyType(vpToken, [...REPRESENTATIVE_ACTIVATION_VC_TYPES]);
191
191
  }
192
+ /**
193
+ * Extracts the organization-controller service credential from a VP token
194
+ * when present. It never substitutes a legal-representative credential.
195
+ *
196
+ * @param vpToken Compact VP token or raw JSON string.
197
+ */
198
+ export function getOrganizationControllerCredentialFromVpToken(vpToken) {
199
+ return getVpCredentialByAnyType(vpToken, [...ORGANIZATION_CONTROLLER_ACTIVATION_VC_TYPES]);
200
+ }
192
201
  function vcHasAnyType(vcPayload, acceptedTypes) {
193
202
  if (!vcPayload)
194
203
  return false;
@@ -222,6 +231,15 @@ export function addOrganizationCredential(vpPayload, vc) {
222
231
  export function addLegalRepresentativeCredential(vpPayload, vc) {
223
232
  return addTypedVC(vpPayload, vc, [...REPRESENTATIVE_ACTIVATION_VC_TYPES], 'LegalRepresentative');
224
233
  }
234
+ /**
235
+ * Appends an organization-controller service credential after validating its
236
+ * VC type independently from the legal-representative credential type.
237
+ *
238
+ * Accepts compact VC strings, raw JSON VC strings, or VC JSON objects.
239
+ */
240
+ export function addOrganizationControllerCredential(vpPayload, vc) {
241
+ return addTypedVC(vpPayload, vc, [...ORGANIZATION_CONTROLLER_ACTIVATION_VC_TYPES], 'OrganizationController');
242
+ }
225
243
  export function prepareForSignature(header, payload) {
226
244
  return prepareJwtForSignature(header, payload);
227
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-common-utils-ts",
3
- "version": "2.4.1",
3
+ "version": "2.5.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },