@twin.org/identity-models 0.9.2-next.9 → 0.9.3-next.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.
package/dist/es/index.js CHANGED
@@ -54,6 +54,8 @@ export * from "./models/IIdentityResolverComponent.js";
54
54
  export * from "./models/IIdentityResolverConnector.js";
55
55
  export * from "./models/identityMetricIds.js";
56
56
  export * from "./models/identityMetrics.js";
57
+ export * from "./models/identitySpanAttributes.js";
58
+ export * from "./models/identitySpanNames.js";
57
59
  export * from "./types/did.js";
58
60
  export * from "./utils/documentHelper.js";
59
61
  export * from "./utils/verificationHelper.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iDAAiD,CAAC;AAChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,qEAAqE,CAAC;AACpF,cAAc,sEAAsE,CAAC;AACrF,cAAc,qEAAqE,CAAC;AACpF,cAAc,uEAAuE,CAAC;AACtF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,qEAAqE,CAAC;AACpF,cAAc,sEAAsE,CAAC;AACrF,cAAc,uEAAuE,CAAC;AACtF,cAAc,wEAAwE,CAAC;AACvF,cAAc,+EAA+E,CAAC;AAC9F,cAAc,uEAAuE,CAAC;AACtF,cAAc,wEAAwE,CAAC;AACvF,cAAc,mEAAmE,CAAC;AAClF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mEAAmE,CAAC;AAClF,cAAc,yDAAyD,CAAC;AACxE,cAAc,0DAA0D,CAAC;AACzE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,uDAAuD,CAAC;AACtE,cAAc,0DAA0D,CAAC;AACzE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,mDAAmD,CAAC;AAClE,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./contextIdHandlers/didContextIdHandler.js\";\nexport * from \"./factories/identityConnectorFactory.js\";\nexport * from \"./factories/identityProfileConnectorFactory.js\";\nexport * from \"./factories/identityResolverConnectorFactory.js\";\nexport * from \"./models/api/identity/IIdentityAlsoKnownAsCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityServiceRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialRevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodRemoveRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminGetRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminListRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminListResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminRemoveRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminUpdateRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileCreateRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileListRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileListResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileUpdateRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveResponse.js\";\nexport * from \"./models/IIdentityComponent.js\";\nexport * from \"./models/IIdentityConnector.js\";\nexport * from \"./models/IIdentityProfileComponent.js\";\nexport * from \"./models/IIdentityProfileConnector.js\";\nexport * from \"./models/IIdentityResolverComponent.js\";\nexport * from \"./models/IIdentityResolverConnector.js\";\nexport * from \"./models/identityMetricIds.js\";\nexport * from \"./models/identityMetrics.js\";\nexport * from \"./types/did.js\";\nexport * from \"./utils/documentHelper.js\";\nexport * from \"./utils/verificationHelper.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,iDAAiD,CAAC;AAChE,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC;AAChE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,wDAAwD,CAAC;AACvE,cAAc,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ler.js\";\nexport * from \"./factories/identityConnectorFactory.js\";\nexport * from \"./factories/identityProfileConnectorFactory.js\";\nexport * from \"./factories/identityResolverConnectorFactory.js\";\nexport * from \"./models/api/identity/IIdentityAlsoKnownAsCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityAlsoKnownAsRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityProofVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityServiceCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityServiceRemoveRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialRevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialUnrevokeRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyDocumentRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiableCredentialVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyDocumentRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerifiablePresentationVerifyResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateRequest.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodCreateResponse.js\";\nexport * from \"./models/api/identity/IIdentityVerificationMethodRemoveRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminGetRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminListRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminListResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminRemoveRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileAdminUpdateRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileCreateRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetPublicResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileGetResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileListRequest.js\";\nexport * from \"./models/api/profile/IIdentityProfileListResponse.js\";\nexport * from \"./models/api/profile/IIdentityProfileUpdateRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveRequest.js\";\nexport * from \"./models/api/resolver/IIdentityResolveResponse.js\";\nexport * from \"./models/IIdentityComponent.js\";\nexport * from \"./models/IIdentityConnector.js\";\nexport * from \"./models/IIdentityProfileComponent.js\";\nexport * from \"./models/IIdentityProfileConnector.js\";\nexport * from \"./models/IIdentityResolverComponent.js\";\nexport * from \"./models/IIdentityResolverConnector.js\";\nexport * from \"./models/identityMetricIds.js\";\nexport * from \"./models/identityMetrics.js\";\nexport * from \"./models/identitySpanAttributes.js\";\nexport * from \"./models/identitySpanNames.js\";\nexport * from \"./types/did.js\";\nexport * from \"./utils/documentHelper.js\";\nexport * from \"./utils/verificationHelper.js\";\n"]}
