antifraud-data-utils-ts 0.1.11 → 0.3.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 (104) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +24 -0
  3. package/dist/actor-kinds.d.ts +13 -0
  4. package/dist/actor-kinds.d.ts.map +1 -0
  5. package/dist/actor-kinds.js +15 -0
  6. package/dist/actor-kinds.js.map +1 -0
  7. package/dist/credential-contracts.d.ts +58 -0
  8. package/dist/credential-contracts.d.ts.map +1 -0
  9. package/dist/credential-contracts.js +10 -0
  10. package/dist/credential-contracts.js.map +1 -0
  11. package/dist/credential-decoding.d.ts +11 -0
  12. package/dist/credential-decoding.d.ts.map +1 -0
  13. package/dist/credential-decoding.js +84 -0
  14. package/dist/credential-decoding.js.map +1 -0
  15. package/dist/cryptography/cryptography-contract.d.ts +39 -0
  16. package/dist/cryptography/cryptography-contract.d.ts.map +1 -0
  17. package/dist/cryptography/cryptography-contract.js +2 -0
  18. package/dist/cryptography/cryptography-contract.js.map +1 -0
  19. package/dist/cryptography/cryptography-service.d.ts +2 -1
  20. package/dist/cryptography/cryptography-service.d.ts.map +1 -1
  21. package/dist/cryptography/cryptography-service.js.map +1 -1
  22. package/dist/cryptography/index.d.ts +2 -0
  23. package/dist/cryptography/index.d.ts.map +1 -1
  24. package/dist/cryptography/index.js +2 -0
  25. package/dist/cryptography/index.js.map +1 -1
  26. package/dist/cryptography/jws-types.d.ts +20 -0
  27. package/dist/cryptography/jws-types.d.ts.map +1 -0
  28. package/dist/cryptography/jws-types.js +2 -0
  29. package/dist/cryptography/jws-types.js.map +1 -0
  30. package/dist/cryptography/types.d.ts +36 -0
  31. package/dist/cryptography/types.d.ts.map +1 -1
  32. package/dist/did-document.d.ts +35 -0
  33. package/dist/did-document.d.ts.map +1 -0
  34. package/dist/did-document.js +2 -0
  35. package/dist/did-document.js.map +1 -0
  36. package/dist/didcomm-contracts.d.ts +32 -0
  37. package/dist/didcomm-contracts.d.ts.map +1 -0
  38. package/dist/didcomm-contracts.js +2 -0
  39. package/dist/didcomm-contracts.js.map +1 -0
  40. package/dist/encoding/base58btc.d.ts +5 -0
  41. package/dist/encoding/base58btc.d.ts.map +1 -0
  42. package/dist/encoding/base58btc.js +43 -0
  43. package/dist/encoding/base58btc.js.map +1 -0
  44. package/dist/encoding.d.ts +28 -0
  45. package/dist/encoding.d.ts.map +1 -0
  46. package/dist/encoding.js +31 -0
  47. package/dist/encoding.js.map +1 -0
  48. package/dist/identity-assurance/didcomm-binary-attachment.d.ts.map +1 -1
  49. package/dist/identity-assurance/didcomm-binary-attachment.js +1 -18
  50. package/dist/identity-assurance/didcomm-binary-attachment.js.map +1 -1
  51. package/dist/identity-assurance/identity-evidence.d.ts.map +1 -1
  52. package/dist/identity-assurance/identity-evidence.js +1 -16
  53. package/dist/identity-assurance/identity-evidence.js.map +1 -1
  54. package/dist/identity-assurance/index.d.ts +1 -0
  55. package/dist/identity-assurance/index.d.ts.map +1 -1
  56. package/dist/identity-assurance/index.js +1 -0
  57. package/dist/identity-assurance/index.js.map +1 -1
  58. package/dist/identity-assurance/review-methods.d.ts +9 -0
  59. package/dist/identity-assurance/review-methods.d.ts.map +1 -0
  60. package/dist/identity-assurance/review-methods.js +8 -0
  61. package/dist/identity-assurance/review-methods.js.map +1 -0
  62. package/dist/identity-assurance/vocabulary.d.ts.map +1 -1
  63. package/dist/identity-assurance/vocabulary.js +8 -7
  64. package/dist/identity-assurance/vocabulary.js.map +1 -1
  65. package/dist/index.d.ts +12 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +12 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/isco-08.d.ts +149 -0
  70. package/dist/isco-08.d.ts.map +1 -0
  71. package/dist/isco-08.js +74 -0
  72. package/dist/isco-08.js.map +1 -0
  73. package/dist/openid-contracts.d.ts +59 -0
  74. package/dist/openid-contracts.d.ts.map +1 -0
  75. package/dist/openid-contracts.js +2 -0
  76. package/dist/openid-contracts.js.map +1 -0
  77. package/dist/organization-credentials.d.ts +75 -0
  78. package/dist/organization-credentials.d.ts.map +1 -0
  79. package/dist/organization-credentials.js +163 -0
  80. package/dist/organization-credentials.js.map +1 -0
  81. package/dist/organization-identity.d.ts +29 -0
  82. package/dist/organization-identity.d.ts.map +1 -0
  83. package/dist/organization-identity.js +83 -0
  84. package/dist/organization-identity.js.map +1 -0
  85. package/dist/organization-service-catalog.d.ts +1 -28
  86. package/dist/organization-service-catalog.d.ts.map +1 -1
  87. package/dist/organization-service-catalog.js +2 -28
  88. package/dist/organization-service-catalog.js.map +1 -1
  89. package/dist/schema-org-claims.d.ts +145 -0
  90. package/dist/schema-org-claims.d.ts.map +1 -0
  91. package/dist/schema-org-claims.js +137 -0
  92. package/dist/schema-org-claims.js.map +1 -0
  93. package/dist/vault-repository.d.ts +29 -0
  94. package/dist/vault-repository.d.ts.map +1 -0
  95. package/dist/vault-repository.js +2 -0
  96. package/dist/vault-repository.js.map +1 -0
  97. package/docs/CREDENTIAL_CONSUMER_PROFILES.md +55 -0
  98. package/docs/DIDCOMM_AND_ACTOR_SYNTAX.md +51 -0
  99. package/docs/DID_AND_JWS_DATA_CONTRACTS.md +20 -0
  100. package/docs/NEUTRAL_IDENTITY_CONTRACTS.md +79 -0
  101. package/docs/NEUTRAL_VAULT_CONTRACTS.md +49 -0
  102. package/docs/ORGANIZATION_CONTACT_IDENTITY.md +114 -0
  103. package/docs/UNVERIFIED_CREDENTIAL_DECODING.md +63 -0
  104. package/package.json +50 -2
