gdc-common-utils-ts 2.5.7 → 2.5.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VerifiableCredentialV2 } from '../models/verifiable-credential';
|
|
2
|
-
/** Lifecycle
|
|
2
|
+
/** Lifecycle for a separate postal-address verification credential. */
|
|
3
3
|
export declare const PostalActivationLicenseStatuses: Readonly<{
|
|
4
4
|
readonly Issued: "issued";
|
|
5
5
|
readonly Delivered: "delivered";
|
|
@@ -48,13 +48,18 @@ export type OrganizationTestNetworkCredentialInput = Readonly<{
|
|
|
48
48
|
applicationId: string;
|
|
49
49
|
accessPath: 'partner' | 'test-network';
|
|
50
50
|
targetNetwork: 'test-network' | 'network';
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Postal-address verification is a separate production-readiness
|
|
53
|
+
* flow. This compatibility input is ignored and is never embedded in a Test
|
|
54
|
+
* Network authorization credential.
|
|
55
|
+
*/
|
|
56
|
+
postalLicense?: PostalActivationLicenseBinding;
|
|
52
57
|
proof?: VerifiableCredentialV2['proof'];
|
|
53
58
|
}>;
|
|
54
59
|
/**
|
|
55
60
|
* Builds the immutable VC that a controller receives out-of-band and attaches
|
|
56
|
-
* to `Organization/_transaction`.
|
|
57
|
-
* credential
|
|
61
|
+
* to `Organization/_transaction`. Postal-address verification is deliberately
|
|
62
|
+
* outside this credential and may be completed independently before production.
|
|
58
63
|
*/
|
|
59
64
|
export declare function buildOrganizationTestNetworkCredential(input: OrganizationTestNetworkCredentialInput): VerifiableCredentialV2;
|
|
60
65
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContractCredentialTypes, W3cCredentialContexts, W3cCredentialTypes, } from '../constants/verifiable-credentials.js';
|
|
2
|
-
/** Lifecycle
|
|
2
|
+
/** Lifecycle for a separate postal-address verification credential. */
|
|
3
3
|
export const PostalActivationLicenseStatuses = Object.freeze({
|
|
4
4
|
Issued: 'issued',
|
|
5
5
|
Delivered: 'delivered',
|
|
@@ -15,23 +15,13 @@ function required(value, name) {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Builds the immutable VC that a controller receives out-of-band and attaches
|
|
18
|
-
* to `Organization/_transaction`.
|
|
19
|
-
* credential
|
|
18
|
+
* to `Organization/_transaction`. Postal-address verification is deliberately
|
|
19
|
+
* outside this credential and may be completed independently before production.
|
|
20
20
|
*/
|
|
21
21
|
export function buildOrganizationTestNetworkCredential(input) {
|
|
22
22
|
const applicationId = required(input.applicationId, 'applicationId');
|
|
23
23
|
const organizationIdentifier = required(input.organizationIdentifier, 'organizationIdentifier');
|
|
24
24
|
const controllerEmail = required(input.controllerEmail, 'controllerEmail').toLowerCase();
|
|
25
|
-
if (input.postalLicense.status !== PostalActivationLicenseStatuses.Delivered) {
|
|
26
|
-
throw new Error('Organization registration authorization requires a delivered postal activation licence.');
|
|
27
|
-
}
|
|
28
|
-
if (input.postalLicense.applicationId !== applicationId
|
|
29
|
-
|| input.postalLicense.organizationIdentifier !== organizationIdentifier
|
|
30
|
-
|| input.postalLicense.controllerEmail.trim().toLowerCase() !== controllerEmail
|
|
31
|
-
|| input.postalLicense.controllerKeyMaterial !== input.controllerKeyMaterial
|
|
32
|
-
|| input.postalLicense.network !== input.targetNetwork) {
|
|
33
|
-
throw new Error('Postal activation licence does not match the organization registration application.');
|
|
34
|
-
}
|
|
35
25
|
return {
|
|
36
26
|
'@context': [W3cCredentialContexts.V2, 'https://schema.org'],
|
|
37
27
|
id: required(input.credentialId, 'credentialId'),
|
|
@@ -53,17 +43,6 @@ export function buildOrganizationTestNetworkCredential(input) {
|
|
|
53
43
|
email: controllerEmail,
|
|
54
44
|
hasCredential: { material: required(input.controllerKeyMaterial, 'controllerKeyMaterial') },
|
|
55
45
|
},
|
|
56
|
-
postalActivationLicense: {
|
|
57
|
-
id: required(input.postalLicense.licenseId, 'postalLicense.licenseId'),
|
|
58
|
-
status: input.postalLicense.status,
|
|
59
|
-
postalAddressHash: required(input.postalLicense.postalAddressHash, 'postalLicense.postalAddressHash'),
|
|
60
|
-
deliveredAt: required(input.postalLicense.deliveredAt, 'postalLicense.deliveredAt'),
|
|
61
|
-
protectedCode: {
|
|
62
|
-
algorithm: input.postalLicense.protectedCode.algorithm,
|
|
63
|
-
salt: required(input.postalLicense.protectedCode.salt, 'postalLicense.protectedCode.salt'),
|
|
64
|
-
digest: required(input.postalLicense.protectedCode.digest, 'postalLicense.protectedCode.digest'),
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
46
|
},
|
|
68
47
|
validFrom: required(input.validFrom, 'validFrom'),
|
|
69
48
|
validUntil: required(input.validUntil, 'validUntil'),
|