@@ -0,0 +1,21 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * The span attribute keys for the identity domain.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const IdentitySpanAttributes = {
8
+ /**
9
+ * The id of the identity document the operation is for.
10
+ */
11
+ Id: "identity.id",
12
+ /**
13
+ * The id of the verification method the operation is for.
14
+ */
15
+ VerificationMethodId: "identity.verification-method-id",
16
+ /**
17
+ * The id of the service the operation is for.
18
+ */
19
+ ServiceId: "identity.service-id"
20
+ };
21
+ //# sourceMappingURL=identitySpanAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identitySpanAttributes.js","sourceRoot":"","sources":["../../../src/models/identitySpanAttributes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC;;OAEG;IACH,EAAE,EAAE,aAAa;IAEjB;;OAEG;IACH,oBAAoB,EAAE,iCAAiC;IAEvD;;OAEG;IACH,SAAS,EAAE,qBAAqB;CACvB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The span attribute keys for the identity domain.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdentitySpanAttributes = {\n\t/**\n\t * The id of the identity document the operation is for.\n\t */\n\tId: \"identity.id\",\n\n\t/**\n\t * The id of the verification method the operation is for.\n\t */\n\tVerificationMethodId: \"identity.verification-method-id\",\n\n\t/**\n\t * The id of the service the operation is for.\n\t */\n\tServiceId: \"identity.service-id\"\n} as const;\n\n/**\n * Union type of all identity span attribute key string values.\n */\nexport type IdentitySpanAttributes =\n\t(typeof IdentitySpanAttributes)[keyof typeof IdentitySpanAttributes];\n"]}
@@ -0,0 +1,73 @@
1
+ // Copyright 2026 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * The span names for the identity domain.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const IdentitySpanNames = {
8
+ /**
9
+ * Create an identity.
10
+ */
11
+ Create: "identity/create",
12
+ /**
13
+ * Remove an identity.
14
+ */
15
+ Remove: "identity/remove",
16
+ /**
17
+ * Create a verification method.
18
+ */
19
+ VerificationMethodCreate: "identity/verification-method-create",
20
+ /**
21
+ * Remove a verification method.
22
+ */
23
+ VerificationMethodRemove: "identity/verification-method-remove",
24
+ /**
25
+ * Create a service.
26
+ */
27
+ ServiceCreate: "identity/service-create",
28
+ /**
29
+ * Remove a service.
30
+ */
31
+ ServiceRemove: "identity/service-remove",
32
+ /**
33
+ * Add an also known as alias.
34
+ */
35
+ AlsoKnownAsAdd: "identity/also-known-as-add",
36
+ /**
37
+ * Remove an also known as alias.
38
+ */
39
+ AlsoKnownAsRemove: "identity/also-known-as-remove",
40
+ /**
41
+ * Create a verifiable credential.
42
+ */
43
+ VerifiableCredentialCreate: "identity/verifiable-credential-create",
44
+ /**
45
+ * Verify a verifiable credential.
46
+ */
47
+ VerifiableCredentialVerify: "identity/verifiable-credential-verify",
48
+ /**
49
+ * Revoke a verifiable credential.
50
+ */
51
+ VerifiableCredentialRevoke: "identity/verifiable-credential-revoke",
52
+ /**
53
+ * Unrevoke a verifiable credential.
54
+ */
55
+ VerifiableCredentialUnrevoke: "identity/verifiable-credential-unrevoke",
56
+ /**
57
+ * Create a verifiable presentation.
58
+ */
59
+ VerifiablePresentationCreate: "identity/verifiable-presentation-create",
60
+ /**
61
+ * Verify a verifiable presentation.
62
+ */
63
+ VerifiablePresentationVerify: "identity/verifiable-presentation-verify",
64
+ /**
65
+ * Create a proof.
66
+ */
67
+ ProofCreate: "identity/proof-create",
68
+ /**
69
+ * Verify a proof.
70
+ */
71
+ ProofVerify: "identity/proof-verify"
72
+ };
73
+ //# sourceMappingURL=identitySpanNames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identitySpanNames.js","sourceRoot":"","sources":["../../../src/models/identitySpanNames.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,iBAAiB;IAEzB;;OAEG;IACH,MAAM,EAAE,iBAAiB;IAEzB;;OAEG;IACH,wBAAwB,EAAE,qCAAqC;IAE/D;;OAEG;IACH,wBAAwB,EAAE,qCAAqC;IAE/D;;OAEG;IACH,aAAa,EAAE,yBAAyB;IAExC;;OAEG;IACH,aAAa,EAAE,yBAAyB;IAExC;;OAEG;IACH,cAAc,EAAE,4BAA4B;IAE5C;;OAEG;IACH,iBAAiB,EAAE,+BAA+B;IAElD;;OAEG;IACH,0BAA0B,EAAE,uCAAuC;IAEnE;;OAEG;IACH,0BAA0B,EAAE,uCAAuC;IAEnE;;OAEG;IACH,0BAA0B,EAAE,uCAAuC;IAEnE;;OAEG;IACH,4BAA4B,EAAE,yCAAyC;IAEvE;;OAEG;IACH,4BAA4B,EAAE,yCAAyC;IAEvE;;OAEG;IACH,4BAA4B,EAAE,yCAAyC;IAEvE;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,WAAW,EAAE,uBAAuB;CAC3B,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The span names for the identity domain.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdentitySpanNames = {\n\t/**\n\t * Create an identity.\n\t */\n\tCreate: \"identity/create\",\n\n\t/**\n\t * Remove an identity.\n\t */\n\tRemove: \"identity/remove\",\n\n\t/**\n\t * Create a verification method.\n\t */\n\tVerificationMethodCreate: \"identity/verification-method-create\",\n\n\t/**\n\t * Remove a verification method.\n\t */\n\tVerificationMethodRemove: \"identity/verification-method-remove\",\n\n\t/**\n\t * Create a service.\n\t */\n\tServiceCreate: \"identity/service-create\",\n\n\t/**\n\t * Remove a service.\n\t */\n\tServiceRemove: \"identity/service-remove\",\n\n\t/**\n\t * Add an also known as alias.\n\t */\n\tAlsoKnownAsAdd: \"identity/also-known-as-add\",\n\n\t/**\n\t * Remove an also known as alias.\n\t */\n\tAlsoKnownAsRemove: \"identity/also-known-as-remove\",\n\n\t/**\n\t * Create a verifiable credential.\n\t */\n\tVerifiableCredentialCreate: \"identity/verifiable-credential-create\",\n\n\t/**\n\t * Verify a verifiable credential.\n\t */\n\tVerifiableCredentialVerify: \"identity/verifiable-credential-verify\",\n\n\t/**\n\t * Revoke a verifiable credential.\n\t */\n\tVerifiableCredentialRevoke: \"identity/verifiable-credential-revoke\",\n\n\t/**\n\t * Unrevoke a verifiable credential.\n\t */\n\tVerifiableCredentialUnrevoke: \"identity/verifiable-credential-unrevoke\",\n\n\t/**\n\t * Create a verifiable presentation.\n\t */\n\tVerifiablePresentationCreate: \"identity/verifiable-presentation-create\",\n\n\t/**\n\t * Verify a verifiable presentation.\n\t */\n\tVerifiablePresentationVerify: \"identity/verifiable-presentation-verify\",\n\n\t/**\n\t * Create a proof.\n\t */\n\tProofCreate: \"identity/proof-create\",\n\n\t/**\n\t * Verify a proof.\n\t */\n\tProofVerify: \"identity/proof-verify\"\n} as const;\n\n/**\n * Union type of all identity span name string values.\n */\nexport type IdentitySpanNames = (typeof IdentitySpanNames)[keyof typeof IdentitySpanNames];\n"]}
@@ -75,5 +75,41 @@ export class VerificationHelper {
75
75
  }
