gdc-common-utils-ts 1.0.4 → 1.0.7

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 (202) hide show
  1. package/dist/AesManager.d.ts +27 -0
  2. package/dist/AesManager.js +62 -0
  3. package/dist/CryptographyService.d.ts +76 -0
  4. package/dist/CryptographyService.js +403 -0
  5. package/dist/constants/Schemas.d.ts +45 -0
  6. package/dist/constants/Schemas.js +48 -0
  7. package/dist/constants/index.js +1 -0
  8. package/{src/constants/schemaorg.ts → dist/constants/schemaorg.d.ts} +24 -116
  9. package/dist/constants/schemaorg.js +185 -0
  10. package/dist/cryptoDecode.d.ts +3 -0
  11. package/dist/cryptoDecode.js +90 -0
  12. package/dist/cryptoEncode.d.ts +1 -0
  13. package/dist/cryptoEncode.js +30 -0
  14. package/dist/cryptography.abstract.d.ts +13 -0
  15. package/{src/cryptography.abstract.ts → dist/cryptography.abstract.js} +6 -14
  16. package/dist/hmac.d.ts +2 -0
  17. package/{src/hmac.ts → dist/hmac.js} +4 -7
  18. package/dist/index.js +3 -0
  19. package/{src/interfaces/Cryptography.types.ts → dist/interfaces/Cryptography.types.d.ts} +71 -71
  20. package/dist/interfaces/Cryptography.types.js +8 -0
  21. package/dist/interfaces/ICryptoHelper.d.ts +28 -0
  22. package/dist/interfaces/ICryptoHelper.js +3 -0
  23. package/dist/interfaces/ICryptography.d.ts +154 -0
  24. package/dist/interfaces/ICryptography.js +3 -0
  25. package/dist/interfaces/IWallet.d.ts +55 -0
  26. package/dist/interfaces/IWallet.js +3 -0
  27. package/dist/interfaces/MlDsa.d.ts +9 -0
  28. package/{src/interfaces/MlDsa.ts → dist/interfaces/MlDsa.js} +1 -5
  29. package/dist/interfaces/MlKem.d.ts +11 -0
  30. package/{src/interfaces/MlKem.ts → dist/interfaces/MlKem.js} +0 -5
  31. package/dist/models/aes.d.ts +85 -0
  32. package/dist/models/aes.js +10 -0
  33. package/dist/models/auth.d.ts +35 -0
  34. package/dist/models/auth.js +3 -0
  35. package/{src/models/bundle.ts → dist/models/bundle.d.ts} +41 -63
  36. package/dist/models/bundle.js +26 -0
  37. package/dist/models/clinical-sections.d.ts +36 -0
  38. package/dist/models/clinical-sections.en.d.ts +75 -0
  39. package/dist/models/clinical-sections.en.js +81 -0
  40. package/dist/models/clinical-sections.js +32 -0
  41. package/dist/models/comm.d.ts +44 -0
  42. package/dist/models/comm.js +4 -0
  43. package/{src/models/confidential-job.ts → dist/models/confidential-job.d.ts} +23 -45
  44. package/dist/models/confidential-job.js +20 -0
  45. package/dist/models/confidential-message.d.ts +97 -0
  46. package/dist/models/confidential-message.js +4 -0
  47. package/{src/models/confidential-storage.ts → dist/models/confidential-storage.d.ts} +35 -56
  48. package/dist/models/confidential-storage.js +3 -0
  49. package/{src/models/consent-rule.ts → dist/models/consent-rule.d.ts} +22 -42
  50. package/dist/models/consent-rule.js +21 -0
  51. package/{src/models/crypto.ts → dist/models/crypto.d.ts} +5 -13
  52. package/dist/models/crypto.js +3 -0
  53. package/dist/models/device-license.d.ts +133 -0
  54. package/dist/models/device-license.js +3 -0
  55. package/{src/models/did.ts → dist/models/did.d.ts} +21 -30
  56. package/dist/models/did.js +3 -0
  57. package/dist/models/index.js +31 -0
  58. package/dist/models/indexing.d.ts +11 -0
  59. package/dist/models/indexing.js +18 -0
  60. package/dist/models/issue.d.ts +57 -0
  61. package/dist/models/issue.js +75 -0
  62. package/dist/models/jsonapi.d.ts +13 -0
  63. package/dist/models/jsonapi.js +3 -0
  64. package/{src/models/jwe.ts → dist/models/jwe.d.ts} +10 -22
  65. package/dist/models/jwe.js +3 -0
  66. package/{src/models/jwk.ts → dist/models/jwk.d.ts} +0 -11
  67. package/dist/models/jwk.js +3 -0
  68. package/{src/models/jws.ts → dist/models/jws.d.ts} +0 -7
  69. package/dist/models/jws.js +3 -0
  70. package/dist/models/jwt.d.ts +9 -0
  71. package/dist/models/jwt.js +3 -0
  72. package/dist/models/multibase58.d.ts +13 -0
  73. package/dist/models/multibase58.js +40 -0
  74. package/dist/models/oidc4ida.common.model.d.ts +33 -0
  75. package/dist/models/oidc4ida.common.model.js +3 -0
  76. package/dist/models/oidc4ida.document.model.d.ts +50 -0
  77. package/dist/models/oidc4ida.document.model.js +3 -0
  78. package/{src/models/oidc4ida.electronicRecord.model.ts → dist/models/oidc4ida.electronicRecord.model.d.ts} +18 -37
  79. package/dist/models/oidc4ida.electronicRecord.model.js +3 -0
  80. package/{src/models/oidc4ida.evidence.model.ts → dist/models/oidc4ida.evidence.model.d.ts} +17 -35
  81. package/dist/models/oidc4ida.evidence.model.js +5 -0
  82. package/dist/models/openid-device.d.ts +119 -0
  83. package/dist/models/openid-device.js +3 -0
  84. package/dist/models/operation-outcome.d.ts +26 -0
  85. package/dist/models/operation-outcome.js +3 -0
  86. package/{src/models/params.ts → dist/models/params.d.ts} +20 -29
  87. package/dist/models/params.js +3 -0
  88. package/dist/models/resource-document.d.ts +14 -0
  89. package/dist/models/resource-document.js +3 -0
  90. package/dist/models/response.d.ts +1 -0
  91. package/dist/models/response.js +3 -0
  92. package/dist/models/urlPath.d.ts +58 -0
  93. package/dist/models/urlPath.js +76 -0
  94. package/dist/models/verifiable-credential.d.ts +45 -0
  95. package/dist/models/verifiable-credential.js +8 -0
  96. package/dist/utils/actor.d.ts +18 -0
  97. package/dist/utils/actor.js +36 -0
  98. package/dist/utils/base-convert.d.ts +20 -0
  99. package/{src/utils/base-convert.ts → dist/utils/base-convert.js} +23 -36
  100. package/dist/utils/baseN.d.ts +35 -0
  101. package/dist/utils/baseN.js +174 -0
  102. package/dist/utils/bundle.d.ts +6 -0
  103. package/dist/utils/bundle.js +32 -0
  104. package/dist/utils/content.d.ts +55 -0
  105. package/{src/utils/content.ts → dist/utils/content.js} +4 -10
  106. package/dist/utils/did.d.ts +67 -0
  107. package/dist/utils/did.js +123 -0
  108. package/dist/utils/format-converter.d.ts +21 -0
  109. package/dist/utils/format-converter.js +109 -0
  110. package/dist/utils/index.js +13 -0
  111. package/dist/utils/jwt.d.ts +52 -0
  112. package/dist/utils/jwt.js +153 -0
  113. package/dist/utils/manager-error.d.ts +15 -0
  114. package/dist/utils/manager-error.js +23 -0
  115. package/dist/utils/multibase58.d.ts +13 -0
  116. package/dist/utils/multibase58.js +40 -0
  117. package/dist/utils/multibasehash.d.ts +8 -0
  118. package/{src/utils/multibasehash.ts → dist/utils/multibasehash.js} +8 -13
  119. package/dist/utils/normalize.d.ts +16 -0
  120. package/{src/utils/normalize.ts → dist/utils/normalize.js} +15 -18
  121. package/dist/utils/object-convert.d.ts +20 -0
  122. package/{src/utils/object-convert.ts → dist/utils/object-convert.js} +10 -16
  123. package/dist/utils/string-convert.d.ts +24 -0
  124. package/{src/utils/string-convert.ts → dist/utils/string-convert.js} +5 -14
  125. package/dist/utils/string-utils.d.ts +25 -0
  126. package/{src/utils/string-utils.ts → dist/utils/string-utils.js} +12 -16
  127. package/dist/utils/url.d.ts +27 -0
  128. package/{src/utils/url.ts → dist/utils/url.js} +6 -7
  129. package/package.json +56 -14
  130. package/PUBLISHING.md +0 -33
  131. package/__tests__/AesManager.test.ts +0 -53
  132. package/__tests__/CryptographyService.test.ts +0 -194
  133. package/__tests__/bundle.test.ts +0 -29
  134. package/__tests__/content.test.ts +0 -72
  135. package/__tests__/crypto-encode-decode.test.ts +0 -52
  136. package/__tests__/crypto-hmac.test.ts +0 -21
  137. package/__tests__/did-generateServiceId.errors.test.ts +0 -8
  138. package/__tests__/did-generateServiceId.test.ts +0 -18
  139. package/__tests__/models-clinical-sections.test.ts +0 -32
  140. package/__tests__/models-multibase58.test.ts +0 -33
  141. package/__tests__/multibase58.errors.test.ts +0 -7
  142. package/__tests__/multibase58.test.ts +0 -28
  143. package/__tests__/multibasehash.test.ts +0 -25
  144. package/__tests__/utils-actor.test.ts +0 -46
  145. package/__tests__/utils-base-convert.test.ts +0 -57
  146. package/__tests__/utils-baseN.test.ts +0 -40
  147. package/__tests__/utils-did-extra.test.ts +0 -33
  148. package/__tests__/utils-format-converter.test.ts +0 -87
  149. package/__tests__/utils-jwt.test.ts +0 -57
  150. package/__tests__/utils-manager-error.test.ts +0 -11
  151. package/__tests__/utils-normalize.test.ts +0 -15
  152. package/__tests__/utils-object-convert.test.ts +0 -38
  153. package/__tests__/utils-string-convert.test.ts +0 -20
  154. package/__tests__/utils-string-utils.test.ts +0 -25
  155. package/__tests__/utils-url.test.ts +0 -21
  156. package/babel.config.cjs +0 -5
  157. package/jest.config.ts +0 -47
  158. package/src/AesManager.ts +0 -82
  159. package/src/CryptographyService.ts +0 -461
  160. package/src/JweManager.ts.txt +0 -365
  161. package/src/KmsService.txt +0 -493
  162. package/src/constants/Schemas.ts +0 -61
  163. package/src/cryptoDecode.ts +0 -104
  164. package/src/cryptoEncode.ts +0 -36
  165. package/src/interfaces/ICryptoHelper.ts +0 -33
  166. package/src/interfaces/ICryptography.ts +0 -177
  167. package/src/interfaces/IWallet.ts +0 -62
  168. package/src/models/aes.ts +0 -93
  169. package/src/models/auth.ts +0 -38
  170. package/src/models/bundle.txt +0 -93
  171. package/src/models/clinical-sections.en.ts +0 -82
  172. package/src/models/clinical-sections.ts +0 -64
  173. package/src/models/comm.ts +0 -63
  174. package/src/models/confidential-message.ts +0 -137
  175. package/src/models/device-license.ts +0 -161
  176. package/src/models/indexing.ts +0 -20
  177. package/src/models/issue.ts +0 -85
  178. package/src/models/jsonapi.ts +0 -19
  179. package/src/models/jwt.ts +0 -15
  180. package/src/models/multibase58.ts +0 -46
  181. package/src/models/oidc4ida.common.model.ts +0 -39
  182. package/src/models/oidc4ida.document.model.ts +0 -61
  183. package/src/models/openid-device.ts +0 -146
  184. package/src/models/operation-outcome.ts +0 -34
  185. package/src/models/resource-document.ts +0 -21
  186. package/src/models/response.ts +0 -5
  187. package/src/models/urlPath.ts +0 -76
  188. package/src/models/verifiable-credential.ts +0 -52
  189. package/src/types/noble-hashes.d.ts +0 -4
  190. package/src/utils/actor.ts +0 -56
  191. package/src/utils/baseN.ts +0 -203
  192. package/src/utils/bundle.ts +0 -30
  193. package/src/utils/did.ts +0 -155
  194. package/src/utils/format-converter.ts +0 -119
  195. package/src/utils/jwt.ts +0 -165
  196. package/src/utils/manager-error.ts +0 -27
  197. package/src/utils/multibase58.ts +0 -46
  198. package/tsconfig.json +0 -15
  199. /package/{src/constants/index.ts → dist/constants/index.d.ts} +0 -0
  200. /package/{src/index.ts → dist/index.d.ts} +0 -0
  201. /package/{src/models/index.ts → dist/models/index.d.ts} +0 -0
  202. /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