@@ -0,0 +1,55 @@
1
+ # Neutral credential and presentation consumer profiles
2
+
3
+ The `credential-contracts` subpath supplies data contracts shared by current
4
+ credential, registration and presentation consumers across sectors. It does not
5
+ issue, decode, authenticate or verify a credential. A populated `issuer`, `proof`
6
+ or presentation field does not establish a signature, trusted issuer, replay
7
+ binding, recipient or authorization decision.
8
+
9
+ `W3cCredentialContexts` contains the existing V1 and V2 context identities.
10
+ `W3cCredentialTypes` contains the base credential and presentation type names.
11
+ `VC_CONTEXT_V2` aliases the V2 context. Existing organization credential builders
12
+ reuse these constants without changing their serialized values.
13
+
14
+ `VerifiableCredentialV2<Subject, Evidence>` preserves the current supported
15
+ consumer profile: an array of context strings, an array of type strings, one
16
+ object subject, a string issuer and required `validFrom`. ID, expiry, proof and
17
+ evidence remain optional. These are application constraints; the type is not a
18
+ claim to cover every W3C credential form. A consumer with a known education or
19
+ other sector subject can supply that object interface directly. Default subject
20
+ and evidence values remain unvalidated `unknown` data that callers must narrow.
21
+
22
+ `CredentialProof` projects the current required proof type and optional created,
23
+ JWS, purpose and verification-method fields, with unknown extension members.
24
+ The Gateway may retain its historical `ProofEBSIv2` spelling as a local type
25
+ alias; this does not claim EBSI compliance or a verified proof. The existing
26
+ `ReviewedOrganizationCredential` remains a separate readonly organization
27
+ projection with required ID and expiry and JSON-shaped proof/evidence. Its
28
+ different constraints are preserved rather than forced into an incompatible
29
+ universal alias.
30
+
31
+ `VpCredentialInput` represents a credential string or an unvalidated decoded
32
+ object. `VpTokenPayload` is the supported decoded JWT presentation profile: a
33
+ required issuer and a `vp` object containing credential inputs, plus supported
34
+ optional token/holder metadata. It is distinct from both an encoded JWT string
35
+ and the complete native W3C presentation data model. `VpTokenHeader` reuses the
36
+ compatible JOSE header field types while keeping key ID optional. A declared
37
+ algorithm string is not cryptographic algorithm validation.
38
+
39
+ ## Existing consumers and validation boundary
40
+
41
+ Current consumers are the Gateway credential manager, tenant/organization
42
+ configuration, host activation/reconciliation and credential data fixtures in
43
+ <https://github.com/soschain/sos-gw-node-ts>. The original compatibility source is
44
+ <https://github.com/Global-DataCare/gdc-common-utils-ts>, specifically the reviewed
45
+ [credential data profile](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/models/verifiable-credential.ts)
46
+ and [JWT-presentation data](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/utils/vp-token.ts).
47
+ Those links identify source evidence, not runtime dependencies. The broader
48
+ standard is the official [W3C Verifiable Credentials Data Model](https://www.w3.org/TR/vc-data-model-2.0/).
49
+
50
+ Public fixtures exercise typed sector subjects and reject missing required
51
+ profile fields, a subject array, missing proof type, unknown typed subject fields
52
+ and assigning decoded presentation data to an encoded token string. This is
53
+ compile-time contract evidence. Existing cryptography and identity tests verify
54
+ their own behavior; complete credential verification, service policy and real
55
+ sector journeys require their separate owning-service tests.
@@ -0,0 +1,51 @@
1
+ # Plaintext DIDComm data and actor identifier syntax
2
+
3
+ `didcomm-contracts` exports the supported `DidCommPayload<Body>` plaintext
4
+ projection and `DidCommAttachment` attachment profile. These are neutral data
5
+ contracts for education and other sectors, independent of a business resource
6
+ type, SDK transport, persistence model, professional role or clinical policy.
7
+
8
+ The envelope retains the current consumer requirement for `id`, protocol `type`
9
+ and an object `body`; optional fields cover sender/recipients, parent/thread
10
+ identifiers, created/expiry times and attachments. A typed object interface can
11
+ serve as the body without adding an index signature. Arrays and primitive types
12
+ are rejected by the supported body profile. These compile-time checks do not
13
+ replace runtime JSON validation. A protocol `type` is not a business resource's
14
+ type or a FHIR `resourceType`.
15
+
16
+ The attachment profile requires `id`, `media_type` and `data`, preserving existing
17
+ consumers. Requiring those metadata members is a consumer constraint, not a
18
+ claim that every DIDComm attachment must have them. It accepts the existing
19
+ immutable inline/linked binary attachment builders directly, including readonly
20
+ link arrays, byte counts and linked hashes. Optional inline JSON uses the owned
21
+ `JsonValue` shape. The projection does not enforce every standard attachment
22
+ combination, content encoding or hash rule. Callers validate their selected
23
+ transport and content profile before processing attachments.
24
+
25
+ `DIDCOMM_PLAINTEXT_JSON_MEDIA_TYPE` identifies plaintext data. It grants no
26
+ confidentiality, authenticity or authorization. Default HTTP Accept negotiation
27
+ is caller policy and is not defined here. Reading or assigning a plaintext
28
+ envelope does not verify a signer, sender, recipient, replay binding or issuer.
29
+
30
+ Original compatibility source:
31
+ <https://github.com/Global-DataCare/gdc-common-utils-ts>, specifically the reviewed
32
+ [communication data](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/models/comm.ts).
33
+ The [DIDComm specification](https://identity.foundation/didcomm-messaging/spec/v2.1/)
34
+ describes a broader protocol. This implementation is the explicitly supported
35
+ consumer projection, not a claim to implement or validate every feature.
36
+
37
+ ## Stable actor syntax
38
+
39
+ `isStableActorIdentifier(value)` returns a boolean for a primitive string whose
40
+ trimmed value has the existing `urn:multibase:z` prefix followed by one or more
41
+ base58btc alphabet characters. Short strings such as `urn:multibase:z1` retain
42
+ their historical syntactic result. The helper does not decode a multihash,
43
+ validate its digest algorithm or length, prove contact possession or establish
44
+ actor identity. Use the actual authenticated identity and proof checks for that.
45
+
46
+ Objects are rejected without reading conversion hooks, including inherited
47
+ `toString` and `Symbol.toPrimitive` getters. This deliberately hardens the old
48
+ coercion behavior while preserving primitive string compatibility. The result
49
+ is boolean rather than a type predicate, so an invalid known string does not
50
+ become an impossible type in its false branch. Original source evidence is the
51
+ reviewed [actor identifier helper](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/utils/actor-identifier.ts).
@@ -0,0 +1,20 @@
1
+ # Neutral identity and signature data contracts
2
+
3
+ `did-document` describes the key-bearing JSON-LD projection used by the engine,
4
+ with DID verification relationships and explicit public-key shapes. It follows
5
+ the [W3C DID Core vocabulary](https://www.w3.org/TR/did-core/), but is not a
6
+ schema validator, resolver, proof verifier or authorization decision.
7
+
8
+ String service endpoints and string or string-array contexts are compatibility
9
+ defaults. Generic service and context parameters let an exchange adapter model
10
+ other structured representations explicitly. Extension fields remain unknown
11
+ until a consuming adapter validates its own profile.
12
+
13
+ The cryptography entry point exports the engine's JWS signing profile based on
14
+ RFC 7515. Decoded headers require explicit algorithm and key selection; encoded
15
+ General JWS signature fields remain strings. This is a supported engine profile,
16
+ not every valid JOSE serialization. Embedded JWK import types do not enforce
17
+ public-only publication: the emitting host must validate or project the key.
18
+
19
+ These contracts contain no sector, controller policy, transport, persistence or
20
+ clinical catalog. SDK runtime layers own resolution and authenticated handling.
@@ -0,0 +1,79 @@
1
+ # Neutral identity and registration contracts
2
+
3
+ Antifraud owns the reusable person, organization, action, place and service flat
4
+ claim vocabularies in `schema-org-claims`. These describe identity and catalog
5
+ data for education, administrative work and other sectors. They contain no
6
+ healthcare role selection, licence entitlement, clinical policy or portal code.
7
+ The flat keys are an application wire profile using Schema.org vocabulary;
8
+ they are not a declaration that Schema.org publishes these reverse-DNS keys.
9
+
10
+ `organization-service-catalog` re-exports the same organization, place and service
11
+ objects. Its existing `Organization.Identifier`, `Place.Identifier` and
12
+ `Service.Identifier` keys still address `identifier.value`. In the expanded
13
+ organization and service vocabularies, `IdentifierReference` addresses the
14
+ containing `identifier`; `IdentifierValue` is an explicit alias for the existing
15
+ value key. Consumers must select the required field explicitly. Changing an
16
+ import must not change stored claims, searches, proofs or signed payloads.
17
+
18
+ `SchemaOrgPersonClaim` retains the identity-assurance mapper's seven existing
19
+ person fields and adds the occupation, identity and organization-membership
20
+ fields already required by shared onboarding and employee consumers.
21
+ `SchemaOrgActionClaim` records the agent, participant, provider and start time of
22
+ an action. A field claiming an actor or credential material never establishes
23
+ that actor's authority. Verified sessions and proofs remain caller concerns.
24
+
25
+ ## Registration and token data
26
+
27
+ The `openid-contracts` subpath exports data types only:
28
+
29
+ | Contract | Existing consumer need | Boundary |
30
+ | --- | --- | --- |
31
+ | `JwtRegisteredClaims` | Registered issuer, subject, audience, time and token identifiers | Optional registered members; no token validation |
32
+ | `ClientAccessTokenClaims` | Authorization managers require a client ID, scope, issuer, subject, single audience and issued/expiry times | A constrained application profile, not every OAuth access token |
33
+ | `OidcClientRegistrationRequest` | Device registration receives redirect URIs, application/software metadata, authentication method, grants and JWK metadata | The metadata subset currently supported by consumers, not every registered OIDC field or authentication method |
34
+ | `OidcClientRegistrationResponse` | Registration returns a client ID and optional issuance/secret/management metadata | Metadata only; issuance time remains optional in this neutral subset |
35
+ | `RegisteredDeviceInfo` | Registration distinguishes stable device identity from optional push delivery metadata | Application extension data, not standard OIDC metadata |
36
+ | `DeviceClientRegistrationRequest` | Existing device admission carries `ext_device_info` | Explicit extension of the neutral metadata subset |
37
+ | `DeviceClientRegistrationResponse` | Existing device admission always returns client issuance time | Constrained application response profile |
38
+
39
+ The existing source consumers are `DeviceRegistrationManager`,
40
+ `IAuthorizationManager`, `SmartAuthorizationManager` and `FhirController` in
41
+ <https://github.com/soschain/sos-gw-node-ts>. The flat claim consumers include
42
+ shared onboarding in <https://github.com/soschain/sos-data-utils-ts> and the
43
+ existing Antifraud public organization catalog. Original compatibility source:
44
+ <https://github.com/Global-DataCare/gdc-common-utils-ts>, specifically the reviewed
45
+ [flat claim catalog](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/constants/schemaorg.ts),
46
+ [device registration data](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/models/openid-device.ts)
47
+ and [access-token application profile](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/models/auth.ts).
48
+ These links identify source evidence and add no runtime dependency.
49
+
50
+ Standards references are [OpenID Connect Dynamic Client Registration](https://openid.net/specs/openid-connect-registration-1_0.html),
51
+ [OAuth client metadata](https://www.rfc-editor.org/rfc/rfc7591.html#section-2)
52
+ and [JWT registered claims](https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1).
53
+ TypeScript does not enforce these protocols at runtime. JSON decoding, assigning
54
+ a type, accepting JWK import data or receiving device metadata does not verify a
55
+ signature, establish trust, enforce replay protection or grant a licence.
56
+
57
+ ## Commerce data used by existing consumers
58
+
59
+ `SchemaOrgOfferClaim`, `SchemaOrgOrderClaim` and
60
+ `SchemaOrgIndividualProductClaim` contain the generic flat fields already read
61
+ by `HostingOfferOrderService`, `process-order-entry`, `payment-confirmation`,
62
+ `FamilyManager`, `license-search` and related hosting handlers in the Gateway
63
+ source linked above. These fields include offer quantity and price, accepted
64
+ offer references, order confirmation/payment references and product serials.
65
+ They preserve the exact existing indexed wire identities. Host-specific pricing,
66
+ payment verification, role entitlements, device limits and licence decisions
67
+ remain outside these neutral vocabularies. A product category or serial is data,
68
+ not authorization. No unused SoftwareApplication vocabulary is added merely to
69
+ reproduce a larger historical catalog.
70
+
71
+ ## Validation
72
+
73
+ Public consumer fixtures compile the positive shapes and reject missing client
74
+ scope, missing device identity, string numeric dates, unknown claim keys and a
75
+ device extension accidentally placed in the standard metadata subset. Runtime
76
+ tests preserve the distinction between identifier references and values, the
77
+ existing public-catalog exports and identity-assurance mapping keys. Existing
78
+ catalog and cryptography tests continue to validate their own behavior. These
79
+ checks do not claim complete OpenID conformance or an education service journey.
@@ -0,0 +1,49 @@
1
+ # Neutral record and vault contracts
2
+
3
+ The `vault-repository` subpath exports five type-only contracts:
4
+ `RecordBase`, `VaultRecord`, `VaultQueryCondition`, `VaultQuery` and
5
+ `IVaultRepository`. They provide one reusable abstract storage boundary for
6
+ education, administration and other sector consumers without importing a product
7
+ SDK, clinical vocabulary or a storage backend.
8
+
9
+ `RecordBase` requires `id: string`; `VaultRecord` aliases it. The repository
10
+ retains the existing four methods and results: write one or several records,
11
+ read an optional typed record, query typed records, and delete a record. Write
12
+ and delete results remain `Promise<boolean>`. An identifier does not establish
13
+ authority; host composition must enforce the authenticated account, tenant and
14
+ collection scope.
15
+
16
+ ## Query profile and compatibility
17
+
18
+ `VaultQueryCondition` retains `attribute`, optional `equals` and optional `in`.
19
+ `VaultQuery` retains optional `where`, `orderBy`, `limit` and `offset`. This is the
20
+ existing exact record-field profile. In particular an attribute containing dots
21
+ is not automatically interpreted as a nested path, an EAV attribute name or a
22
+ protected HMAC index selector. This extraction adds no `extraIndex` capability
23
+ or implicit index dialect. Protected-index queries need a separately named and
24
+ tested profile/capability that retains vault, tenant and index namespaces.
25
+
26
+ Original contract source: <https://github.com/soschain/sos-sdk-core-ts>, reviewed
27
+ at the [four-method repository port](https://github.com/soschain/sos-sdk-core-ts/blob/53adaa88724560b728f9c6e5e897951c8da9550b/src/vault-repository.ts).
28
+ Compatibility consumers can retain their existing public subpaths through
29
+ type-only re-exports. Record metadata or a query input alone does not authorize
30
+ collection access or select a backend.
31
+
32
+ ## What the abstract port does not implement
33
+
34
+ There is no memory, SQLite, IndexedDB, Firestore or other persistence adapter in
35
+ this module. There is no transaction implementation, driver, transport client,
36
+ cross-device synchronization or key-custody implementation. Those behaviors
37
+ belong to explicit runtime owners and require their own adapter and journey
38
+ proof. Antifraud Data must not import a product runtime to implement this port.
39
+
40
+ The richer Gateway repository class, with section/history/hydration operations
41
+ and a runtime DI token, is a separate contract. It must not be silently replaced
42
+ with this four-method type-only interface merely because the public names match.
43
+
44
+ Public consumer fixtures check typed record reads/queries, required IDs and
45
+ method results while rejecting an unsupported EAV condition shape. A scoped
46
+ source check rejects reverse product/clinical dependencies and runtime
47
+ implementations in the abstract module. These are contract/ownership checks,
48
+ not proof of native or browser persistence, encrypted key reopening or backend
49
+ query parity.
@@ -0,0 +1,114 @@
1
+ # Organization contact identity
2
+
3
+ The `antifraud-data-utils-ts/organization-identity` entry point owns neutral,
4
+ deterministic contact identity construction. It contains no portal, transport,
5
+ identity-provider session, storage or role-authorization policy.
6
+
7
+ ```ts
8
+ import {
9
+ StableActorContactKinds,
10
+ buildStableActorIdentifier,
11
+ buildOrganizationEmployeeDidWeb,
12
+ } from 'antifraud-data-utils-ts/organization-identity'
13
+
14
+ const contact = {
15
+ contactKind: StableActorContactKinds.Phone,
16
+ contact: '+16505550111',
17
+ } as const
18
+
19
+ const actorIdentifier = buildStableActorIdentifier(contact)
20
+ const employeeDid = buildOrganizationEmployeeDidWeb({
21
+ ...contact,
22
+ organizationDidWeb: 'did:web:example.invalid:organization',
23
+ role: 'ISCO-08|2359',
24
+ })
25
+ ```
26
+
27
+ The caller selects the contact channel explicitly. A phone value is rejected
28
+ in the email channel, an email is rejected in the phone channel, and an unknown
29
+ channel fails. `normalizeActorContact` strips `mailto:` and normalizes email
30
+ case/whitespace, or strips `tel:` and phone formatting before requiring E.164.
31
+ It never invents an email for a phone account. A leading country calling code
32
+ is required; national-format numbers need an earlier governed normalization
33
+ step with known country context.
34
+
35
+ ## Established representations and compatibility
36
+
37
+ The actor identifier retains the existing representation:
38
+
39
+ `urn:multibase:<base58btc(multihash(SHA3-256, normalized-contact))>`
40
+
41
+ The multihash algorithm byte is `0x16` and digest-length byte is `0x20`. The
42
+ employee DID retains the existing organization `did:web` root followed by
43
+ `:employee:<bare-multibase-actor>:<role>` and an optional device suffix. The role
44
+ is separate from the stable actor; two roles for one phone do not require two
45
+ phone accounts. Neither clear contact is embedded in the generated identifier.
46
+
47
+ The algorithm and representation preserve the actor identifier and employee
48
+ DID helpers in [the original source repository](https://github.com/Global-DataCare/gdc-common-utils-ts).
49
+ Tests use
50
+ that existing **development dependency only** as a compatibility oracle for
51
+ email case, plus-addresses, URI/format normalization, phone hashes, employee
52
+ DIDs and device suffixes. Email DID compatibility is defined on normalized
53
+ email values; malformed historical inputs are not accepted as new contacts.
54
+ There is no runtime dependency on the frozen package. Existing evidence CID
55
+ and DIDComm attachment code share the same internal base58btc encoder.
56
+
57
+ ## Trust boundary and migration scope
58
+
59
+ A contact string is input data, not proof of possession. The owning BFF must
60
+ verify the identity-provider token and bind the selected contact to the exact
61
+ account and protected profile. Organization admission, official contact
62
+ evidence, controller authority, employee role, licence capacity, device grants
63
+ and subject access retain their independent verification requirements.
64
+
65
+ The deterministic contact hash is a continuity identifier; it is not an access
66
+ token, encryption or protection against guessing a known email/phone number.
67
+ Do not substitute a generic organization telephone for an employee's verified
68
+ contact.
69
+
70
+ This entry point does not migrate an existing account, grant or credential.
71
+ Gateway employee creation and SDK enrollment must adopt the contact-aware
72
+ contract separately before a complete phone-only organization lifecycle can be
73
+ claimed. Existing email records are not rewritten automatically and no new
74
+ wire-level contact object is introduced.
75
+
76
+ ## Reviewed organization credential drafts
77
+
78
+ The separate `organization-credentials` entry point exports
79
+ `buildOrganizationTestNetworkCredential` and
80
+ `buildTestNetworkOrganizationCredentialSet`, together with their existing
81
+ proof-free canonicalization helpers. The first builds the admission draft; the
82
+ second builds the Organization, legal representative and Service controller
83
+ domain drafts. They neither issue a trusted credential nor verify a signature.
84
+
85
+ Supply exactly one of `controllerEmail` or `controllerTelephone`. For the domain
86
+ set, independently supply exactly one of `legalRepresentativeEmail` or
87
+ `legalRepresentativeTelephone`. A representative and controller may use the
88
+ same verified phone account, or independently verified channels. Missing or
89
+ ambiguous party contacts fail instead of selecting a channel silently.
90
+
91
+ The admission projection preserves `credentialSubject.controller.email` for
92
+ email, and uses Schema.org `telephone` for a phone. Domain Person/owner `sameAs`
93
+ values preserve the established stable actor hash. There is no new wire contact
94
+ object, invented email, DID representation or proof algorithm.
95
+
96
+ The domain builder requires caller-governed `legalRepresentativeOccupation`,
97
+ `controllerOccupation` and `controllerAuthorityRole`; it does not choose
98
+ occupation or authority policy. The trusted domain layer supplies its governed
99
+ values and the gateway verifies their legitimacy. Compatibility tests supply
100
+ the predecessor's role values and compare the complete email JSON bytes.
101
+
102
+ `canonicalizeOrganizationTestNetworkCredential` and
103
+ `canonicalizeTestNetworkOrganizationCredential` retain the predecessor's exact
104
+ recursive proof removal and object-key ordering. This is the existing signing
105
+ payload contract, not a signature algorithm or evidence that a supplied proof
106
+ is valid. The enclosing host/GW still checks the trusted issuer, signer,
107
+ credential type/environment, PDF digest, party contact, controller key and
108
+ validity period.
109
+
110
+ On the reviewed technical-sector Test Network path, the host signs and the GW
111
+ verifies these admission/domain credentials before Offer/Order continuation.
112
+ That path legitimately need not invoke an external ICA. Real ICA issuance is a
113
+ separate verification boundary and must not be claimed from constructing drafts
114
+ or completing host-reviewed admission.
@@ -0,0 +1,63 @@
1
+ # Unverified credential and presentation parsing
2
+
3
+ The `credential-decoding` subpath provides two product-neutral parsing
4
+ helpers: `decodeUnverifiedJsonOrJwtObject(input)` and
5
+ `extractUnverifiedPresentationCredentials(input)`. They read data, not trust.
6
+ Neither helper verifies JOSE headers, signatures, issuers, recipients, validity
7
+ periods, nonces, role types or any authorization policy. They do not replace the
8
+ cryptography engine's JWS/JWE processing or an application's token verifier.
9
+
10
+ ## Supported input and raw-object boundary
11
+
12
+ The object decoder accepts a raw JSON object string, a three-part compact input
13
+ with a nonempty base64url JSON object payload, or an already decoded plain data
14
+ object. Compact inputs preserve the current parser's payload-only behavior:
15
+ their header and signature segments are not validated. Payload bytes use the
16
+ existing `Content` strict base64url decoding and fatal UTF-8 conversion.
17
+
18
+ Already decoded containers must have the ordinary object prototype or a null
19
+ prototype and only own string-keyed data properties. Own accessors, inherited
20
+ containers, arrays and class instances are excluded. The parser reads property
21
+ descriptors rather than calling conversion functions or property getters. It
22
+ returns a shallow copy of enumerable own data fields; nested values remain
23
+ opaque, unvalidated values. This is deliberately not a recursive JSON validator
24
+ or arbitrary JavaScript-object sandbox. Hostile Proxy reflection traps cannot
25
+ be guaranteed inert by a portable JavaScript helper; reflection errors are
26
+ handled as invalid input. Input strings and bytes are the preferred boundary.
27
+
28
+ The presentation collector reads only an own `vp` data container and an own
29
+ `verifiableCredential` array. It reads own array data entries through descriptors,
30
+ without using a caller-provided iterator or invoking array-entry getters.
31
+ Candidates can be plain decoded objects, raw JSON object strings or compact
32
+ credential payloads. Malformed candidates are omitted in their existing order.
33
+ There is no credential-type selection or profile admission policy in this layer.
34
+
35
+ Malformed input returns `undefined` from the object decoder or an empty array
36
+ from the collector. A valid empty JSON object can be parsed as data; it does not
37
+ become a valid credential or a successful authentication result. Public return
38
+ types retain unknown field values so callers must validate a selected schema.
39
+
40
+ ## Compatibility and hardening
41
+
42
+ Current source consumers include `individual-controller-smart` and duplicated
43
+ activation parsing helpers in <https://github.com/soschain/sos-gw-node-ts>.
44
+ Original compatibility source:
45
+ <https://github.com/Global-DataCare/gdc-common-utils-ts>, specifically the reviewed
46
+ [presentation parsing helpers](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/f4031b221216cacd9917d1d20c5ff0b03bed7045/src/utils/vp-token.ts).
47
+ Existing consumer wrappers may retain their old public spelling while importing
48
+ the explicitly unverified neutral implementation. Controller/representative
49
+ credential selection and activation policy remain in their owning product or
50
+ service; they do not become generic cryptographic verification.
51
+
52
+ Valid serialized object payloads preserve their data and order. The new boundary
53
+ explicitly rejects non-object JSON, invalid base64url/UTF-8, inherited fields,
54
+ nonplain containers and accessor/coercion-dependent objects that the older
55
+ permissive helpers could accept. It does not mutate a source object or assign
56
+ prototype keys through a prototype setter. Its own-container checks do not
57
+ validate nested subject values; callers must not infer recursive safety.
58
+
59
+ Tests cover exact Unicode data, supported input forms, mixed credential arrays,
60
+ malformed/scalar encodings, object/prototype/accessor boundaries, own array entries,
61
+ prototype-key preservation and unchanged unverified results under altered header
62
+ or signature segments. Those last cases prove the limit of parsing, not a
63
+ cryptographic success result.
package/package.json CHANGED
@@ -1,11 +1,51 @@
1
1
  {
2
2
  "name": "antifraud-data-utils-ts",
3
- "version": "0.1.11",
3
+ "version": "0.3.0",
4
4
  "description": "Product-neutral identity, evidence and public organization catalog data contracts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
9
+ "./actor-kinds": {
10
+ "types": "./dist/actor-kinds.d.ts",
11
+ "default": "./dist/actor-kinds.js"
12
+ },
13
+ "./vault-repository": {
14
+ "types": "./dist/vault-repository.d.ts",
15
+ "default": "./dist/vault-repository.js"
16
+ },
17
+ "./credential-decoding": {
18
+ "types": "./dist/credential-decoding.d.ts",
19
+ "default": "./dist/credential-decoding.js"
20
+ },
21
+ "./credential-contracts": {
22
+ "types": "./dist/credential-contracts.d.ts",
23
+ "default": "./dist/credential-contracts.js"
24
+ },
25
+ "./didcomm-contracts": {
26
+ "types": "./dist/didcomm-contracts.d.ts",
27
+ "default": "./dist/didcomm-contracts.js"
28
+ },
29
+ "./schema-org-claims": {
30
+ "types": "./dist/schema-org-claims.d.ts",
31
+ "default": "./dist/schema-org-claims.js"
32
+ },
33
+ "./openid-contracts": {
34
+ "types": "./dist/openid-contracts.d.ts",
35
+ "default": "./dist/openid-contracts.js"
36
+ },
37
+ "./did-document": {
38
+ "types": "./dist/did-document.d.ts",
39
+ "default": "./dist/did-document.js"
40
+ },
41
+ "./encoding": {
42
+ "types": "./dist/encoding.d.ts",
43
+ "default": "./dist/encoding.js"
44
+ },
45
+ "./isco-08": {
46
+ "types": "./dist/isco-08.d.ts",
47
+ "default": "./dist/isco-08.js"
48
+ },
9
49
  ".": {
10
50
  "types": "./dist/index.d.ts",
11
51
  "default": "./dist/index.js"
@@ -22,6 +62,14 @@
22
62
  "types": "./dist/organization-service-catalog.d.ts",
23
63
  "default": "./dist/organization-service-catalog.js"
24
64
  },
65
+ "./organization-identity": {
66
+ "types": "./dist/organization-identity.d.ts",
67
+ "default": "./dist/organization-identity.js"
68
+ },
69
+ "./organization-credentials": {
70
+ "types": "./dist/organization-credentials.d.ts",
71
+ "default": "./dist/organization-credentials.js"
72
+ },
25
73
  "./service-conversation": {
26
74
  "types": "./dist/service-conversation.d.ts",
27
75
  "default": "./dist/service-conversation.js"
@@ -37,7 +85,7 @@
37
85
  "scripts": {
38
86
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
39
87
  "build": "npm run clean && tsc -p tsconfig.json",
40
- "test": "npm run build && node --test test/*.test.mjs",
88
+ "test": "npm run build && node --test --test-concurrency=1 test/*.test.mjs",
41
89
  "typecheck": "tsc -p tsconfig.json --noEmit"
42
90
  },
43
91
  "engines": {