76
76
  return true;
77
77
  }
78
+ /**
79
+ * Check a verifiable credential is within its validity period.
80
+ * @param credential The credential to check, either VC data model v1 or v2.
81
+ * @throws GeneralError if the credential has expired or is not yet valid.
82
+ */
83
+ static checkValidityPeriod(credential) {
84
+ Guards.object(VerificationHelper.CLASS_NAME, "credential", credential);
85
+ const dated = credential;
86
+ const notBefore = dated.issuanceDate ?? dated.validFrom;
87
+ const notAfter = dated.expirationDate ?? dated.validUntil;
88
+ const now = Date.now();
89
+ if (Is.stringValue(notBefore)) {
90
+ if (!Is.dateTimeString(notBefore)) {
91
+ throw new GeneralError(VerificationHelper.CLASS_NAME, "credentialValidityDateInvalid", {
92
+ date: notBefore
93
+ });
94
+ }
95
+ if (new Date(notBefore).getTime() > now) {
96
+ throw new GeneralError(VerificationHelper.CLASS_NAME, "credentialNotYetValid", {
97
+ validFrom: notBefore
98
+ });
99
+ }
100
+ }
101
+ if (Is.stringValue(notAfter)) {
102
+ if (!Is.dateTimeString(notAfter)) {
103
+ throw new GeneralError(VerificationHelper.CLASS_NAME, "credentialValidityDateInvalid", {
104
+ date: notAfter
105
+ });
106
+ }
107
+ if (new Date(notAfter).getTime() < now) {
108
+ throw new GeneralError(VerificationHelper.CLASS_NAME, "credentialExpired", {
109
+ validUntil: notAfter
110
+ });
111
+ }
112
+ }
113
+ }
78
114
  }