@@ -1,33 +1,27 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/did.ts
3
-
4
1
  import { PublicJwk } from "../interfaces/Cryptography.types";
5
2
  import { RecipientPublicKey } from "./crypto";
6
-
7
3
  /**
8
4
  * The parameters required to construct a service endpoint selector.
9
5
  * This is the contract for a specific API method to define its endpoint.
10
6
  */
11
7
  export interface ServiceEndpointSelector {
12
- /** When the organization has its own domain for the connector the apiVersion and sector do not appear in the path */
13
- apiVersion?: string;
14
- sector?: string;
15
- /** Corresponds to <sectionTypeOrCompartmentCodingSystem> */
16
- section: string; // entity, individual, ...
17
- /** Corresponds to <formatTypeOrCompartmentCodingValue> */
18
- format: string;
19
- resourceType: string;
20
- action: string;
8
+ /** When the organization has its own domain for the connector the apiVersion and sector do not appear in the path */
9
+ apiVersion?: string;
10
+ sector?: string;
11
+ /** Corresponds to <sectionTypeOrCompartmentCodingSystem> */
12
+ section: string;
13
+ /** Corresponds to <formatTypeOrCompartmentCodingValue> */
14
+ format: string;
15
+ resourceType: string;
16
+ action: string;
21
17
  }
