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,61 +0,0 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/oidc4ida.document.model.ts
3
-
4
- import { AttachmentExternalDLT, CheckDetails, VerifierDLT } from './oidc4ida.common.model';
5
- import { IssuerElectronicRecordDLT } from './oidc4ida.electronicRecord.model';
6
-
7
- /** Common for Document and Bill evidences */
8
- export interface EvidenceCommonSubElementDLT {
9
- method: string; // REQUIRED. The method used to verify it: pipp (Physical In-Person Proofing), sripp (Supervised remote In-Person Proofing), eid (Online verification of an electronic ID card), uripp (Unsupervised remote in-person proofing with video capture of the ID document, user self-portrait video and liveness checks). Predefined values are given in Verification Methods
10
- time?: string; // OPTIONAL. Time stamp in ISO 8601:2004 [ISO8601-2004] YYYY-MM-DDThh:mm[:ss]TZD format representing the date when it was verified
11
- }
12
-
13
- /** Predefined method values are given in Verification Methods (https://bitbucket.org/openid/ekyc-ida/wiki/identifiers)
14
- * - pipp (Physical In-Person Proofing)
15
- * - sripp (Supervised remote In-Person Proofing)
16
- * - eid (Online verification of an electronic ID card)
17
- * - uripp (Unsupervised remote in-person proofing with video capture of the ID document, user self-portrait video and liveness checks).
18
- */
19
- export interface EvidenceDocumentDLT extends
20
- EvidenceCommonSubElementDLT // method, time
21
- {
22
- attachments?: AttachmentExternalDLT; // OPTIONAL. Representing proofs of attachments like photocopies of documents or certificates.
23
- check_details?: CheckDetails[]; // OPTIONAL. Checks done in relation to the evidence. https://bitbucket.org/openid/ekyc-ida/wiki/identifiers
24
- document_details?: DocumentDetailsDLT; // OPTIONAL. Object representing the id document used to perform the identity verification.
25
- method: string; // REQUIRED. The method used to verify it: pipp (Physical In-Person Proofing), sripp (Supervised remote In-Person Proofing), eid (Online verification of an electronic ID card), uripp (Unsupervised remote in-person proofing with video capture of the ID document, user self-portrait video and liveness checks). Predefined values are given in Verification Methods
26
- time?: string; // OPTIONAL. Time stamp in ISO 8601:2004 [ISO8601-2004] YYYY-MM-DDThh:mm[:ss]TZD format representing the date when it was verified
27
- type: 'document'; // REQUIRED. Value MUST be set to 'document'. Note: id_document is an alias for document for backward compatibilty purposes but will be deprecated in future releases, implementers are recommended to use document.
28
- verifier: VerifierDLT; // txn is required: legal entity that performed the identity verification on behalf of the OP.
29
- }
30
-
31
- /** OpenID 'document' evidence sub-element.
32
- * - 'type' of the (physical) document (standarized).
33
- * - 'date_of_issuance' is the date the document was issued as ISO 8601:2004 YYYY-MM-DD format.
34
- * - 'date_of_expiry' is the date the document will expire as ISO 8601:2004 YYYY-MM-DD format.
35
- * - 'serial_number' is the model of the document irrespective of any personalization information (usually physical artefacts and is present before personalization).
36
- * - '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.
37
- * 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.
38
- */
39
- export interface DocumentDetailsBase {
40
- date_of_expiry?: string; // OPTIONAL. If this attribute exists for the particular type of document. The date the document will expire as ISO 8601:2004 YYYY-MM-DD format.
41
- date_of_issuance?: string; // OPTIONAL. If this attribute exists for the particular type of document. The date the document was issued as ISO 8601:2004 YYYY-MM-DD format.
42
- document_number?: string; // 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.
43
- serial_number?: string; // OPTIONAL. Model of document irrespective of any personalization information (usually physical artefacts and is present before personalization).
44
- type: string; // 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.
45
- }
46
-
47
- /** JSON object representing the document used to perform the identity verification.
48
- * - 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.
49
- * - personal_number: OPTIONAL. It is the subject's DID URI (can be also the holder).
50
- * - issuer: OPTIONAL. JSON object containing information about the issuer of this document.
51
- * - 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.
52
- * - 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.
53
- * - 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.
54
- * - serial_number: OPTIONAL. Model of document irrespective of any personalization information (usually physical artefacts and is present before personalization).
55
- */
56
- export interface DocumentDetailsDLT extends
57
- DocumentDetailsBase // type, date_of_issuance, date_of_expiry, document_number, serial_number (model of the document irrespective of any personalization information)
58
- {
59
- issuer?: IssuerElectronicRecordDLT; // OPTIONAL. Object containing information about the issuer of this document.
60
- personal_number?: string; // OPTIONAL. Holder.id / subjectId
61
- }
@@ -1,146 +0,0 @@
1
- // src/models/openid-device.ts
2
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
3
-
4
- /**
5
- * @fileoverview Defines data models for device registration based on OpenID Connect Dynamic Client Registration 1.0,
6
- * with custom extensions for native device information.
7
- * @see https://openid.net/specs/openid-connect-registration-1_0.html
8
- */
9
-
10
- import { JwkSet } from "./jwk";
11
-
12
- /**
13
- * Represents the information about the physical device being registered.
14
- * This is a custom extension to the OpenID DCR standard.
15
- */
16
- export interface OpenIdDeviceInfo {
17
- /**
18
- * The push notification token for the device.
19
- * @example "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]"
20
- */
21
- push_token: string;
22
-
23
- /**
24
- * The push notification provider.
25
- * @example "expo"
26
- */
27
- push_provider: string;
28
-
29
- /**
30
- * A unique identifier for the device, such as the OS internal build ID.
31
- * @example "19.6.0"
32
- */
33
- device_id: string;
34
-
35
- /**
36
- * A user-friendly name for the device.
37
- * @example "John's iPhone"
38
- */
39
- device_name: string;
40
- }
41
-
42
- /**
43
- * Represents the request payload for Dynamic Client Registration,
44
- * based on OpenID Connect Registration 1.0.
45
- * The `body` of the DIDComm message will contain this object.
46
- * @see https://openid.net/specs/openid-connect-registration-1_0.html#RegistrationRequest
47
- */
48
- export interface DcrRegistrationRequest {
49
- // --- Standard OIDC DCR Fields ---
50
-
51
- /**
52
- * Array of redirection URIs for use in redirect-based flows. For a native app,
53
- * this could be a custom scheme URI.
54
- * @example ["myapp://callback"]
55
- */
56
- redirect_uris: string[];
57
-
58
- /**
59
- * Kind of the application. The only supported value is 'native'.
60
- */
61
- application_type?: 'native';
62
-
63
- /**
64
- * Human-readable name of the client to be presented to the end-user.
65
- * @example "My Awesome App"
66
- */
67
- client_name?: string;
68
-
69
- /**
70
- * URL of the home page of the client.
71
- */
72
- client_uri?: string;
73
-
74
- /**
75
- * Requested authentication method for the token endpoint.
76
- * For apps using public keys, 'private_key_jwt' is common.
77
- * 'none' can be used for public clients.
78
- */
79
- token_endpoint_auth_method?: 'none' | 'private_key_jwt';
80
-
81
- /**
82
- * A list of OAuth 2.0 grant types that the client will restrict itself to using.
83
- */
84
- grant_types?: ('authorization_code' | 'implicit' | 'refresh_token' | 'client_credentials')[];
85
-
86
- /**
87
- * URL for the client's JSON Web Key Set [JWK] document. If the client signs requests to the Server,
88
- * it contains the signing key(s) the Server uses to validate signatures from the Client.
89
- */
90
- jwks_uri?: string;
91
-
92
- /**
93
- * JSON Web Key Set containing the client's public keys.
94
- * REQUIRED if `jwks_uri` is not provided.
95
- */
96
- jwks?: JwkSet;
97
-
98
- // --- Custom Extension Fields ---
99
-
100
- /**
101
- * Custom data about the specific device instance being registered.
102
- * This is prefixed to avoid collision with standard fields.
103
- */
104
- ext_device_info?: OpenIdDeviceInfo;
105
- }
106
-
107
- /**
108
- * Represents the response payload for a successful Dynamic Client Registration,
109
- * based on OpenID Connect Registration 1.0.
110
- * This object will be nested inside the `resource` of the final BundleEntry.
111
- * @see https://openid.net/specs/openid-connect-registration-1_0.html#RegistrationResponse
112
- */
113
- export interface DcrRegistrationResponse {
114
- /**
115
- * Unique client identifier.
116
- */
117
- client_id: string;
118
-
119
- /**
120
- * Time at which the client_id was issued, represented as a Unix timestamp.
121
- */
122
- client_id_issued_at: number;
123
-
124
- /**
125
- * The client secret. For public clients or those using JWTs for client authentication,
126
- * this may not be returned.
127
- */
128
- client_secret?: string;
129
-
130
- /**
131
- * Time at which the client_secret will expire, represented as a Unix timestamp.
132
- * If 0, the secret does not expire.
133
- */
134
- client_secret_expires_at?: number;
135
-
136
- /**
137
- * A registration access token that can be used at the client configuration endpoint
138
- * to perform subsequent operations upon the client registration.
139
- */
140
- registration_access_token?: string;
141
-
142
- /**
143
- * URL of the client's configuration endpoint.
144
- */
145
- registration_client_uri?: string;
146
- }
@@ -1,34 +0,0 @@
1
- // src/models/fhir/operation-outcome.ts
2
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
3
-
4
- import { IssueLevel, IssueTypeCode } from './issue';
5
-
6
- /**
7
- * A single detail associated with an operation, based on a simplified FHIR structure.
8
- * Renamed from 'Issue' to be more neutral for potential success reporting.
9
- */
10
- export interface OperationOutcomeDetails {
11
- /**
12
- * Indicates the severity of the detail.
13
- */
14
- severity: IssueLevel;
15
-
16
- /**
17
- * A code classifying the type of detail.
18
- */
19
- code: IssueTypeCode;
20
-
21
- /**
22
- * Additional diagnostic information, such as a stack trace or detailed error message.
23
- */
24
- diagnostics?: string;
25
- }
26
-
27
- /**
28
- * A structured response detailing the result of an operation, based on a simplified FHIR structure.
29
- */
30
- export interface OperationOutcome {
31
- resourceType: 'OperationOutcome';
32
- issue: OperationOutcomeDetails[];
33
- }
34
-
@@ -1,21 +0,0 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/resource-document.ts
3
-
4
- /**
5
- * A flexible record type for claims objects.
6
- */
7
- export type ClaimsRecord = Record<string, any>;
8
-
9
- // A generic type for records stored in the vault.
10
- export interface RecordBase {
11
- id: string;
12
- }
13
-
14
- /**
15
- * Represents the configuration metadata for a vault.
16
- * As defined in the original database abstract layer.
17
- */
18
- export interface VaultConfig extends RecordBase{
19
- custodian?: string; // The tenant responsible for this vault
20
- }
21
-
@@ -1,5 +0,0 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/response.ts
3
-
4
- // Re-exported for backwards compatibility. The canonical definition lives in `confidential-message.ts`.
5
- export type { IDecodedDidcommPayload } from './confidential-message';
@@ -1,76 +0,0 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/urlPath.ts
3
-
4
- /**
5
- * Defines the standardized business sectors supported by the gateway.
6
- * Using an enum ensures type safety and prevents the use of arbitrary strings.
7
- */
8
- export enum Sector {
9
- TEST = 'test', // For mock/demo endpoints and host registry in tests
10
- SYSTEM = 'system', // Reserved for the host's bootstrap operation (TODO: deprecate)
11
- HEALTH_CARE = 'health-care',
12
- HEALTH_INSURANCE = 'health-insurance',
13
- EMERGENCY = 'emergency',
14
- RESEARCH = 'research',
15
- }
16
-
17
- export enum Section {
18
- /** Managing registration of organizations */
19
- registry = 'registry',
20
- /** Managing data of the hosted organization */
21
- entity = 'entity',
22
- /** Managing data of the hosted individual */
23
- individual = 'individual',
24
- /** Managing data in the blockchain network */
25
- network = 'network', // generic 'network' for the path, but customized network name can be used
26
- }
27
-
28
- /** Standards, specifications and formats for data supported in the url path */
29
- export enum Format {
30
- Schema = 'org.schema',
31
- FhirApi = 'org.hl7.fhir.api',
32
- //Pdf' = 'pdf',
33
- }
34
-
35
- /** Types of resources supported in the url path */
36
- export enum Resource {
37
- Person = 'Person',
38
- RelatedPerson = 'RelatedPerson',
39
- Employee = 'Emloyee',
40
- EmployeeRole = 'EmloyeeRole',
41
- Practitioner = 'Practitioner',
42
- PractitionerRole = 'PractitionerRole',
43
- Organization = 'Organization',
44
- Location = 'Location',
45
- Group = 'Group',
46
- }
47
-
48
- export enum JobAction {
49
- "_batch" = "_batch",
50
- "_create" = "_create",
51
- "_discovery" = "_discovery"
52
- }
53
-
54
- export enum knownDomainsReversedEnum {
55
- 'org.schema' = 'org.schema',
56
- 'org.hl7.fhir.api' = 'org.hl7.fhir.api',
57
- 'org.hl7.fhir.r4' = 'org.hl7.fhir.r4',
58
- 'org.ilo.isco' = 'org.ilo.isco',
59
- 'net.openid' = 'net.openid',
60
- // Add other known standards here
61
- };
62
-
63
- /**
64
- * A list of known, fully-qualified context prefixes in reverse DNS format.
65
- * This is used by the claim normalization utility to identify claims that
66
- * are already interoperable and should not be modified.
67
- * All entries should be in lowercase.
68
- */
69
- export const knownDomainsReversed: string[] = [
70
- knownDomainsReversedEnum["org.schema"],
71
- knownDomainsReversedEnum["org.hl7.fhir.api"],
72
- knownDomainsReversedEnum["org.hl7.fhir.r4"],
73
- knownDomainsReversedEnum["org.ilo.isco"],
74
- knownDomainsReversedEnum["net.openid"]
75
- // Add other known standards here
76
- ];
@@ -1,52 +0,0 @@
1
- // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
- // File: crypto-ts/models/verifiable-credential.ts
3
-
4
- import { EvidenceObjectDLT } from "./oidc4ida.evidence.model"
5
-
6
- /**
7
- * Defines the JSON-LD context URI for W3C Verifiable Credentials Data Model v2.0.
8
- * This constant MUST be used for all V2 credential creations to ensure consistency.
9
- * @see https://www.w3.org/TR/vc-data-model-2.0/#contexts
10
- */
11
- export const VC_CONTEXT_V2 = 'https://www.w3.org/ns/credentials/v2';
12
-
13
- /** ProofEBSIv2 foresees the possibility to use different types of proofs for Verifiable Credentials,
14
- * such as proofs derived from eIDAS keys (qualified) to DID keys (unqualified).
15
- * In EBSI 2.0, every V-ID will only contain a single proof, which must be derived from eIDAS keys.
16
- * Definition: https://www.w3.org/TR/vc-data-model/#proofs-signatures
17
- * See https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Attestation
18
- * - 'created' is REQURED, it is the ISO 8601 original timestamp of the signature, it is not the same as credential.issued (tx timestamp) (in Aries go framework use *util.TimeWithTrailingZeroMsec instead of time.Time)
19
- * - 'jws' is REQUIRED, it defines the detached JWS signature string "<base64url(protectedheader)>..<base64url(signature)>"
20
- * - 'proofPurpose' is REQUIRED, e.g.: assertionMethod, authentication, keyAgreement, contractAgreement, capabilityInvocation, capabilityDelegation
21
- * - 'type' is REQUIRED, e.g.: "JsonWebSignature2020", "BbsBlsSignature2020", "BbsBlsSignatureProof2020".
22
- * - 'verificationMethod' is REQUIRED, it is the 'urndid#keyId' to verify the signature by using the issuer's public signature key.
23
- */
24
- export interface ProofEBSIv2 {
25
- created?: string // ISO 8601 original timestamp of the signature, it is not the same as credential.issued (tx timestamp) (in Aries go framework use *util.TimeWithTrailingZeroMsec instead of time.Time)
26
- jws?: string // The detached JWS signature string "<base64url(protectedheader)>..<base64url(signature)>"
27
- proofPurpose?: string // assertionMethod, authentication, keyAgreement, contractAgreement, capabilityInvocation, capabilityDelegation
28
- type: string // "JsonWebSignature2020", "BbsBlsSignature2020", "BbsBlsSignatureProof2020"
29
- verificationMethod?: string // The DID URL of the public key, e.g., "did:web:host.example.com#keyIdThumbprintBase64urlEncoded"
30
- }
31
-
32
- /**
33
- * Defines the structure for a W3C Verifiable Credential.
34
- * The credentialSubject can be any object containing the claims.
35
- * @see https://www.w3.org/TR/vc-data-model-2.0/#verifiable-credentials
36
- */
37
- export interface VerifiableCredentialV2 {
38
- '@context': string[];
39
- id?: string; // A unique identifier for the credential, e.g. hash result of the credential version (unique URN).
40
- type: string[];
41
- /** Claims about the subject, such as the "identifier" or subject's URN */
42
- credentialSubject: Record<string, any>;
43
- /** Evidence for Identity Assurance: https://openid.net/specs/openid-ida-verified-claims-1_0-final.html#section-5.4.4 */
44
- evidence?: EvidenceObjectDLT[];
45
- /** The issuer is the creator (e.g., "did:web:gateway.example.com"), but could be distinct to the signer of a proof */
46
- issuer: string; // The DID of the issuer
47
- /** Proof is optional during creation, but required for a signed VC */
48
- proof?: ProofEBSIv2 | ProofEBSIv2[];
49
- validFrom: string; // ISO 8601 timestamp, e.g.: 2025-09-29T11:31:00Z
50
- validUntil?: string; // ISO 8601 timestamp, e.g.: 2026-09-29T11:30:59Z
51
- }
52
-
@@ -1,4 +0,0 @@
1
- declare module '@noble/hashes/hmac.js';
2
- declare module '@noble/hashes/sha3.js';
3
- declare module '@noble/hashes/sha2.js';
4
- declare module '@noble/hashes/utils.js';
@@ -1,56 +0,0 @@
1
- // src/utils/actor.ts
2
-
3
- export type ParsedActor = {
4
- /**
5
- * The token subject / authenticated actor identifier (as provided in the token request).
6
- * Examples:
7
- * - did:web:api.acme.org:employee:doctor1@acme.org:ISCO-08|2211
8
- * - did:web:api.acme.org:employee:doctor1@acme.org:ISCO-08|2211:<device-uuid>
9
- * - did:web:api.acme.org:family:<id>:v3-RoleCode|ONESELF
10
- * - did:web:api.acme.org:family:<id>:v3-RoleCode|CHILD:<device-uuid>
11
- */
12
- sub: string;
13
- /** The actor identifier (employee email, familyId, or raw email). */
14
- identifier?: string;
15
- /** The employee role code if present (e.g. "ISCO-08|2211"). */
16
- role?: string;
17
- /** The base organization did:web if `sub` is did:web (e.g. "did:web:api.acme.org"). */
18
- organization?: string;
19
- };
20
-
21
- export function parseActorFromSub(sub: string): ParsedActor {
22
- const trimmed = (sub || '').trim();
23
- const parsed: ParsedActor = { sub: trimmed };
24
- if (!trimmed) return parsed;
25
-
26
- if (trimmed.startsWith('did:web:')) {
27
- // Base org DID is always the first component after did:web:
28
- // did:web:<host>[:...]
29
- const after = trimmed.replace(/^did:web:/, '');
30
- const host = after.split(':')[0];
31
- if (host) parsed.organization = `did:web:${host}`;
32
-
33
- // Extract email and role from endpoint-style DID shapes:
34
- // did:web:<host>:(employee|family):<id>:<roleSystem>|<roleCode>[:<uuid>]
35
- const parts = after.split(':');
36
- const employeeIdx = parts.indexOf('employee');
37
- const familyIdx = parts.indexOf('family');
38
- const idIdx = employeeIdx >= 0 ? employeeIdx + 1 : familyIdx >= 0 ? familyIdx + 1 : -1;
39
- const identifier = idIdx >= 0 ? parts[idIdx] : undefined;
40
- if (identifier) {
41
- parsed.identifier = identifier.includes('@') ? identifier.toLowerCase() : identifier;
42
- }
43
-
44
- if (idIdx >= 0 && parts.length > idIdx + 1) {
45
- const roleCandidate = parts[idIdx + 1];
46
- if (roleCandidate && roleCandidate.includes('|')) parsed.role = roleCandidate;
47
- }
48
- return parsed;
49
- }
50
-
51
- // Raw email actor identifier
52
- if (trimmed.includes('@') && !/\s/.test(trimmed)) {
53
- parsed.identifier = trimmed.toLowerCase();
54
- }
55
- return parsed;
56
- }
@@ -1,203 +0,0 @@
1
- /**
2
- * From https://raw.githubusercontent.com/digitalbazaar/base58-universal/master/baseN.js
3
- * Base-N/Base-X encoding/decoding functions.
4
- *
5
- * Original implementation from base-x:
6
- * https://github.com/cryptocoinjs/base-x
7
- *
8
- * Which is MIT licensed:
9
- *
10
- * The MIT License (MIT)
11
- *
12
- * Copyright base-x contributors (c) 2016
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- * copies of the Software, and to permit persons to whom the Software is
19
- * furnished to do so, subject to the following conditions:
20
- *
21
- * The above copyright notice and this permission notice shall be included in
22
- * all copies or substantial portions of the Software.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30
- * DEALINGS IN THE SOFTWARE.
31
- */
32
- 'use strict';
33
-
34
- import { bytesToStringUTF8, stringToBytesUTF8 } from './string-convert';
35
-
36
- // baseN alphabet indexes
37
- const _reverseAlphabets: any = [];
38
-
39
- // base58 characters (Bitcoin alphabet)
40
- export const alphabetBase58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
41
-
42
- export class BaseN {
43
- constructor() { }
44
-
45
- /** BaseN-encodes a Uint8Array using the given alphabet */
46
- public static encodeN(input: Uint8Array, alphabet: string, maxline: string | undefined): string {
47
- return encodeN(input, alphabet, maxline);
48
- }
49
-
50
- /** Decodes a baseN-encoded (using the given alphabet) string to a Uint8Array. */
51
- public static decodeN(input: string, alphabet: string): Uint8Array {
52
- return decodeN(input, alphabet);
53
- }
54
-
55
- /** Base58-encodes a Uint8Array using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' */
56
- public static encodeBytesToBase58(inputBytes: Uint8Array): string {
57
- return encodeN(inputBytes, alphabetBase58, undefined);
58
- }
59
-
60
- /** Base58-encodes a Uint8Array using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' */
61
- public static encodeStrToBase58(inputStr: string): string {
62
- const inputBytes: Uint8Array = stringToBytesUTF8(inputStr);
63
- return this.encodeBytesToBase58(inputBytes);
64
- }
65
-
66
- /** Decodes a base58-encoded string to a Uint8Array (using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz') */
67
- public static decodeBytesFromBase58(base58Str: string): Uint8Array {
68
- return decodeN(base58Str, alphabetBase58);
69
- }
70
-
71
- /** Decodes a base58-encoded string to a Uint8Array (using the Bitcoin alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz') */
72
- public static decodeStrFromBase58(base58Str: string): string {
73
- const inputBytes: Uint8Array = this.decodeBytesFromBase58(base58Str);
74
- return bytesToStringUTF8(inputBytes);
75
- }
76
-
77
- // decodeToUtf8String = (utf8StringArg: string): string => decodeToUtf8String(utf8StringArg)
78
-
79
- }
80
-
81
-
82
- /**
83
- * BaseN-encodes a Uint8Array using the given alphabet.
84
- *
85
- * @param {Uint8Array} input the bytes to encode in a Uint8Array.
86
- * @param {number} maxline the maximum number of encoded characters per line to
87
- * use, defaults to none.
88
- *
89
- * @return {string} the baseN-encoded output string.
90
- */
91
- export function encodeN(input: Uint8Array, alphabet: string, maxline: string | undefined): string {
92
- if (!(input instanceof Uint8Array)) {
93
- throw new TypeError('"input" must be a Uint8Array.');
94
- }
95
- if (typeof alphabet !== 'string') {
96
- throw new TypeError('"alphabet" must be a string.');
97
- }
98
- if (maxline !== undefined && typeof maxline !== 'number') {
99
- throw new TypeError('"maxline" must be a number.');
100
- }
101
- if (input.length === 0) {
102
- return '';
103
- }
104
-
105
- let output: string = '';
106
-
107
- let i = 0;
108
- const base = alphabet.length;
109
- const first = alphabet.charAt(0);
110
- const digits = [0];
111
- for (i = 0; i < input.length; ++i) {
112
- let carry = input[i];
113
- for (let j = 0; j < digits.length; ++j) {
114
- carry += digits[j] << 8;
115
- digits[j] = carry % base;
116
- carry = (carry / base) | 0;
117
- }
118
-
119
- while (carry > 0) {
120
- digits.push(carry % base);
121
- carry = (carry / base) | 0;
122
- }
123
- }
124
-
125
- // deal with leading zeros
126
- for (i = 0; input[i] === 0 && i < input.length - 1; ++i) {
127
- output += first;
128
- }
129
- // convert digits to a string
130
- for (i = digits.length - 1; i >= 0; --i) {
131
- output += alphabet[digits[i]];
132
- }
133
-
134
- if (maxline) {
135
- const match = output.match(new RegExp('.{1,' + maxline + '}', 'g'));
136
- if (match) {
137
- output = match.join('\r\n');
138
- }
139
- }
140
-
141
- return output;
142
- }
143
-
144
- /**
145
- * Decodes a baseN-encoded (using the given alphabet) string to a
146
- * Uint8Array.
147
- *
148
- * @param {string} input the baseN-encoded input string.
149
- *
150
- * @return {Uint8Array} the decoded bytes in a Uint8Array.
151
- */
152
- export function decodeN(input: string, alphabet: string): Uint8Array {
153
- if (typeof input !== 'string') {
154
- throw new TypeError('"input" must be a string.');
155
- }
156
- if (typeof alphabet !== 'string') {
157
- throw new TypeError('"alphabet" must be a string.');
158
- }
159
- if (input.length === 0) {
160
- return new Uint8Array(0);
161
- }
162
-
163
- let table = _reverseAlphabets[alphabet];
164
- if (!table) {
165
- // compute reverse alphabet
166
- table = _reverseAlphabets[alphabet] = [];
167
- for (let i = 0; i < alphabet.length; ++i) {
168
- table[alphabet.charCodeAt(i)] = i;
169
- }
170
- }
171
-
172
- // remove whitespace characters
173
- input = input.replace(/\s/g, '');
174
-
175
- const base = alphabet.length;
176
- const first = alphabet.charAt(0);
177
- const bytes = [0];
178
- for (let i = 0; i < input.length; i++) {
179
- const value = table[input.charCodeAt(i)];
180
- if (value === undefined) {
181
- return new Uint8Array(0); // empty
182
- }
183
-
184
- let carry = value;
185
- for (let j = 0; j < bytes.length; ++j) {
186
- carry += bytes[j] * base;
187
- bytes[j] = carry & 0xff;
188
- carry >>= 8;
189
- }
190
-
191
- while (carry > 0) {
192
- bytes.push(carry & 0xff);
193
- carry >>= 8;
194
- }
195
- }
196
-
197
- // deal with leading zeros
198
- for (let k = 0; input[k] === first && k < input.length - 1; ++k) {
199
- bytes.push(0);
200
- }
201
-
202
- return new Uint8Array(bytes.reverse());
203
- }