79
115
  //# sourceMappingURL=verificationHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verificationHelper.js","sourceRoot":"","sources":["../../../src/utils/verificationHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAkC,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,GAAG,EAAE,GAAG,EAAqC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;OAEG;IACI,MAAM,CAAU,UAAU,wBAAwC;IAEzE;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAC5B,QAAoC,EACpC,GAAW;QAKX,MAAM,CAAC,MAAM,CACZ,kBAAkB,CAAC,UAAU,cAE7B,QAAQ,CACR,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,SAAe,GAAG,CAAC,CAAC;QAE/D,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,MAAM,CAAO,GAAG,CAAC,CAAC;QAE/C,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;QAC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gBACf,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { ProofHelper, type IDidDocument, type IProof } from \"@twin.org/standards-w3c-did\";\nimport { Jwk, Jwt, type IJwtHeader, type IJwtPayload } from \"@twin.org/web\";\nimport { DocumentHelper } from \"./documentHelper.js\";\nimport type { IIdentityResolverComponent } from \"../models/IIdentityResolverComponent.js\";\n\n/**\n * Helper methods for verification.\n */\nexport class VerificationHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerificationHelper>();\n\n\t/**\n\t * Verify the JWT and return the decoded header and payload.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param jwt The token to verify.\n\t * @returns The decoded header and payload.\n\t */\n\tpublic static async verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(\n\t\tresolver: IIdentityResolverComponent,\n\t\tjwt: string\n\t): Promise<{\n\t\theader: T;\n\t\tpayload: U;\n\t}> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.string(VerificationHelper.CLASS_NAME, nameof(jwt), jwt);\n\n\t\tconst jwtDecoded = await Jwt.decode<T, U>(jwt);\n\n\t\tconst jwtHeader = jwtDecoded.header;\n\t\tconst jwtPayload = jwtDecoded.payload;\n\t\tconst jwtSignature = jwtDecoded.signature;\n\n\t\tif (!Is.object(jwtHeader) || !Is.object(jwtPayload) || !Is.uint8Array(jwtSignature)) {\n\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"jwtDecodeFailed\");\n\t\t}\n\n\t\tconst iss = jwtHeader?.iss;\n\t\tconst kid = jwtHeader?.kid;\n\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(iss), iss);\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(kid), kid);\n\n\t\tconst didDocument = await resolver.identityResolve(iss);\n\n\t\tconst jwk = DocumentHelper.getJwk(didDocument, kid);\n\n\t\tconst publicKey = await Jwk.toCryptoKey(jwk);\n\n\t\treturn Jwt.verify(jwt, publicKey);\n\t}\n\n\t/**\n\t * Verify the proof for the document.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param secureDocument The secure document to verify.\n\t * @returns True if all proofs in the document are verified successfully.\n\t */\n\tpublic static async verifyProof(\n\t\tresolver: IIdentityResolverComponent,\n\t\tsecureDocument: IJsonLdNodeObject\n\t): Promise<boolean> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument),\n\t\t\tsecureDocument\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument.proof),\n\t\t\tsecureDocument.proof\n\t\t);\n\n\t\tconst proofList = Is.array<IProof>(secureDocument.proof)\n\t\t\t? secureDocument.proof\n\t\t\t: [secureDocument.proof];\n\n\t\tconst documentCache: { [key: string]: IDidDocument } = {};\n\n\t\tfor (const proof of proofList as IProof[]) {\n\t\t\tif (!Is.stringValue(proof?.verificationMethod)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tconst proofVerificationMethod = DocumentHelper.parseId(proof.verificationMethod);\n\t\t\tif (!Is.stringValue(proofVerificationMethod.fragment)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tlet document: IDidDocument;\n\n\t\t\tif (documentCache[proofVerificationMethod.id]) {\n\t\t\t\tdocument = documentCache[proofVerificationMethod.id];\n\t\t\t} else {\n\t\t\t\tdocument = await resolver.identityResolve(proofVerificationMethod.id);\n\t\t\t\tdocumentCache[proofVerificationMethod.id] = document;\n\t\t\t}\n\n\t\t\tconst verificationJwk = DocumentHelper.getJwk(document, proofVerificationMethod.id);\n\n\t\t\tconst verified = await ProofHelper.verifyProof(secureDocument, proof, verificationJwk);\n\n\t\t\tif (!verified) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"verificationHelper.js","sourceRoot":"","sources":["../../../src/utils/verificationHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EACN,WAAW,EAIX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAqC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;OAEG;IACI,MAAM,CAAU,UAAU,wBAAwC;IAEzE;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAC5B,QAAoC,EACpC,GAAW;QAKX,MAAM,CAAC,MAAM,CACZ,kBAAkB,CAAC,UAAU,cAE7B,QAAQ,CACR,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,SAAe,GAAG,CAAC,CAAC;QAE/D,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,MAAM,CAAO,GAAG,CAAC,CAAC;QAE/C,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;QACpC,MAAM,UAAU,GAAG,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EAAE,CAAC;gBACxC,MAAM,IAAI,YAAY,CAAC,kBAAkB,CAAC,UAAU,EAAE,mBAAmB,EAAE;oBAC1E,UAAU,EAAE,QAAQ;iBACpB,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tProofHelper,\n\ttype IDidDocument,\n\ttype IDidVerifiableCredential,\n\ttype IProof\n} from \"@twin.org/standards-w3c-did\";\nimport { Jwk, Jwt, type IJwtHeader, type IJwtPayload } from \"@twin.org/web\";\nimport { DocumentHelper } from \"./documentHelper.js\";\nimport type { IIdentityResolverComponent } from \"../models/IIdentityResolverComponent.js\";\n\n/**\n * Helper methods for verification.\n */\nexport class VerificationHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerificationHelper>();\n\n\t/**\n\t * Verify the JWT and return the decoded header and payload.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param jwt The token to verify.\n\t * @returns The decoded header and payload.\n\t */\n\tpublic static async verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(\n\t\tresolver: IIdentityResolverComponent,\n\t\tjwt: string\n\t): Promise<{\n\t\theader: T;\n\t\tpayload: U;\n\t}> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.string(VerificationHelper.CLASS_NAME, nameof(jwt), jwt);\n\n\t\tconst jwtDecoded = await Jwt.decode<T, U>(jwt);\n\n\t\tconst jwtHeader = jwtDecoded.header;\n\t\tconst jwtPayload = jwtDecoded.payload;\n\t\tconst jwtSignature = jwtDecoded.signature;\n\n\t\tif (!Is.object(jwtHeader) || !Is.object(jwtPayload) || !Is.uint8Array(jwtSignature)) {\n\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"jwtDecodeFailed\");\n\t\t}\n\n\t\tconst iss = jwtHeader?.iss;\n\t\tconst kid = jwtHeader?.kid;\n\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(iss), iss);\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(kid), kid);\n\n\t\tconst didDocument = await resolver.identityResolve(iss);\n\n\t\tconst jwk = DocumentHelper.getJwk(didDocument, kid);\n\n\t\tconst publicKey = await Jwk.toCryptoKey(jwk);\n\n\t\treturn Jwt.verify(jwt, publicKey);\n\t}\n\n\t/**\n\t * Verify the proof for the document.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param secureDocument The secure document to verify.\n\t * @returns True if all proofs in the document are verified successfully.\n\t */\n\tpublic static async verifyProof(\n\t\tresolver: IIdentityResolverComponent,\n\t\tsecureDocument: IJsonLdNodeObject\n\t): Promise<boolean> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument),\n\t\t\tsecureDocument\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument.proof),\n\t\t\tsecureDocument.proof\n\t\t);\n\n\t\tconst proofList = Is.array<IProof>(secureDocument.proof)\n\t\t\t? secureDocument.proof\n\t\t\t: [secureDocument.proof];\n\n\t\tconst documentCache: { [key: string]: IDidDocument } = {};\n\n\t\tfor (const proof of proofList as IProof[]) {\n\t\t\tif (!Is.stringValue(proof?.verificationMethod)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tconst proofVerificationMethod = DocumentHelper.parseId(proof.verificationMethod);\n\t\t\tif (!Is.stringValue(proofVerificationMethod.fragment)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tlet document: IDidDocument;\n\n\t\t\tif (documentCache[proofVerificationMethod.id]) {\n\t\t\t\tdocument = documentCache[proofVerificationMethod.id];\n\t\t\t} else {\n\t\t\t\tdocument = await resolver.identityResolve(proofVerificationMethod.id);\n\t\t\t\tdocumentCache[proofVerificationMethod.id] = document;\n\t\t\t}\n\n\t\t\tconst verificationJwk = DocumentHelper.getJwk(document, proofVerificationMethod.id);\n\n\t\t\tconst verified = await ProofHelper.verifyProof(secureDocument, proof, verificationJwk);\n\n\t\t\tif (!verified) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Check a verifiable credential is within its validity period.\n\t * @param credential The credential to check, either VC data model v1 or v2.\n\t * @throws GeneralError if the credential has expired or is not yet valid.\n\t */\n\tpublic static checkValidityPeriod(credential: IDidVerifiableCredential): void {\n\t\tGuards.object<IDidVerifiableCredential>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(credential),\n\t\t\tcredential\n\t\t);\n\n\t\tconst dated = credential as {\n\t\t\tissuanceDate?: string;\n\t\t\tvalidFrom?: string;\n\t\t\texpirationDate?: string;\n\t\t\tvalidUntil?: string;\n\t\t};\n\t\tconst notBefore = dated.issuanceDate ?? dated.validFrom;\n\t\tconst notAfter = dated.expirationDate ?? dated.validUntil;\n\t\tconst now = Date.now();\n\n\t\tif (Is.stringValue(notBefore)) {\n\t\t\tif (!Is.dateTimeString(notBefore)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"credentialValidityDateInvalid\", {\n\t\t\t\t\tdate: notBefore\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (new Date(notBefore).getTime() > now) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"credentialNotYetValid\", {\n\t\t\t\t\tvalidFrom: notBefore\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (Is.stringValue(notAfter)) {\n\t\t\tif (!Is.dateTimeString(notAfter)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"credentialValidityDateInvalid\", {\n\t\t\t\t\tdate: notAfter\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (new Date(notAfter).getTime() < now) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"credentialExpired\", {\n\t\t\t\t\tvalidUntil: notAfter\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -52,6 +52,8 @@ export * from "./models/IIdentityResolverComponent.js";