22
-
23
18
  /**
24
19
  * Extends the base selector with authorization information.
25
20
  * This is used for endpoints that are not public and require a SMART token.
26
21
  */
27
22
  export interface SecureServiceEndpointSelector extends ServiceEndpointSelector {
28
- requiredScope: string; // The OAuth/SMART scope needed to call this endpoint
23
+ requiredScope: string;
29
24
  }
30
-
31
25
  /**
32
26
  * Represents a service endpoint in a DID Document.
33
27
  * @see https://www.w3.org/TR/did-core/#service-endpoints
@@ -36,9 +30,8 @@ export interface DidService {
36
30
  id: string;
37
31
  type: string;
38
32
  serviceEndpoint: string;
39
- [key: string]: any; // Allow for additional properties
33
+ [key: string]: any;
40
34
  }
41
-
42
35
  /**
43
36
  * Represents a DID Document, compliant with the W3C DID Core specification.
44
37
  * It describes how to use a DID, including verification methods and service endpoints.
@@ -51,31 +44,29 @@ export interface DidDocument {
51
44
  id: string;
52
45
  /** Public keys used for verifying digital signatures */
53
46
  verificationMethod?: VerificationMethod[];
54
- /**
47
+ /**
55
48
  * Specifies verification methods for making claims. Can be embedded or a string referencing a `verificationMethod`.
56
49
  * @see https://www.w3.org/TR/did-core/#assertion
57
50
  */
