antifraud-data-utils-ts 0.1.10 → 0.2.0

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 (56) hide show
  1. package/CHANGELOG.md +187 -134
  2. package/LICENSE +13 -13
  3. package/README.md +257 -243
  4. package/dist/cryptography/index.d.ts +1 -0
  5. package/dist/cryptography/index.d.ts.map +1 -1
  6. package/dist/cryptography/index.js +1 -0
  7. package/dist/cryptography/index.js.map +1 -1
  8. package/dist/cryptography/numeric-qr.d.ts +4 -0
  9. package/dist/cryptography/numeric-qr.d.ts.map +1 -0
  10. package/dist/cryptography/numeric-qr.js +22 -0
  11. package/dist/cryptography/numeric-qr.js.map +1 -0
  12. package/dist/cryptography/post-quantum-detached-qr.d.ts +14 -0
  13. package/dist/cryptography/post-quantum-detached-qr.d.ts.map +1 -0
  14. package/dist/cryptography/post-quantum-detached-qr.js +76 -0
  15. package/dist/cryptography/post-quantum-detached-qr.js.map +1 -0
  16. package/dist/encoding/base58btc.d.ts +3 -0
  17. package/dist/encoding/base58btc.d.ts.map +1 -0
  18. package/dist/encoding/base58btc.js +19 -0
  19. package/dist/encoding/base58btc.js.map +1 -0
  20. package/dist/identity-assurance/antifraud-data-card.d.ts +42 -0
  21. package/dist/identity-assurance/antifraud-data-card.d.ts.map +1 -0
  22. package/dist/identity-assurance/antifraud-data-card.js +120 -0
  23. package/dist/identity-assurance/antifraud-data-card.js.map +1 -0
  24. package/dist/identity-assurance/didcomm-binary-attachment.d.ts.map +1 -1
  25. package/dist/identity-assurance/didcomm-binary-attachment.js +1 -18
  26. package/dist/identity-assurance/didcomm-binary-attachment.js.map +1 -1
  27. package/dist/identity-assurance/identity-evidence.d.ts.map +1 -1
  28. package/dist/identity-assurance/identity-evidence.js +1 -16
  29. package/dist/identity-assurance/identity-evidence.js.map +1 -1
  30. package/dist/identity-assurance/index.d.ts +1 -0
  31. package/dist/identity-assurance/index.d.ts.map +1 -1
  32. package/dist/identity-assurance/index.js +1 -0
  33. package/dist/identity-assurance/index.js.map +1 -1
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +3 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/organization-credentials.d.ts +75 -0
  39. package/dist/organization-credentials.d.ts.map +1 -0
  40. package/dist/organization-credentials.js +162 -0
  41. package/dist/organization-credentials.js.map +1 -0
  42. package/dist/organization-identity.d.ts +21 -0
  43. package/dist/organization-identity.d.ts.map +1 -0
  44. package/dist/organization-identity.js +47 -0
  45. package/dist/organization-identity.js.map +1 -0
  46. package/dist/service-conversation.d.ts +40 -0
  47. package/dist/service-conversation.d.ts.map +1 -0
  48. package/dist/service-conversation.js +58 -0
  49. package/dist/service-conversation.js.map +1 -0
  50. package/docs/ANTIFRAUD_DATA_CARD_V1.md +47 -0
  51. package/docs/DC4EU_EDUCATION_AND_MEDICAL_CREDENTIALS.md +93 -0
  52. package/docs/DIDCOMM_SCHEMA_ORG_ATTACHMENTS.md +73 -0
  53. package/docs/EDUCATION_ADMINISTRATIVE_ASSISTANT_IDENTITY_EVIDENCE.md +90 -0
  54. package/docs/IDENTITY_VERIFICATION_AND_ATTESTATION.md +354 -0
  55. package/docs/ORGANIZATION_CONTACT_IDENTITY.md +113 -0
  56. package/package.json +69 -55