52
52
  export * from "./models/IIdentityResolverConnector.js";
53
53
  export * from "./models/identityMetricIds.js";
54
54
  export * from "./models/identityMetrics.js";
55
+ export * from "./models/identitySpanAttributes.js";
56
+ export * from "./models/identitySpanNames.js";
55
57
  export * from "./types/did.js";
56
58
  export * from "./utils/documentHelper.js";
57
59
  export * from "./utils/verificationHelper.js";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The span attribute keys for the identity domain.
3
+ */
4
+ export declare const IdentitySpanAttributes: {
5
+ /**
6
+ * The id of the identity document the operation is for.
7
+ */
8
+ readonly Id: "identity.id";
9
+ /**
10
+ * The id of the verification method the operation is for.
11
+ */
12
+ readonly VerificationMethodId: "identity.verification-method-id";
13
+ /**
14
+ * The id of the service the operation is for.
15
+ */
16
+ readonly ServiceId: "identity.service-id";
17
+ };
18
+ /**
19
+ * Union type of all identity span attribute key string values.
20
+ */
21
+ export type IdentitySpanAttributes = (typeof IdentitySpanAttributes)[keyof typeof IdentitySpanAttributes];
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The span names for the identity domain.
3
+ */
4
+ export declare const IdentitySpanNames: {
5
+ /**
6
+ * Create an identity.
7
+ */
8
+ readonly Create: "identity/create";
9
+ /**
10
+ * Remove an identity.
11
+ */
12
+ readonly Remove: "identity/remove";
13
+ /**
14
+ * Create a verification method.
15
+ */
16
+ readonly VerificationMethodCreate: "identity/verification-method-create";
17
+ /**
18
+ * Remove a verification method.
19
+ */
20
+ readonly VerificationMethodRemove: "identity/verification-method-remove";
21
+ /**
22
+ * Create a service.
23
+ */
24
+ readonly ServiceCreate: "identity/service-create";
25
+ /**
26
+ * Remove a service.
27
+ */
28
+ readonly ServiceRemove: "identity/service-remove";
29
+ /**
30
+ * Add an also known as alias.
31
+ */
32
+ readonly AlsoKnownAsAdd: "identity/also-known-as-add";
33
+ /**
34
+ * Remove an also known as alias.
35
+ */
36
+ readonly AlsoKnownAsRemove: "identity/also-known-as-remove";
37
+ /**
38
+ * Create a verifiable credential.
39
+ */
40
+ readonly VerifiableCredentialCreate: "identity/verifiable-credential-create";
41
+ /**
42
+ * Verify a verifiable credential.
43
+ */
44
+ readonly VerifiableCredentialVerify: "identity/verifiable-credential-verify";
45
+ /**
46
+ * Revoke a verifiable credential.
47
+ */
48
+ readonly VerifiableCredentialRevoke: "identity/verifiable-credential-revoke";
49
+ /**
50
+ * Unrevoke a verifiable credential.
51
+ */
52
+ readonly VerifiableCredentialUnrevoke: "identity/verifiable-credential-unrevoke";
53
+ /**
54
+ * Create a verifiable presentation.
55
+ */
56
+ readonly VerifiablePresentationCreate: "identity/verifiable-presentation-create";
57
+ /**
58
+ * Verify a verifiable presentation.
59
+ */
60
+ readonly VerifiablePresentationVerify: "identity/verifiable-presentation-verify";
61
+ /**
62
+ * Create a proof.
63
+ */
64
+ readonly ProofCreate: "identity/proof-create";
65
+ /**
66
+ * Verify a proof.
67
+ */
68
+ readonly ProofVerify: "identity/proof-verify";
69
+ };
70
+ /**
71
+ * Union type of all identity span name string values.
72
+ */
73
+ export type IdentitySpanNames = (typeof IdentitySpanNames)[keyof typeof IdentitySpanNames];
@@ -1,4 +1,5 @@
1
1
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import { type IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
2
3
  import { type IJwtHeader, type IJwtPayload } from "@twin.org/web";
3
4
  import type { IIdentityResolverComponent } from "../models/IIdentityResolverComponent.js";
4
5
  /**
@@ -26,4 +27,10 @@ export declare class VerificationHelper {
26
27
  * @returns True if all proofs in the document are verified successfully.
27
28
  */
28
29
  static verifyProof(resolver: IIdentityResolverComponent, secureDocument: IJsonLdNodeObject): Promise<boolean>;
30
+ /**
31
+ * Check a verifiable credential is within its validity period.
32
+ * @param credential The credential to check, either VC data model v1 or v2.
33
+ * @throws GeneralError if the credential has expired or is not yet valid.
34
+ */
35
+ static checkValidityPeriod(credential: IDidVerifiableCredential): void;
29
36
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.3-next.1](https://github.com/iotaledger/twin-identity/compare/identity-models-v0.9.3-next.0...identity-models-v0.9.3-next.1) (2026-08-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * add addAlsoKnownAs to identity connector ([#117](https://github.com/iotaledger/twin-identity/issues/117)) ([aa27cff](https://github.com/iotaledger/twin-identity/commit/aa27cff88e61e7c8c6e32aeb437fb01c6ee9f57a))
9
+ * add context id features ([#62](https://github.com/iotaledger/twin-identity/issues/62)) ([e02ecca](https://github.com/iotaledger/twin-identity/commit/e02ecca9c45a849104bfbf7bc18a1f44e6eea8a1))
10
+ * add context id long method ([#182](https://github.com/iotaledger/twin-identity/issues/182)) ([8e04625](https://github.com/iotaledger/twin-identity/commit/8e04625812cd3b8680ce837fadbb0bce046a5c2f))
11
+ * add expiration date option to vc creation ([73e05e1](https://github.com/iotaledger/twin-identity/commit/73e05e1ae61112c7e056889969751f4ff82d9f29))
12
+ * add identity remove ([eebc13f](https://github.com/iotaledger/twin-identity/commit/eebc13f4c2cd994d2d9cce4da2128fb346c80ba7))
13
+ * add idHelper class ([57c8bdb](https://github.com/iotaledger/twin-identity/commit/57c8bdb81efaa163b5e83f8a7f16f3764d12fd75))
14
+ * add optional jwt payload and headers to vc and vp tokens ([#135](https://github.com/iotaledger/twin-identity/issues/135)) ([aa1de0f](https://github.com/iotaledger/twin-identity/commit/aa1de0f63be95ff62bae3c699aabc85ea93d74c2))
15
+ * add proof to vcs and verify vs documents ([#103](https://github.com/iotaledger/twin-identity/issues/103)) ([b60bf0c](https://github.com/iotaledger/twin-identity/commit/b60bf0cb7d453d67574c5c0e4f769e67cf7cd6d1))
16
+ * add telemetry metrics ([#132](https://github.com/iotaledger/twin-identity/issues/132)) ([b51cd78](https://github.com/iotaledger/twin-identity/commit/b51cd7816905fd55e250035daf1b8f2047cba83d))
17
+ * add validate-locales ([04d74b4](https://github.com/iotaledger/twin-identity/commit/04d74b4d1ebe42672e8ca75a7bdb8e3556afd0be))
18
+ * admin endpoints ([#199](https://github.com/iotaledger/twin-identity/issues/199)) ([da6c189](https://github.com/iotaledger/twin-identity/commit/da6c18963ed551451d919e36aedc1dd8b005a12f))
19
+ * common connector tests ([4f9642c](https://github.com/iotaledger/twin-identity/commit/4f9642ceb09843870909fc6819bf69fb20ef952a))
20
+ * eslint migration to flat config ([fd6246d](https://github.com/iotaledger/twin-identity/commit/fd6246d566280b6d5d10a108eb1e92c4b510f2f2))
21
+ * expanded cli methods ([#121](https://github.com/iotaledger/twin-identity/issues/121)) ([80a52b7](https://github.com/iotaledger/twin-identity/commit/80a52b779237cd633d1f2813fa976585cef6e551))
22
+ * health and key removal ([934391f](https://github.com/iotaledger/twin-identity/commit/934391f9307beda34bc594e3aa506137e3df631b))
23
+ * health and key removal ([#191](https://github.com/iotaledger/twin-identity/issues/191)) ([8504101](https://github.com/iotaledger/twin-identity/commit/8504101a7a08b2a042a4e59f666c245308527088))
24
+ * identity key separator use slash ([1319d0d](https://github.com/iotaledger/twin-identity/commit/1319d0d07164a36b3ec279e6421b8835ffefc3d3))
25
+ * remove auth generator ([#98](https://github.com/iotaledger/twin-identity/issues/98)) ([a8969e8](https://github.com/iotaledger/twin-identity/commit/a8969e85a5a2804abfc787406e2d12eb168dd978))
26
+ * separate vc verification routes with query and body ([ea7d891](https://github.com/iotaledger/twin-identity/commit/ea7d8910472150cf76dbd51e282625e70226d9b3))
27
+ * tracing ([#205](https://github.com/iotaledger/twin-identity/issues/205)) ([add81ab](https://github.com/iotaledger/twin-identity/commit/add81ab4a258078c34ef0c57681d1675c81f8e2c))
28
+ * typescript 6 update ([e8806ad](https://github.com/iotaledger/twin-identity/commit/e8806ad6858c37be3c0f54c41cf654023773bef3))
29
+ * update did context handler definition ([02aa59a](https://github.com/iotaledger/twin-identity/commit/02aa59ae8100b1afb2325ea858411fc3e4d9d1e9))
30
+ * update framework core ([c824497](https://github.com/iotaledger/twin-identity/commit/c82449709af0215eb7af496cf687c93fb30b5ae0))
31
+ * use shared store mechanism ([#27](https://github.com/iotaledger/twin-identity/issues/27)) ([ce41f3f](https://github.com/iotaledger/twin-identity/commit/ce41f3fc3da1b206ec06da7ea5b2c968f788804d))
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * didContextIdHandler tests ([dc7b555](https://github.com/iotaledger/twin-identity/commit/dc7b5558e47117475b7f1fa1686d3ed7e0906563))
37
+ * enforce credentialStatus, validity period and assertionMethod scope on object-form verification ([#215](https://github.com/iotaledger/twin-identity/issues/215)) ([8e6eb92](https://github.com/iotaledger/twin-identity/commit/8e6eb920564e0fe4ebdc984bdf682b7779f747d0))
38
+ * Import path and bump version ([#21](https://github.com/iotaledger/twin-identity/issues/21)) ([ccea845](https://github.com/iotaledger/twin-identity/commit/ccea845bf32562267280bc1b3dde1c9af1a00360))
39
+ * Install sdk-wasm ([#20](https://github.com/iotaledger/twin-identity/issues/20)) ([75ec14e](https://github.com/iotaledger/twin-identity/commit/75ec14e072f8c219863a1c028a3b0783802086e9))
40
+ * query params force coercion ([d9347d2](https://github.com/iotaledger/twin-identity/commit/d9347d29d4a9cc58759f30f5d8526de864ea7522))
41
+ * stricter pathParam types ([a174cdf](https://github.com/iotaledger/twin-identity/commit/a174cdf0ca4272bee35fcf20ab7e8e4e17b8b6f4))
42
+ * use base64Url for tenant id short form so it doesn't include slash ([53b9e27](https://github.com/iotaledger/twin-identity/commit/53b9e27351f20e2689734581c252a23527657926))
43
+ * Use resolver component ([#22](https://github.com/iotaledger/twin-identity/issues/22)) ([d0b3a32](https://github.com/iotaledger/twin-identity/commit/d0b3a321c7f9f966d397a880d752e9f2c0a98a27))
44
+
45
+ ## [0.9.2](https://github.com/iotaledger/twin-identity/compare/identity-models-v0.9.2...identity-models-v0.9.2) (2026-08-24)
46
+
47
+
48
+ ### Features
49
+
50
+ * release to production ([dabf4c5](https://github.com/iotaledger/twin-identity/commit/dabf4c5bb19e04c09bfbc8533f23dc9d42b35e4c))
51
+ * release to production ([8450ad7](https://github.com/iotaledger/twin-identity/commit/8450ad727e0c4d665f2ce483e41798c2ff5b7d55))
52
+ * release to production ([#161](https://github.com/iotaledger/twin-identity/issues/161)) ([ad151fa](https://github.com/iotaledger/twin-identity/commit/ad151facfcaadc1d183d935a6db525379d48002f))
53
+ * release to production ([#179](https://github.com/iotaledger/twin-identity/issues/179)) ([062816b](https://github.com/iotaledger/twin-identity/commit/062816b110776b7e60f89b04142d42c6f24890a8))
54
+ * release to production ([#210](https://github.com/iotaledger/twin-identity/issues/210)) ([aec2d45](https://github.com/iotaledger/twin-identity/commit/aec2d45ed55b8bf96638dee835f54629170943ad))
55
+
56
+ ## [0.9.2-next.10](https://github.com/iotaledger/twin-identity/compare/identity-models-v0.9.2-next.9...identity-models-v0.9.2-next.10) (2026-08-20)
57
+
58
+
59
+ ### Features
60
+
61
+ * tracing ([#205](https://github.com/iotaledger/twin-identity/issues/205)) ([add81ab](https://github.com/iotaledger/twin-identity/commit/add81ab4a258078c34ef0c57681d1675c81f8e2c))
62
+
3
63
  ## [0.9.2-next.9](https://github.com/iotaledger/twin-identity/compare/identity-models-v0.9.2-next.8...identity-models-v0.9.2-next.9) (2026-08-14)
4
64
 
5
65
 
@@ -85,3 +85,27 @@ The secure document to verify.
85
85
  `Promise`\<`boolean`\>
86
86
 
87
87
  True if all proofs in the document are verified successfully.
88
+
89
+ ***
90
+
91
+ ### checkValidityPeriod() {#checkvalidityperiod}
92
+
93
+ > `static` **checkValidityPeriod**(`credential`): `void`
94
+
95
+ Check a verifiable credential is within its validity period.
96
+
97
+ #### Parameters
98
+
99
+ ##### credential
100
+
101
+ `IDidVerifiableCredential`
102
+
103
+ The credential to check, either VC data model v1 or v2.
104
+
105
+ #### Returns
106
+
107
+ `void`
108
+
109
+ #### Throws
110
+
111
+ GeneralError if the credential has expired or is not yet valid.
@@ -61,6 +61,8 @@
61
61
  ## Type Aliases
62
62
 
63
63
  - [IdentityMetricIds](type-aliases/IdentityMetricIds.md)
64
+ - [IdentitySpanAttributes](type-aliases/IdentitySpanAttributes.md)
65
+ - [IdentitySpanNames](type-aliases/IdentitySpanNames.md)
64
66
 
65
67
  ## Variables
66
68
 
@@ -69,3 +71,5 @@
69
71
  - [IdentityResolverConnectorFactory](variables/IdentityResolverConnectorFactory.md)
70
72
  - [IdentityMetricIds](variables/IdentityMetricIds.md)
71
73
  - [IdentityMetrics](variables/IdentityMetrics.md)
74
+ - [IdentitySpanAttributes](variables/IdentitySpanAttributes.md)
75
+ - [IdentitySpanNames](variables/IdentitySpanNames.md)
@@ -0,0 +1,5 @@
1
+ # Type Alias: IdentitySpanAttributes
2
+
3
+ > **IdentitySpanAttributes** = *typeof* [`IdentitySpanAttributes`](../variables/IdentitySpanAttributes.md)\[keyof *typeof* [`IdentitySpanAttributes`](../variables/IdentitySpanAttributes.md)\]
4
+
5
+ Union type of all identity span attribute key string values.
@@ -0,0 +1,5 @@
1
+ # Type Alias: IdentitySpanNames
2
+
3
+ > **IdentitySpanNames** = *typeof* [`IdentitySpanNames`](../variables/IdentitySpanNames.md)\[keyof *typeof* [`IdentitySpanNames`](../variables/IdentitySpanNames.md)\]
4
+
5
+ Union type of all identity span name string values.
@@ -0,0 +1,25 @@
1
+ # Variable: IdentitySpanAttributes
2
+
3
+ > `const` **IdentitySpanAttributes**: `object`
4
+
5
+ The span attribute keys for the identity domain.
6
+
7
+ ## Type Declaration
8
+
9
+ ### Id {#id}
10
+
11
+ > `readonly` **Id**: `"identity.id"` = `"identity.id"`
12
+
13
+ The id of the identity document the operation is for.
14
+
15
+ ### VerificationMethodId {#verificationmethodid}
16
+
17
+ > `readonly` **VerificationMethodId**: `"identity.verification-method-id"` = `"identity.verification-method-id"`
18
+
19
+ The id of the verification method the operation is for.
20
+
21
+ ### ServiceId {#serviceid}
22
+
23
+ > `readonly` **ServiceId**: `"identity.service-id"` = `"identity.service-id"`
24
+
25
+ The id of the service the operation is for.
@@ -0,0 +1,103 @@
1
+ # Variable: IdentitySpanNames
2
+
3
+ > `const` **IdentitySpanNames**: `object`
4
+
5
+ The span names for the identity domain.
6
+
7
+ ## Type Declaration
8
+
9
+ ### Create {#create}
10
+
11
+ > `readonly` **Create**: `"identity/create"` = `"identity/create"`
12
+
13
+ Create an identity.
14
+
15
+ ### Remove {#remove}
16
+
17
+ > `readonly` **Remove**: `"identity/remove"` = `"identity/remove"`
18
+
19
+ Remove an identity.
20
+
21
+ ### VerificationMethodCreate {#verificationmethodcreate}
22
+
23
+ > `readonly` **VerificationMethodCreate**: `"identity/verification-method-create"` = `"identity/verification-method-create"`
24
+
25
+ Create a verification method.
26
+
27
+ ### VerificationMethodRemove {#verificationmethodremove}
28
+
29
+ > `readonly` **VerificationMethodRemove**: `"identity/verification-method-remove"` = `"identity/verification-method-remove"`
30
+
31
+ Remove a verification method.
32
+
33
+ ### ServiceCreate {#servicecreate}
34
+
35
+ > `readonly` **ServiceCreate**: `"identity/service-create"` = `"identity/service-create"`
36
+
37
+ Create a service.
38
+
39
+ ### ServiceRemove {#serviceremove}
40
+
41
+ > `readonly` **ServiceRemove**: `"identity/service-remove"` = `"identity/service-remove"`
42
+
43
+ Remove a service.
44
+
45
+ ### AlsoKnownAsAdd {#alsoknownasadd}
46
+
47
+ > `readonly` **AlsoKnownAsAdd**: `"identity/also-known-as-add"` = `"identity/also-known-as-add"`
48
+
49
+ Add an also known as alias.
50
+
51
+ ### AlsoKnownAsRemove {#alsoknownasremove}
52
+
53
+ > `readonly` **AlsoKnownAsRemove**: `"identity/also-known-as-remove"` = `"identity/also-known-as-remove"`
54
+
55
+ Remove an also known as alias.
56
+
57
+ ### VerifiableCredentialCreate {#verifiablecredentialcreate}
58
+
59
+ > `readonly` **VerifiableCredentialCreate**: `"identity/verifiable-credential-create"` = `"identity/verifiable-credential-create"`
60
+
61
+ Create a verifiable credential.
62
+
63
+ ### VerifiableCredentialVerify {#verifiablecredentialverify}
64
+
65
+ > `readonly` **VerifiableCredentialVerify**: `"identity/verifiable-credential-verify"` = `"identity/verifiable-credential-verify"`
66
+
67
+ Verify a verifiable credential.
68
+
69
+ ### VerifiableCredentialRevoke {#verifiablecredentialrevoke}
70
+
71
+ > `readonly` **VerifiableCredentialRevoke**: `"identity/verifiable-credential-revoke"` = `"identity/verifiable-credential-revoke"`
72
+
73
+ Revoke a verifiable credential.
74
+
75
+ ### VerifiableCredentialUnrevoke {#verifiablecredentialunrevoke}
76
+
77
+ > `readonly` **VerifiableCredentialUnrevoke**: `"identity/verifiable-credential-unrevoke"` = `"identity/verifiable-credential-unrevoke"`
78
+
79
+ Unrevoke a verifiable credential.
80
+
81
+ ### VerifiablePresentationCreate {#verifiablepresentationcreate}
82
+
83
+ > `readonly` **VerifiablePresentationCreate**: `"identity/verifiable-presentation-create"` = `"identity/verifiable-presentation-create"`
84
+
85
+ Create a verifiable presentation.
86
+
87
+ ### VerifiablePresentationVerify {#verifiablepresentationverify}
88
+
89
+ > `readonly` **VerifiablePresentationVerify**: `"identity/verifiable-presentation-verify"` = `"identity/verifiable-presentation-verify"`
90
+
91
+ Verify a verifiable presentation.
92
+
93
+ ### ProofCreate {#proofcreate}
94
+
95
+ > `readonly` **ProofCreate**: `"identity/proof-create"` = `"identity/proof-create"`
96
+
97
+ Create a proof.
98
+
99
+ ### ProofVerify {#proofverify}
100
+
101
+ > `readonly` **ProofVerify**: `"identity/proof-verify"` = `"identity/proof-verify"`
102
+
103
+ Verify a proof.
package/locales/en.json CHANGED
@@ -2,7 +2,10 @@
2
2
  "error": {
3
3
  "verificationHelper": {
4
4
  "jwtDecodeFailed": "Decoding the JWT failed",
5
- "proofMissingVerificationMethod": "The proof is missing the verification method"
5
+ "proofMissingVerificationMethod": "The proof is missing the verification method",
6
+ "credentialNotYetValid": "The credential is not valid until \"{validFrom}\"",
7
+ "credentialExpired": "The credential expired at \"{validUntil}\"",
8
+ "credentialValidityDateInvalid": "The credential validity date is not a valid ISO 8601 timestamp \"{date}\""
6
9
  },
7
10
  "documentHelper": {
8
11
  "verificationMethodNotFound": "The verification method \"{methodName}\" of type \"{methodType}\" could not be found",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-models",
3
- "version": "0.9.2-next.9",
3
+ "version": "0.9.3-next.1",
4
4
  "description": "Shared identity models and contracts for consistent data structures across services, connectors, and clients.",
5
5
  "repository": {
6
6
  "type": "git",