58
- assertionMethod?: (string | VerificationMethod)[];
59
- /**
51
+ assertionMethod?: (string | VerificationMethod)[];
52
+ /**
60
53
  * Specifies methods for authentication. Can be embedded or a string referencing a `verificationMethod`.
61
54
  * @see https://www.w3.org/TR/did-core/#authentication
62
55
  */
63
- authentication?: (string | VerificationMethod)[];
64
- /**
56
+ authentication?: (string | VerificationMethod)[];
57
+ /**
65
58
  * Specifies methods for key agreement. Can be embedded or a string referencing a `verificationMethod`.
66
59
  * @see https://www.w3.org/TR/did-core/#key-agreement
67
60
  */
68
61
  keyAgreement?: (string | VerificationMethod)[];
69
- /** Service endpoints for interacting with the entity */
62
+ /** Service endpoints for interacting with the entity */
70
63
  service?: DidService[];
71
64
  /** Other properties are allowed. */
72
65
  [key: string]: any;
73
66
  }
74
-
75
- // En src/models/did.ts (o donde esté RecipientPublicKey/VerificationMethod)
76
67
  export interface VerificationMethod extends RecipientPublicKey {
77
- id: string; // e.g., did:web:example.com#key-1
78
- type: string; // e.g., JsonWebKey2020
79
- controller: string; // e.g., did:web:example.com
80
- publicKeyJwk: PublicJwk;
68
+ id: string;
69
+ type: string;
70
+ controller: string;
71
+ publicKeyJwk: PublicJwk;
81
72
  }
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/models/did.ts
3
+ export {};
@@ -0,0 +1,31 @@
1
+ export * from './aes.js';
2
+ export * from './auth.js';
3
+ export * from './bundle.js';
4
+ export * from './comm.js';
5
+ export * from './clinical-sections.js';
6
+ export * from './clinical-sections.en.js';
7
+ export * from './confidential-job.js';
8
+ export * from './confidential-message.js';
9
+ export * from './confidential-storage.js';
10
+ export * from './consent-rule.js';
11
+ export * from './crypto.js';
12
+ export * from './device-license.js';
13
+ export * from './did.js';
14
+ export * from './indexing.js';
15
+ export * from './issue.js';
16
+ export * from './jsonapi.js';
17
+ export * from './jwe.js';
18
+ export * from './jwk.js';
19
+ export * from './jws.js';
20
+ export * from './jwt.js';
21
+ export * from './oidc4ida.common.model.js';
22
+ export * from './oidc4ida.document.model.js';
23
+ export * from './oidc4ida.electronicRecord.model.js';
24
+ export * from './oidc4ida.evidence.model.js';
25
+ export * from './openid-device.js';
26
+ export * from './operation-outcome.js';
27
+ export * from './params.js';
28
+ export * from './resource-document.js';
29
+ export * from './response.js';
30
+ export * from './urlPath.js';
31
+ export * from './verifiable-credential.js';
@@ -0,0 +1,11 @@
1
+ import { ClaimsOrganizationSchemaorg } from "../constants/schemaorg";
2
+ /**
3
+ * Defines which claims are allowed to be indexed for different resource types.
4
+ * This provides a single, strongly-typed source of truth for indexing strategies.
5
+ */
6
+ export declare const AllowedIndexableClaims: {
7
+ /**
8
+ * Defines the claims that can be indexed in the central tenant registry for an Organization.
9
+ */
10
+ organizationRegistry: readonly [ClaimsOrganizationSchemaorg.alternateName, ClaimsOrganizationSchemaorg.identifierValue, ClaimsOrganizationSchemaorg.identifierType, ClaimsOrganizationSchemaorg.addressCountry];
11
+ };
@@ -0,0 +1,18 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: src/models/indexing.ts
3
+ import { ClaimsOrganizationSchemaorg } from "../constants/schemaorg.js";
4
+ /**
5
+ * Defines which claims are allowed to be indexed for different resource types.
6
+ * This provides a single, strongly-typed source of truth for indexing strategies.
7
+ */
8
+ export const AllowedIndexableClaims = {
9
+ /**
10
+ * Defines the claims that can be indexed in the central tenant registry for an Organization.
11
+ */
12
+ organizationRegistry: [
13
+ ClaimsOrganizationSchemaorg.alternateName,
14
+ ClaimsOrganizationSchemaorg.identifierValue,
15
+ ClaimsOrganizationSchemaorg.identifierType,
16
+ ClaimsOrganizationSchemaorg.addressCountry,
17
+ ], // Use 'as const' to provide strong typing for the array elements
18
+ };
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Defines the level of an issue.
3
+ */
4
+ export declare enum IssueLevel {
5
+ /** The issue is fatal and the system is in an unstable state. */
6
+ Fatal = "fatal",
7
+ /** The issue is an error that prevents the action from completing. */
8
+ Error = "error",
9
+ /** The issue is a warning that does not prevent the action from completing. */
10
+ Warning = "warning",
11
+ /** The issue is informational and requires no action. */
12
+ Information = "information"
13
+ }
14
+ /**
15
+ * Defines the code for the type of issue.
16
+ * This is a subset of the full FHIR value set, focused on common API scenarios.
17
+ */
18
+ export declare const IssueType: {
19
+ /** Content invalid against the specification. */
20
+ readonly Invalid: "invalid";
21
+ /** A required element is missing. */
22
+ readonly Required: "required";
23
+ /** An element value is invalid. */
24
+ readonly Value: "value";
25
+ /** A business rule has been violated. */
26
+ readonly BusinessRule: "business-rule";
27
+ /** An authentication/authorization error has occurred. */
28
+ readonly Login: "login";
29
+ /** The user is not authorized for the requested action. */
30
+ readonly Forbidden: "forbidden";
31
+ /** A security-related issue has been detected. */
32
+ readonly Security: "security";
33
+ /** The resource was not found. */
34
+ readonly NotFound: "not-found";
35
+ /** The operation led to a conflict. */
36
+ readonly Conflict: "conflict";
37
+ /** A duplicate record was detected. */
38
+ readonly Duplicate: "duplicate";
39
+ /** The operation is not supported. */
40
+ readonly NotSupported: "not-supported";
41
+ /** An internal processing exception occurred. */
42
+ readonly Exception: "exception";
43
+ /** The operation has timed out. */
44
+ readonly Timeout: "timeout";
45
+ /** The operation was throttled. */
46
+ readonly Throttled: "throttled";
47
+ };
48
+ /**
49
+ * A union type derived from the keys of the IssueType object.
50
+ * This ensures that only defined issue type codes can be used.
51
+ */
52
+ export type IssueTypeCode = typeof IssueType[keyof typeof IssueType];
53
+ /**
54
+ * Maps our internal IssueType codes to the appropriate HTTP status code strings.
55
+ * This provides a single source of truth for error responses.
56
+ */
57
+ export declare const IssueTypeToHttpStatus: Record<IssueTypeCode, string>;
@@ -0,0 +1,75 @@
1
+ // src/models/issue.ts
2
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
3
+ // Source: https://www.hl7.org/fhir/valueset-issue-severity.html
4
+ /**
5
+ * Defines the level of an issue.
6
+ */
7
+ export var IssueLevel;
8
+ (function (IssueLevel) {
9
+ /** The issue is fatal and the system is in an unstable state. */
10
+ IssueLevel["Fatal"] = "fatal";
11
+ /** The issue is an error that prevents the action from completing. */
12
+ IssueLevel["Error"] = "error";
13
+ /** The issue is a warning that does not prevent the action from completing. */
14
+ IssueLevel["Warning"] = "warning";
15
+ /** The issue is informational and requires no action. */
16
+ IssueLevel["Information"] = "information";
17
+ })(IssueLevel || (IssueLevel = {}));
18
+ // Source: https://www.hl7.org/fhir/valueset-issue-type.html
19
+ /**
20
+ * Defines the code for the type of issue.
21
+ * This is a subset of the full FHIR value set, focused on common API scenarios.
22
+ */
23
+ export const IssueType = {
24
+ // --- Category: Invalid Content ---
25
+ /** Content invalid against the specification. */
26
+ Invalid: 'invalid',
27
+ /** A required element is missing. */
28
+ Required: 'required',
29
+ /** An element value is invalid. */
30
+ Value: 'value',
31
+ /** A business rule has been violated. */
32
+ BusinessRule: 'business-rule',
33
+ // --- Category: Security ---
34
+ /** An authentication/authorization error has occurred. */
35
+ Login: 'login',
36
+ /** The user is not authorized for the requested action. */
37
+ Forbidden: 'forbidden',
38
+ /** A security-related issue has been detected. */
39
+ Security: 'security',
40
+ // --- Category: Processing ---
41
+ /** The resource was not found. */
42
+ NotFound: 'not-found',
43
+ /** The operation led to a conflict. */
44
+ Conflict: 'conflict',
45
+ /** A duplicate record was detected. */
46
+ Duplicate: 'duplicate',
47
+ /** The operation is not supported. */
48
+ NotSupported: 'not-supported',
49
+ /** An internal processing exception occurred. */
50
+ Exception: 'exception',
51
+ /** The operation has timed out. */
52
+ Timeout: 'timeout',
53
+ /** The operation was throttled. */
54
+ Throttled: 'throttled',
55
+ };
56
+ /**
57
+ * Maps our internal IssueType codes to the appropriate HTTP status code strings.
58
+ * This provides a single source of truth for error responses.
59
+ */
60
+ export const IssueTypeToHttpStatus = {
61
+ [IssueType.Invalid]: '400',
62
+ [IssueType.Required]: '400',
63
+ [IssueType.Value]: '400',
64
+ [IssueType.BusinessRule]: '400',
65
+ [IssueType.Login]: '401',
66
+ [IssueType.Forbidden]: '403',
67
+ [IssueType.Security]: '403',
68
+ [IssueType.NotFound]: '404',
69
+ [IssueType.Conflict]: '409',
70
+ [IssueType.Duplicate]: '409',
71
+ [IssueType.NotSupported]: '501',
72
+ [IssueType.Exception]: '500',
73
+ [IssueType.Timeout]: '503',
74
+ [IssueType.Throttled]: '429',
75
+ };
@@ -0,0 +1,13 @@
1
+ import { RecordBase } from "./resource-document";
2
+ /**
3
+ * Represents a resource object in a JSON:API 'included' array.
4
+ * The type is made "open" with an index signature to allow for additional properties.
5
+ */
6
+ export interface IncludedResource extends RecordBase {
7
+ type: string;
8
+ meta: {
9
+ claims: Record<string, any>;
10
+ [key: string]: any;
11
+ };
12
+ [key: string]: any;
13
+ }
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: src/models/jsonapi.ts
3
+ export {};
@@ -1,35 +1,28 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/jwe.ts
3
-
4
1
  import { JWK } from "./jwk";