package/README.md CHANGED
@@ -1,243 +1,257 @@
1
- # Antifraud Data Utilities
2
-
3
- Product-neutral TypeScript contracts for identity verification, evidence,
4
- attestations and public organization-service discovery.
5
-
6
- The central trust rule is provenance without authority substitution: every
7
- identity or qualification claim keeps who asserted it, under which authority
8
- and jurisdiction, from which evidence, at what time, with which proof and
9
- current status. Employer, university, licensing authority, verifier and subject
10
- are separate actors even when they support the same claim.
11
-
12
- The package keeps three concerns separate:
13
-
14
- 1. Canonical business data uses governed Schema.org flat claims.
15
- 2. OpenID Identity Assurance `verified_claims` is an exchange projection.
16
- 3. An attestation records that an authorized actor assessed a subject, claim
17
- or relationship; it never silently rewrites the assessed source data.
18
-
19
- The separate `organization-service-catalog` subpath defines a Schema.org-first
20
- public graph for the legal Organization, department Organizations, Places and
21
- client Services. Publication is explicit at every level. A public Service must
22
- reference at least one public Place in its own department; private and unknown
23
- relationships fail closed. Its DCAT descriptor supports bounded marketplace
24
- cache refresh, withdrawal and rollback detection without becoming proof that
25
- the publisher is trusted.
26
-
27
- Schedules, Slots, Appointments, subjects and research studies do not belong in
28
- that dataset. The builder emits no FHIR resources. A later sector adapter may
29
- translate the canonical Schema.org graph when required.
30
-
31
- It also exports the reviewed, stateless shared cryptography engine through
32
- `antifraud-data-utils-ts/cryptography`. The engine preserves the existing
33
- `gdc-common-utils-ts` confidential envelope: a fresh AES-256-GCM content key is
34
- wrapped for the recipient with ML-KEM-768, HKDF-SHA-256 and AES-256-GCM key
35
- wrap. ML-DSA-65 signs or verifies exact bytes. The engine never stores a private
36
- key, unlock secret or plaintext key; managed wallets and KMS adapters retain
37
- custody and authorization.
38
-
39
- ```ts
40
- import {
41
- CryptographyService,
42
- type ICryptoHelper,
43
- } from 'antifraud-data-utils-ts/cryptography'
44
-
45
- const cryptography = new CryptographyService(runtimeCryptoHelper)
46
- ```
47
-
48
- `defineManagedSignatureRequest` creates only a pending request. It binds the
49
- immutable manifest digest to the trusted authenticated user, registered device,
50
- operation, signer, relying party, purpose and ML-DSA-65 actor-signing key.
51
- Login, review, delivery, read state and a successful local user-presence
52
- ceremony are deliberately not represented as signatures. SDK orchestration
53
- owns authorization, one-use session consumption and proof creation.
54
-
55
- `buildSocialPublicationManifestDigest` and
56
- `defineSocialPublicationDemoRecord` close the bounded synthetic publication
57
- flow. The latter accepts only public content matching the immutable SHA3-384
58
- manifest, an already verified ML-DSA-65 managed-wallet proof, and an explicit
59
- in-memory Fabric Demo receipt. It never represents the simulated ledger as a
60
- real Fabric transaction or turns login and review into signatures.
61
-
62
- ## Current API
63
-
64
- ```ts
65
- import {
66
- buildPublicOrganizationServiceCatalog,
67
- evaluateOrganizationCatalogCache,
68
- } from 'antifraud-data-utils-ts/organization-service-catalog'
69
- ```
70
-
71
- ```ts
72
- import {
73
- ClearingHouseTenantCapability,
74
- ClaimProofFormat,
75
- EudiPidClaim,
76
- IdentityAttestationCapability,
77
- IdentityEvidenceType,
78
- QualificationAuthorityKind,
79
- QualificationVerificationStatus,
80
- SchemaOrgIdentityClaim,
81
- SchemaOrgContentIdentifierProfile,
82
- SchemaOrgDocumentResourceType,
83
- SchemaOrgQualificationClaim,
84
- buildDidCommInlineBinaryAttachment,
85
- buildDidCommLinkedBinaryAttachment,
86
- buildSchemaOrgConfidentialDocumentGraph,
87
- buildQualificationLedgerAnchor,
88
- defineProfessionalQualification,
89
- defineAuthorizedWorkforceIdentityEvidenceStatement,
90
- defineClaimProofBinding,
91
- importOidc4IdaToSchemaOrgFlatClaims,
92
- projectSchemaOrgFlatClaimsToOidc4Ida,
93
- selectAuthoritativeTenantEndpoint,
94
- toSchemaOrgQualificationFlatClaims,
95
- verifiedClaimsJsonSchema,
96
- workforceIdentityEvidenceStatementJsonSchema,
97
- } from 'antifraud-data-utils-ts/identity-assurance'
98
- ```
99
-
100
- `ClaimProofBinding` connects one canonical claim or derived predicate to one or
101
- more credential-level proof references. For example, an `age-over` predicate
102
- can disclose `age_over_18=true` without disclosing the source birth date. An
103
- SD-JWT VC signs disclosure digests at credential level; the package does not
104
- misrepresent that mechanism as an independent signature embedded in every
105
- flat claim.
106
-
107
- The initial governed projection covers the registered OpenID identity claims
108
- that have direct Schema.org equivalents. An unknown mapping fails on export.
109
- Import reports unsupported claims and conflicting existing values instead of
110
- discarding or overwriting them.
111
-
112
- An authorized workforce member may record identity evidence only when trusted
113
- server context supplies the active employee assignment, active membership in a
114
- controller-governed work group, that group's reusable authorization and
115
- `identity.evidence.record`. The employee has no separate Consent. A subject or
116
- lawful representative authorization remains a distinct optional gate when the
117
- use case requires it. The form collects the evidence observation; it does not
118
- select the actor, grant permission or sign a credential. Raw identity documents
119
- are excluded from the statement. Attachments are referenced by digest.
120
- Schema.org `MediaObject` flat claims describe a scanned artifact and bind its
121
- protected URL, media type and size to a CIDv1(raw, SHA3-384) identifier encoded
122
- with multibase base58btc. OpenID Identity Assurance attachment metadata is a
123
- projection of that same artifact; it is not the canonical store.
124
-
125
- `buildSchemaOrgConfidentialDocumentGraph` produces a strict JSON:API 1.1
126
- primary document whose `data[]` contains direct Schema.org
127
- `DigitalDocument` and `MediaObject` resource objects. A manifest relates its
128
- documents through `hasPart`; each document relates its concrete file through
129
- `encoding`. The `MediaObject.identifier` is a `PropertyValue`: `propertyID` is
130
- `cidv1-raw-sha3-384` and `value` is the complete multibase base58btc CID. The
131
- builder verifies that the CID embeds a SHA3-384 digest matching the supplied
132
- digest, requires exact byte size, protected URL and media type, rejects
133
- duplicate resource identifiers and never accepts raw document bytes.
134
-
135
- The document graph and the binary transport are deliberately separate.
136
- Antifraud documents are always Schema.org `DigitalDocument` resources whose
137
- concrete encodings are Schema.org `MediaObject` resources; they are never FHIR
138
- `DocumentReference` resources. `buildDidCommInlineBinaryAttachment` carries a
139
- bounded file as DIDComm `attachments[].data.base64`, while
140
- `buildDidCommLinkedBinaryAttachment` carries the same governed `MediaObject`
141
- through `attachments[].data.links` plus its multibase multihash. Both forms
142
- preserve the Internet media type and exact byte count and work for PDF,
143
- spreadsheet, word-processing, image, video or another governed media type.
144
- DIDComm is the delivery transport and does not replace the Schema.org business
145
- record or become the persistence model. See
146
- [`docs/DIDCOMM_SCHEMA_ORG_ATTACHMENTS.md`](docs/DIDCOMM_SCHEMA_ORG_ATTACHMENTS.md)
147
- and [GitHub issue #2](https://github.com/antifraudservices/antifraud-data-utils-ts/issues/2).
148
-
149
- Historical inputs may have used `identifier.additionalType` to name an
150
- identifier scheme. `normalizeSchemaOrgContentIdentifier` reads that legacy
151
- shape for migration, but canonical output uses `PropertyValue.propertyID`.
152
- Conflicting legacy and canonical values fail closed. Established external
153
- organization, person or animal identifier contracts are not silently renamed
154
- by this attachment-specific compatibility rule.
155
-
156
- A controller or authorized human-resources employee may use the same governed
157
- flow to record evidence about an employee's identity or qualifications. When a
158
- qualification refers to a university or another awarding organization, that
159
- organization must be resolved by its legal identifier and jurisdiction, not by
160
- display name alone. If no credential from the awarding organization exists,
161
- the result is an employer attestation about evidence the employer reviewed; it
162
- must not be represented as a university-issued credential. The employer's
163
- signature is its own proof. A later university credential or confirmation is
164
- added as a separate proof for the same claim instead of replacing the employer
165
- proof.
166
-
167
- This separation is essential in health and other regulated sectors. Evidence
168
- of a qualification is not by itself an active professional licence, an active
169
- employment assignment, or authority to perform an operation. A downstream
170
- policy evaluates each applicable status independently and fails closed on
171
- suspension, revocation, expiry, or an authority mismatch.
172
-
173
- An invitation may propose an optional department and zero or more groups. The
174
- proposal grants nothing before employee activation. Invitation acceptance and
175
- later department or group changes require a Communication notice, while the
176
- shared group authorization remains unchanged for the other active members.
177
-
178
- The home tenant is the initial trust root. An employer or index-provider tenant
179
- publishes its own authoritative endpoint. A different source tenant is usable
180
- only after the home tenant explicitly trusts it and the source advertises the
181
- required capability. The source tenant reads its stored record before issuing
182
- an attestation; caller-authored claims are never signed as authoritative data.
183
-
184
- Professional qualifications use product-neutral Schema.org
185
- `EducationalOccupationalCredential` flat claims. Employer, awarding body and
186
- professional-body proofs remain independent. The package does not expose a
187
- health-specific model or a native FHIR projection. Health applications may
188
- project this neutral contract to their FHIR version in their own data-utility
189
- layer. `buildQualificationLedgerAnchor` deliberately excludes personal claims,
190
- qualification values, legal identifiers, credentials, documents and
191
- signatures; a shared ledger receives only opaque links, a content hash and
192
- lifecycle metadata.
193
-
194
- EUDI Person Identification Data and OpenID Identity Assurance are related but
195
- different contracts. For example, EUDI PID defines `birth_date` and
196
- `age_over_18`, while the OpenID `verified_claims.claims` projection uses the
197
- registered `birthdate` claim. OpenID4VP presents credentials and OpenID4VCI
198
- issues them; OpenID Identity Assurance describes verified claims and evidence.
199
-
200
- ## Repository boundary
201
-
202
- This package contains pure types, vocabulary, JSON Schemas, converters,
203
- validators, synthetic fixtures and stateless cryptographic primitives. It
204
- contains no user interface, role policy, HTTP client, persistence adapter,
205
- private-key custody, credential issuer, ledger connection or deployment
206
- configuration.
207
-
208
- See [Identity verification and attestation contract](docs/IDENTITY_VERIFICATION_AND_ATTESTATION.md)
209
- for the normative model and downstream acceptance requirements.
210
-
211
- See [DC4EU education and medical credential reference](docs/DC4EU_EDUCATION_AND_MEDICAL_CREDENTIALS.md)
212
- for the upstream European Higher Education Diploma, Doctor ID, professional
213
- suitability and medical-training credential boundaries and their current draft
214
- status.
215
-
216
- See [Education administrative assistant identity-evidence journey](docs/EDUCATION_ADMINISTRATIVE_ASSISTANT_IDENTITY_EVIDENCE.md)
217
- for the controller-governed employee flow, age predicates and the local
218
- user-interface acceptance boundary.
219
-
220
- ## Standards
221
-
222
- - [OpenID Identity Assurance Schema Definition 1.0](https://openid.net/specs/openid-ida-verified-claims-1_0-final.html)
223
- - [OpenID Connect for Identity Assurance 1.0](https://openid.net/specs/openid-connect-4-identity-assurance-1_0-final.html)
224
- - [Schema.org Person](https://schema.org/Person)
225
- - [Schema.org Action](https://schema.org/Action)
226
- - [Schema.org AssessAction](https://schema.org/AssessAction)
227
- - [Schema.org EducationalOccupationalCredential](https://schema.org/EducationalOccupationalCredential)
228
- - [DC4EU EUDI Wallet large-scale pilot](https://ec.europa.eu/digital-building-blocks/sites/spaces/EUDIGITALIDENTITYWALLET/pages/920064520/LSP-DC4EU)
229
-
230
- ## Development
231
-
232
- Node.js 24 is required.
233
-
234
- ```bash
235
- npm ci
236
- npm test
237
- npm run typecheck
238
- npm pack --dry-run
239
- ```
240
-
241
- ## License
242
-
243
- Apache-2.0.
1
+ # Antifraud Data Utilities
2
+
3
+ The executable draft for the non-health
4
+ [Antifraud Data Card v1](docs/ANTIFRAUD_DATA_CARD_V1.md) defines the `afdc:/`
5
+ JSON:API/Schema.org credential transport and its separate `pqc:/` detached
6
+ ML-DSA companion proof.
7
+
8
+ Product-neutral TypeScript contracts for identity verification, evidence,
9
+ attestations and public organization-service discovery.
10
+
11
+ The [organization contact identity guide](docs/ORGANIZATION_CONTACT_IDENTITY.md)
12
+ documents the `organization-identity` entry point. It accepts an explicit email
13
+ or E.164 phone channel and preserves the established actor multihash and
14
+ organization employee DID representation. These pure builders never verify a
15
+ contact, assign a role or replace an organization licence or device grant.
16
+ The related `organization-credentials` entry point builds compatible reviewed
17
+ admission/domain drafts with email or telephone parties and explicitly supplied
18
+ occupation/authority claims; signing and verification remain outside it.
19
+
20
+ The central trust rule is provenance without authority substitution: every
21
+ identity or qualification claim keeps who asserted it, under which authority
22
+ and jurisdiction, from which evidence, at what time, with which proof and
23
+ current status. Employer, university, licensing authority, verifier and subject
24
+ are separate actors even when they support the same claim.
25
+
26
+ The package keeps three concerns separate:
27
+
28
+ 1. Canonical business data uses governed Schema.org flat claims.
29
+ 2. OpenID Identity Assurance `verified_claims` is an exchange projection.
30
+ 3. An attestation records that an authorized actor assessed a subject, claim
31
+ or relationship; it never silently rewrites the assessed source data.
32
+
33
+ The separate `organization-service-catalog` subpath defines a Schema.org-first
34
+ public graph for the legal Organization, department Organizations, Places and
35
+ client Services. Publication is explicit at every level. A public Service must
36
+ reference at least one public Place in its own department; private and unknown
37
+ relationships fail closed. Its DCAT descriptor supports bounded marketplace
38
+ cache refresh, withdrawal and rollback detection without becoming proof that
39
+ the publisher is trusted.
40
+
41
+ Schedules, Slots, Appointments, subjects and research studies do not belong in
42
+ that dataset. The builder emits no FHIR resources. A later sector adapter may
43
+ translate the canonical Schema.org graph when required.
44
+
45
+ It also exports the reviewed, stateless shared cryptography engine through
46
+ `antifraud-data-utils-ts/cryptography`. The engine preserves the existing
47
+ `gdc-common-utils-ts` confidential envelope: a fresh AES-256-GCM content key is
48
+ wrapped for the recipient with ML-KEM-768, HKDF-SHA-256 and AES-256-GCM key
49
+ wrap. ML-DSA-65 signs or verifies exact bytes. The engine never stores a private
50
+ key, unlock secret or plaintext key; managed wallets and KMS adapters retain
51
+ custody and authorization.
52
+
53
+ ```ts
54
+ import {
55
+ CryptographyService,
56
+ type ICryptoHelper,
57
+ } from 'antifraud-data-utils-ts/cryptography'
58
+
59
+ const cryptography = new CryptographyService(runtimeCryptoHelper)
60
+ ```
61
+
62
+ `defineManagedSignatureRequest` creates only a pending request. It binds the
63
+ immutable manifest digest to the trusted authenticated user, registered device,
64
+ operation, signer, relying party, purpose and ML-DSA-65 actor-signing key.
65
+ Login, review, delivery, read state and a successful local user-presence
66
+ ceremony are deliberately not represented as signatures. SDK orchestration
67
+ owns authorization, one-use session consumption and proof creation.
68
+
69
+ `buildSocialPublicationManifestDigest` and
70
+ `defineSocialPublicationDemoRecord` close the bounded synthetic publication
71
+ flow. The latter accepts only public content matching the immutable SHA3-384
72
+ manifest, an already verified ML-DSA-65 managed-wallet proof, and an explicit
73
+ in-memory Fabric Demo receipt. It never represents the simulated ledger as a
74
+ real Fabric transaction or turns login and review into signatures.
75
+
76
+ ## Current API
77
+
78
+ ```ts
79
+ import {
80
+ buildPublicOrganizationServiceCatalog,
81
+ evaluateOrganizationCatalogCache,
82
+ } from 'antifraud-data-utils-ts/organization-service-catalog'
83
+ ```
84
+
85
+ ```ts
86
+ import {
87
+ ClearingHouseTenantCapability,
88
+ ClaimProofFormat,
89
+ EudiPidClaim,
90
+ IdentityAttestationCapability,
91
+ IdentityEvidenceType,
92
+ QualificationAuthorityKind,
93
+ QualificationVerificationStatus,
94
+ SchemaOrgIdentityClaim,
95
+ SchemaOrgContentIdentifierProfile,
96
+ SchemaOrgDocumentResourceType,
97
+ SchemaOrgQualificationClaim,
98
+ buildDidCommInlineBinaryAttachment,
99
+ buildDidCommLinkedBinaryAttachment,
100
+ buildSchemaOrgConfidentialDocumentGraph,
101
+ buildQualificationLedgerAnchor,
102
+ defineProfessionalQualification,
103
+ defineAuthorizedWorkforceIdentityEvidenceStatement,
104
+ defineClaimProofBinding,
105
+ importOidc4IdaToSchemaOrgFlatClaims,
106
+ projectSchemaOrgFlatClaimsToOidc4Ida,
107
+ selectAuthoritativeTenantEndpoint,
108
+ toSchemaOrgQualificationFlatClaims,
109
+ verifiedClaimsJsonSchema,
110
+ workforceIdentityEvidenceStatementJsonSchema,
111
+ } from 'antifraud-data-utils-ts/identity-assurance'
112
+ ```
113
+
114
+ `ClaimProofBinding` connects one canonical claim or derived predicate to one or
115
+ more credential-level proof references. For example, an `age-over` predicate
116
+ can disclose `age_over_18=true` without disclosing the source birth date. An
117
+ SD-JWT VC signs disclosure digests at credential level; the package does not
118
+ misrepresent that mechanism as an independent signature embedded in every
119
+ flat claim.
120
+
121
+ The initial governed projection covers the registered OpenID identity claims
122
+ that have direct Schema.org equivalents. An unknown mapping fails on export.
123
+ Import reports unsupported claims and conflicting existing values instead of
124
+ discarding or overwriting them.
125
+
126
+ An authorized workforce member may record identity evidence only when trusted
127
+ server context supplies the active employee assignment, active membership in a
128
+ controller-governed work group, that group's reusable authorization and
129
+ `identity.evidence.record`. The employee has no separate Consent. A subject or
130
+ lawful representative authorization remains a distinct optional gate when the
131
+ use case requires it. The form collects the evidence observation; it does not
132
+ select the actor, grant permission or sign a credential. Raw identity documents
133
+ are excluded from the statement. Attachments are referenced by digest.
134
+ Schema.org `MediaObject` flat claims describe a scanned artifact and bind its
135
+ protected URL, media type and size to a CIDv1(raw, SHA3-384) identifier encoded
136
+ with multibase base58btc. OpenID Identity Assurance attachment metadata is a
137
+ projection of that same artifact; it is not the canonical store.
138
+
139
+ `buildSchemaOrgConfidentialDocumentGraph` produces a strict JSON:API 1.1
140
+ primary document whose `data[]` contains direct Schema.org
141
+ `DigitalDocument` and `MediaObject` resource objects. A manifest relates its
142
+ documents through `hasPart`; each document relates its concrete file through
143
+ `encoding`. The `MediaObject.identifier` is a `PropertyValue`: `propertyID` is
144
+ `cidv1-raw-sha3-384` and `value` is the complete multibase base58btc CID. The
145
+ builder verifies that the CID embeds a SHA3-384 digest matching the supplied
146
+ digest, requires exact byte size, protected URL and media type, rejects
147
+ duplicate resource identifiers and never accepts raw document bytes.
148
+
149
+ The document graph and the binary transport are deliberately separate.
150
+ Antifraud documents are always Schema.org `DigitalDocument` resources whose
151
+ concrete encodings are Schema.org `MediaObject` resources; they are never FHIR
152
+ `DocumentReference` resources. `buildDidCommInlineBinaryAttachment` carries a
153
+ bounded file as DIDComm `attachments[].data.base64`, while
154
+ `buildDidCommLinkedBinaryAttachment` carries the same governed `MediaObject`
155
+ through `attachments[].data.links` plus its multibase multihash. Both forms
156
+ preserve the Internet media type and exact byte count and work for PDF,
157
+ spreadsheet, word-processing, image, video or another governed media type.
158
+ DIDComm is the delivery transport and does not replace the Schema.org business
159
+ record or become the persistence model. See
160
+ [`docs/DIDCOMM_SCHEMA_ORG_ATTACHMENTS.md`](docs/DIDCOMM_SCHEMA_ORG_ATTACHMENTS.md)
161
+ and [GitHub issue #2](https://github.com/antifraudservices/antifraud-data-utils-ts/issues/2).
162
+
163
+ Historical inputs may have used `identifier.additionalType` to name an
164
+ identifier scheme. `normalizeSchemaOrgContentIdentifier` reads that legacy
165
+ shape for migration, but canonical output uses `PropertyValue.propertyID`.
166
+ Conflicting legacy and canonical values fail closed. Established external
167
+ organization, person or animal identifier contracts are not silently renamed
168
+ by this attachment-specific compatibility rule.
169
+
170
+ A controller or authorized human-resources employee may use the same governed
171
+ flow to record evidence about an employee's identity or qualifications. When a
172
+ qualification refers to a university or another awarding organization, that
173
+ organization must be resolved by its legal identifier and jurisdiction, not by
174
+ display name alone. If no credential from the awarding organization exists,
175
+ the result is an employer attestation about evidence the employer reviewed; it
176
+ must not be represented as a university-issued credential. The employer's
177
+ signature is its own proof. A later university credential or confirmation is
178
+ added as a separate proof for the same claim instead of replacing the employer
179
+ proof.
180
+
181
+ This separation is essential in health and other regulated sectors. Evidence
182
+ of a qualification is not by itself an active professional licence, an active
183
+ employment assignment, or authority to perform an operation. A downstream
184
+ policy evaluates each applicable status independently and fails closed on
185
+ suspension, revocation, expiry, or an authority mismatch.
186
+
187
+ An invitation may propose an optional department and zero or more groups. The
188
+ proposal grants nothing before employee activation. Invitation acceptance and
189
+ later department or group changes require a Communication notice, while the
190
+ shared group authorization remains unchanged for the other active members.
191
+
192
+ The home tenant is the initial trust root. An employer or index-provider tenant
193
+ publishes its own authoritative endpoint. A different source tenant is usable
194
+ only after the home tenant explicitly trusts it and the source advertises the
195
+ required capability. The source tenant reads its stored record before issuing
196
+ an attestation; caller-authored claims are never signed as authoritative data.
197
+
198
+ Professional qualifications use product-neutral Schema.org
199
+ `EducationalOccupationalCredential` flat claims. Employer, awarding body and
200
+ professional-body proofs remain independent. The package does not expose a
201
+ health-specific model or a native FHIR projection. Health applications may
202
+ project this neutral contract to their FHIR version in their own data-utility
203
+ layer. `buildQualificationLedgerAnchor` deliberately excludes personal claims,
204
+ qualification values, legal identifiers, credentials, documents and
205
+ signatures; a shared ledger receives only opaque links, a content hash and
206
+ lifecycle metadata.
207
+
208
+ EUDI Person Identification Data and OpenID Identity Assurance are related but
209
+ different contracts. For example, EUDI PID defines `birth_date` and
210
+ `age_over_18`, while the OpenID `verified_claims.claims` projection uses the
211
+ registered `birthdate` claim. OpenID4VP presents credentials and OpenID4VCI
212
+ issues them; OpenID Identity Assurance describes verified claims and evidence.
213
+
214
+ ## Repository boundary
215
+
216
+ This package contains pure types, vocabulary, JSON Schemas, converters,
217
+ validators, synthetic fixtures and stateless cryptographic primitives. It
218
+ contains no user interface, role policy, HTTP client, persistence adapter,
219
+ private-key custody, credential issuer, ledger connection or deployment
220
+ configuration.
221
+
222
+ See [Identity verification and attestation contract](docs/IDENTITY_VERIFICATION_AND_ATTESTATION.md)
223
+ for the normative model and downstream acceptance requirements.
224
+
225
+ See [DC4EU education and medical credential reference](docs/DC4EU_EDUCATION_AND_MEDICAL_CREDENTIALS.md)
226
+ for the upstream European Higher Education Diploma, Doctor ID, professional
227
+ suitability and medical-training credential boundaries and their current draft
228
+ status.
229
+
230
+ See [Education administrative assistant identity-evidence journey](docs/EDUCATION_ADMINISTRATIVE_ASSISTANT_IDENTITY_EVIDENCE.md)
231
+ for the controller-governed employee flow, age predicates and the local
232
+ user-interface acceptance boundary.
233
+
234
+ ## Standards
235
+
236
+ - [OpenID Identity Assurance Schema Definition 1.0](https://openid.net/specs/openid-ida-verified-claims-1_0-final.html)
237
+ - [OpenID Connect for Identity Assurance 1.0](https://openid.net/specs/openid-connect-4-identity-assurance-1_0-final.html)
238
+ - [Schema.org Person](https://schema.org/Person)
239
+ - [Schema.org Action](https://schema.org/Action)
240
+ - [Schema.org AssessAction](https://schema.org/AssessAction)
241
+ - [Schema.org EducationalOccupationalCredential](https://schema.org/EducationalOccupationalCredential)
242
+ - [DC4EU EUDI Wallet large-scale pilot](https://ec.europa.eu/digital-building-blocks/sites/spaces/EUDIGITALIDENTITYWALLET/pages/920064520/LSP-DC4EU)
243
+
244
+ ## Development
245
+
246
+ Node.js 24 is required.
247
+
248
+ ```bash
249
+ npm ci
250
+ npm test
251
+ npm run typecheck
252
+ npm pack --dry-run
253
+ ```
254
+
255
+ ## License
256
+
257
+ Apache-2.0.
@@ -2,4 +2,5 @@ export * from './aes-manager.js';
2
2
  export * from './content.js';
3
3
  export * from './cryptography-service.js';
4
4
  export * from './types.js';
5
+ export * from './post-quantum-detached-qr.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cryptography/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cryptography/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA;AAC1B,cAAc,+BAA+B,CAAA"}
@@ -2,4 +2,5 @@ export * from './aes-manager.js';
2
2
  export * from './content.js';
3
3
  export * from './cryptography-service.js';
4
4
  export * from './types.js';
5
+ export * from './post-quantum-detached-qr.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cryptography/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cryptography/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA;AAC1B,cAAc,+BAA+B,CAAA"}
@@ -0,0 +1,4 @@
1
+ /** Decimal-pair encoding used by compact JWS QR transports. */
2
+ export declare function encodeNumericQrValue(value: string, errorCode: string): string;
3
+ export declare function decodeNumericQrValue(value: string, errorCode: string): string;
4
+ //# sourceMappingURL=numeric-qr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numeric-qr.d.ts","sourceRoot":"","sources":["../../src/cryptography/numeric-qr.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAM7E;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAS7E"}
@@ -0,0 +1,22 @@
1
+ /** Decimal-pair encoding used by compact JWS QR transports. */
2
+ export function encodeNumericQrValue(value, errorCode) {
3
+ return [...value].map(character => {
4
+ const encoded = character.charCodeAt(0) - 45;
5
+ if (encoded < 0 || encoded > 99)
6
+ throw new TypeError(errorCode);
7
+ return encoded.toString().padStart(2, '0');
8
+ }).join('');
9
+ }
10
+ export function decodeNumericQrValue(value, errorCode) {
11
+ if (!value || value.length % 2 || !/^\d+$/u.test(value))
12
+ throw new TypeError(errorCode);
13
+ let result = '';
14
+ for (let index = 0; index < value.length; index += 2) {
15
+ const pair = Number(value.slice(index, index + 2));
16
+ if (pair > 77)
17
+ throw new TypeError(errorCode);
18
+ result += String.fromCharCode(pair + 45);
19
+ }
20
+ return result;
21
+ }
22
+ //# sourceMappingURL=numeric-qr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numeric-qr.js","sourceRoot":"","sources":["../../src/cryptography/numeric-qr.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,SAAiB;IACnE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAChC,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;QAC5C,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE;YAAE,MAAM,IAAI,SAAS,CAAC,SAAS,CAAC,CAAA;QAC/D,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACb,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,SAAiB;IACnE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,SAAS,CAAC,CAAA;IACvF,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAA;QAClD,IAAI,IAAI,GAAG,EAAE;YAAE,MAAM,IAAI,SAAS,CAAC,SAAS,CAAC,CAAA;QAC7C,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const PostQuantumDetachedProofPrefix: "pqc:/";
2
+ export declare const PostQuantumDetachedProofDefaultQrCount = 2;
3
+ /** Wraps a validated RFC 7797 detached ML-DSA JWS without interpreting its external payload. */
4
+ export declare function encodePostQuantumDetachedProofUri(detachedJws: string): string;
5
+ export declare function decodePostQuantumDetachedProofUri(uri: string): string;
6
+ /**
7
+ * Encodes only the detached proof as decimal QR chunks. The signed JSON:API,
8
+ * VC, SHC or other external payload is deliberately not duplicated.
9
+ */
10
+ export declare function encodePostQuantumDetachedProofQr(detachedJws: string, options?: Readonly<{
11
+ qrCount?: number;
12
+ }>): readonly string[];
13
+ export declare function decodePostQuantumDetachedProofQr(values: readonly string[]): string;
14
+ //# sourceMappingURL=post-quantum-detached-qr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-quantum-detached-qr.d.ts","sourceRoot":"","sources":["../../src/cryptography/post-quantum-detached-qr.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,EAAG,OAAgB,CAAA;AAC9D,eAAO,MAAM,sCAAsC,IAAI,CAAA;AAIvD,gGAAgG;AAChG,wBAAgB,iCAAiC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,QAAQ,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,GAC3C,SAAS,MAAM,EAAE,CAYnB;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAiBlF"}