5
-
6
2
  /**
7
3
  * Represents the core components of a JWE (JSON Web Encryption) structure,
8
4
  * based on RFC 7516. This is the standard for encrypted data.
9
5
  */
10
-
11
6
  /**
12
7
  * Decoded protected header claims in a JWE.
13
8
  * @see https://datatracker.ietf.org/doc/html/rfc7516#section-4.1
14
9
  */
15
10
  export interface ProtectedHeadersJWE {
16
- alg?: string; // CEK encryption algorithm
17
- enc?: string; // Content encryption algorithm (e.g., "A256GCM")
18
- cty?: string; // Content type
19
- jwk?: JWK; // Senders JWK
20
- typ?: string; // Type, e.g., "didcomm-envelope-enc"
21
- kid?: string; // Recipient's key ID
22
- skid?: string; // Sender's key ID
23
- zip?: string; // Compression algorithm
11
+ alg?: string;
12
+ enc?: string;
13
+ cty?: string;
14
+ jwk?: JWK;
15
+ typ?: string;
16
+ kid?: string;
17
+ skid?: string;
18
+ zip?: string;
24
19
  }
25
-
26
20
  /**
27
21
  * Unprotected headers that are not integrity protected.
28
22
  */
29
23
  export interface UnprotectedHeadersJWE {
30
- jku?: string; // JWK Set URL
24
+ jku?: string;
31
25
  }
32
-
33
26
  /**
34
27
  * Represents the data for a single recipient of the JWE.
35
28
  */
@@ -40,7 +33,6 @@ export interface RecipientDataJWE {
40
33
  kid: string;
41
34
  };
42
35
  }
43
-
44
36
  /**
45
37
  * Represents the protected (integrity-protected) header of a JWE.
46
38
  * These parameters are combined with the AAD (Additional Authenticated Data)
@@ -67,7 +59,6 @@ export interface ProtectedHeadersJWE {
67
59
  /** Compression algorithm ('DEF' for DEFLATE). */
68
60
  zip?: string;
69
61
  }
70
-
71
62
  /**
72
63
  * Represents the unprotected header of a JWE.
73
64
  * These parameters are not integrity-protected.
@@ -76,7 +67,6 @@ export interface UnprotectedHeadersJWE {
76
67
  /** JWK Set URL, a URL pointing to a set of keys. */
77
68
  jku?: string;
78
69
  }
79
-
80
70
  /**
81
71
  * Represents the data specific to a single recipient of a JWE.
82
72
  */
@@ -91,7 +81,6 @@ export interface RecipientDataJWE {
91
81
  kid: string;
92
82
  };
93
83
  }
94
-
95
84
  /**
96
85
  * Represents a JWE object before encryption.
97
86
  * It contains the plaintext data and the configuration for encryption.
@@ -103,7 +92,7 @@ export interface UnencryptedJWE {
103
92
  unprotected?: UnprotectedHeadersJWE;
104
93
  /** The list of recipients for whom the content is encrypted. */
105
94
  recipients: RecipientDataJWE[];
106
- /**
95
+ /**
107
96
  * The plaintext data to be encrypted, already serialized.
108
97
  * For structured data (like a TenantConfig), this MUST be the result of `JSON.stringify`.
109
98
  * For binary data (like a PDF), this MUST be a Uint8Array.
@@ -111,7 +100,6 @@ export interface UnencryptedJWE {
111
100
  */
112
101
  plaintext: string | Uint8Array;
113
102
  }
114
-
115
103
  /**
116
104
  * Represents a JWE (JSON Web Encryption) in the General JSON Serialization format.
117
105
  * This structure supports multiple recipients.
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/models/jwe.ts
3
+ export {};
@@ -1,6 +1,3 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/jwk.ts
3
-
4
1
  /**
5
2
  * Represents a JSON Web Key (JWK), a standard format for representing cryptographic keys.
6
3
  * This interface supports both symmetric (oct) and asymmetric keys (EC, RSA, OKP, and Post-Quantum).
@@ -17,8 +14,6 @@ export interface JWK {
17
14
  kty?: string;
18
15
  /** Public Key Use ('sig' for signature, 'enc' for encryption). */
19
16
  use?: string;
20
-
21
- // --- Asymmetric Key Parameters ---
22
17
  /** The curve for an ML-KEM or EC key (e.g., 'P-256'). */
23
18
  crv?: string;
24
19
  /** The private key component for ML-KEM or EC asymmetric keys. */
@@ -27,21 +22,15 @@ export interface JWK {
27
22
  x?: string;
28
23
  /** The public 'y' coordinate for an EC key. */
29
24
  y?: string;
30
-
31
- // --- Post-Quantum ML-DSA (Dilithium) Parameters ---
32
25
  /** The public key component for an ML-DSA key. */
33
26
  pub?: string;
34
27
  /** The private key component for an ML-DSA key. */
35
28
  priv?: string;
36
-
37
- // --- Symmetric Key Parameters ---
38
29
  /** The symmetric key value. */
39
30
  k?: string;
40
-
41
31
  /** Any other custom JWK properties. */
42
32
  [propName: string]: unknown;
43
33
  }
44
-
45
34
  /**
46
35
  * Represents a set of JSON Web Keys (JWKs).
47
36
  */
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/models/jwk.ts
3
+ export {};
@@ -1,8 +1,4 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/jws.ts
3
-
4
1
  import { JWK } from './jwk';
5
-
6
2
  /**
7
3
  * Represents the header parameters of a JSON Web Signature (JWS).
8
4
  */
@@ -18,7 +14,6 @@ export interface JwsHeader {
18
14
  /** The full public key, used in bootstrapping scenarios. */
19
15
  jwk?: JWK;
20
16
  }
21
-
22
17
  /**
23
18
  * Represents a signature entry in a JWS using the General JSON Serialization format.
24
19
  */
@@ -28,7 +23,6 @@ export interface JwsDetachedSignParts {
28
23
  /** The Base64URL encoded signature. */
29
24
  signature: string;
30
25
  }
31
-
32
26
  /**
33
27
  * Represents a JWS (JSON Web Signature) in the General JSON Serialization format.
34
28
  * This structure supports multiple signatures.
@@ -39,4 +33,3 @@ export interface JwsMultiSign {
39
33
  /** An array of one or more signatures. */
40
34
  signatures: JwsDetachedSignParts[];
41
35
  }
42
-
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/models/jws.ts
3
+ export {};
@@ -0,0 +1,9 @@
1
+ import { JwsDetachedSignParts } from "./jws";
2
+ export interface JwtCompactParts extends JwsDetachedSignParts {
3
+ payload: string;
4
+ }
5
+ export interface DataCompactJWT {
6
+ protected: object;
7
+ payload: object;
8
+ signature?: Uint8Array;
9
+ }
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/models/jwt.ts
3
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Encode bytes into multibase base58btc string (prefixed with 'z').
3
+ * Equivalent to multiformats base58btc.encode.
4
+ */
5
+ export declare function encodeMultibase58btc(data: Uint8Array): string;
6
+ /**
7
+ * Decode a multibase base58btc string (must start with 'z').
8
+ * Equivalent to multiformats base58btc.decode.
9
+ */
10
+ export declare function decodeMultibase58btc(multibaseStr: string): Uint8Array;
11
+ export declare function encodeHexToMultibase58btc(hexStr: string): string;
12
+ export declare function decodeMultibase58btcToHex(b58str: string): string;
13
+ export declare function decodeMultibase58btcToUUID(b58str: string): string;
@@ -0,0 +1,40 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/multibase58.ts
3
+ import baseX from "base-x";
4
+ const BASE58_BTC_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
5
+ const base58btc = baseX(BASE58_BTC_ALPHABET);
6
+ /**
7
+ * Encode bytes into multibase base58btc string (prefixed with 'z').
8
+ * Equivalent to multiformats base58btc.encode.
9
+ */
10
+ export function encodeMultibase58btc(data) {
11
+ return "z" + base58btc.encode(Buffer.from(data));
12
+ }
13
+ /**
14
+ * Decode a multibase base58btc string (must start with 'z').
15
+ * Equivalent to multiformats base58btc.decode.
16
+ */
17
+ export function decodeMultibase58btc(multibaseStr) {
18
+ if (!multibaseStr.startsWith("z")) {
19
+ throw new Error("Invalid multibase58btc string: missing 'z' prefix");
20
+ }
21
+ return new Uint8Array(base58btc.decode(multibaseStr.slice(1)));
22
+ }
23
+ // HEX ➜ multibase base58btc (quita guiones si los hay)
24
+ export function encodeHexToMultibase58btc(hexStr) {
25
+ const hexClean = hexStr.replace(/-/g, "").toLowerCase();
26
+ if (!/^[0-9a-f]{32}$/i.test(hexClean))
27
+ throw new Error("Invalid 16-byte hex string");
28
+ const bytes = new Uint8Array(hexClean.match(/.{1,2}/g).map(b => parseInt(b, 16)));
29
+ return encodeMultibase58btc(bytes);
30
+ }
31
+ // multibase base58btc ➜ hex (no hyppens)
32
+ export function decodeMultibase58btcToHex(b58str) {
33
+ const bytes = decodeMultibase58btc(b58str);
34
+ return Array.from(bytes).map(b => b.toString(16).padStart(2, "0")).join("");
35
+ }
36
+ // multibase base58btc ➜ UUID (with hyppens)
37
+ export function decodeMultibase58btcToUUID(b58str) {
38
+ const hex = decodeMultibase58btcToHex(b58str);
39
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
40
+ }
@@ -0,0 +1,33 @@
1
+ /** Digest object represents a cryptographic hash of some bytes (e.g.: the content of a document).
2
+ * It has 'alg' and 'value' (Base64 encoded, not hexadecimal such as in W3C format).
3
+ */
4
+ export interface DigestResultOpenIdData {
5
+ alg: string;
6
+ value: string;
7
+ }
8
+ /** Attachment OpenID
9
+ * The "digest" is REQUIRED: digest.alg and digest.value (Base64 encoded, not Base64Url).
10
+ * The "url" is REQUIRED to be "urn:uuid:<uuidv4>" for the resource/record (same as the FHIR "fullUrl" property with urn:uuid:<uuidv4>).
11
+ */
12
+ export interface AttachmentExternalDLT {
13
+ digest: DigestResultOpenIdData;
14
+ url?: string;
15
+ }
16
+ /** CheckDetails is a JSON array representing the checks done in relation to the evidence.
17
+ * The "check_method" is REQUIRED (see https://bitbucket.org/openid/ekyc-ida/wiki/identifiers#check_methods):
18
+ * - check_method: REQUIRED. String representing the check done, this includes processes such as checking the authenticity of the document, or verifying the user's biometric against an identity document (e.g.: vcrypt, vdig, vpip, vpvp...)
19
+ * - organization: OPTIONAL. String denoting the legal entity that performed the check. This SHOULD be included if the OP did not perform the check itself.
20
+ * - txn: OPTIONAL. Identifier referring to the identity verification transaction. The OP MUST ensure that this is present when evidence_ref element is used. The OP MUST ensure that the transaction identifier can be resolved into transaction details during an audit.
21
+ * - time: OPTIONAL. Time stamp in ISO 8601 [ISO8601] YYYY-MM-DDThh:mm[:ss]TZD format representing the date when the check was completed.
22
+ */
23
+ export interface CheckDetails {
24
+ check_method: string;
25
+ organization?: string;
26
+ txn?: string;
27
+ time?: string;
28
+ }
29
+ /** 'organization' is the organization ID which performed the verification on behalf of the OP */
30
+ export interface VerifierDLT {
31
+ organization: string;
32
+ txn?: string;
33
+ }
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/models/oidc4ida.common.model.ts
3
+ export {};
@@ -0,0 +1,50 @@
1
+ import { AttachmentExternalDLT, CheckDetails, VerifierDLT } from './oidc4ida.common.model';
2
+ import { IssuerElectronicRecordDLT } from './oidc4ida.electronicRecord.model';
3
+ /** Common for Document and Bill evidences */
4
+ export interface EvidenceCommonSubElementDLT {
5
+ method: string;
6
+ time?: string;
7
+ }
8
+ /** Predefined method values are given in Verification Methods (https://bitbucket.org/openid/ekyc-ida/wiki/identifiers)
9
+ * - pipp (Physical In-Person Proofing)
10
+ * - sripp (Supervised remote In-Person Proofing)
11
+ * - eid (Online verification of an electronic ID card)
12
+ * - uripp (Unsupervised remote in-person proofing with video capture of the ID document, user self-portrait video and liveness checks).
13
+ */
14
+ export interface EvidenceDocumentDLT extends EvidenceCommonSubElementDLT {
15
+ attachments?: AttachmentExternalDLT;
16
+ check_details?: CheckDetails[];
17
+ document_details?: DocumentDetailsDLT;
18
+ method: string;
19
+ time?: string;
20
+ type: 'document';
21
+ verifier: VerifierDLT;
22
+ }
23
+ /** OpenID 'document' evidence sub-element.
24
+ * - 'type' of the (physical) document (standarized).
25
+ * - 'date_of_issuance' is the date the document was issued as ISO 8601:2004 YYYY-MM-DD format.
26
+ * - 'date_of_expiry' is the date the document will expire as ISO 8601:2004 YYYY-MM-DD format.
27
+ * - 'serial_number' is the model of the document irrespective of any personalization information (usually physical artefacts and is present before personalization).
28
+ * - 'document_number' is the unique document ID that was issued to the End-User and will change if it is reissued, e.g., a passport number, certificate number, etc.
29
+ * Note: number can be used as an alias for 'document_number' for backward compatibilty purposes but will be deprecated in future releases, implementers are recommended to use document_number.
30
+ */
31
+ export interface DocumentDetailsBase {
32
+ date_of_expiry?: string;
33
+ date_of_issuance?: string;
34
+ document_number?: string;
35
+ serial_number?: string;
36
+ type: string;
37
+ }
38
+ /** JSON object representing the document used to perform the identity verification.
39
+ * - type: REQUIRED. Standardized values are defined in the Identity Documents section. The OP MAY use other than the predefined values in which case the RPs will either be unable to process the assertion, just store this value for audit purposes, or apply bespoken business logic to it.
40
+ * - personal_number: OPTIONAL. It is the subject's DID URI (can be also the holder).
41
+ * - issuer: OPTIONAL. JSON object containing information about the issuer of this document.
42
+ * - date_of_issuance: REQUIRED. If this attribute exists for the particular type of document. The date the document was issued as ISO 8601:2004 YYYY-MM-DD format.
43
+ * - date_of_expiry: REQUIRED. If this attribute exists for the particular type of document. The date the document will expire as ISO 8601:2004 YYYY-MM-DD format.
44
+ * - document_number: OPTIONAL. Unique document ID that was issued to the End-User. This is used on one document and will change if it is reissued, e.g., a passport number, certificate number, etc. Note: number can be used as an alias for 'document_number' for backward compatibilty purposes but will be deprecated in future releases, implementers are recommended to use document_number.
45
+ * - serial_number: OPTIONAL. Model of document irrespective of any personalization information (usually physical artefacts and is present before personalization).
46
+ */
47
+ export interface DocumentDetailsDLT extends DocumentDetailsBase {
48
+ issuer?: IssuerElectronicRecordDLT;
49
+ personal_number?: string;
50
+ }
@@ -0,0 +1,3 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ // File: crypto-ts/models/oidc4ida.document.model.ts
3
+ export {};