sos-sdk-node-ts 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.10 - 2026-10-20
6
+
7
+ - Discover canonical animal cards through any governed `animal-*` sector,
8
+ including `animal-research`, instead of treating `animal-care` as the only
9
+ animal subject directory.
10
+
11
+ - Send authorized-subject directory submit and poll envelopes with the
12
+ canonical `application/didcomm-plain+json` media type so compat-mode SOS
13
+ gateways do not reject card discovery as legacy JSON.
5
14
  - Add the shared trusted-BFF authorized-subject directory client with canonical
6
15
  SOS GW Organization/License routes, real submit/poll HTTP coverage,
7
16
  independent `sameAs` alias matching and fail-closed animal-card DID
@@ -27,8 +27,11 @@ export class SosGatewaySubjectDirectoryClient {
27
27
  this.requestTimeoutMs = positiveInteger(options.requestTimeoutMs ?? 15_000, 'request_timeout_invalid');
28
28
  this.fetchImpl = options.fetchImpl ?? fetch;
29
29
  this.headers = Object.freeze({
30
- 'Content-Type': 'application/json',
31
- Accept: 'application/json',
30
+ // The shared GW contract identifies this existing thid/body envelope as
31
+ // DIDComm plaintext. Compat and strict deployments must never receive it
32
+ // under the ambiguous legacy application/json media type.
33
+ 'Content-Type': 'application/didcomm-plain+json',
34
+ Accept: 'application/didcomm-plain+json',
32
35
  ...(requiredOptional(options.bearerToken) ? { Authorization: `Bearer ${requiredOptional(options.bearerToken)}` } : {}),
33
36
  ...(requiredOptional(options.appId)
34
37
  ? buildGatewayApplicationHeaders({
@@ -167,7 +170,7 @@ function readOwnedSubjects(body, context, verified) {
167
170
  const subjectDid = selectSubjectCardAlias(claims[CLAIM_ORGANIZATION_SAME_AS], context);
168
171
  if (!subjectDid)
169
172
  return [];
170
- const role = context.sector === 'animal-care'
173
+ const role = isAnimalSector(context.sector)
171
174
  ? 'RESPRSN'
172
175
  : String(claims[CLAIM_ORGANIZATION_MEMBER_ROLE] || '').trim();
173
176
  const relatedPersonId = String(claims[CLAIM_ORGANIZATION_OWNER_IDENTIFIER] || '').trim();
@@ -219,7 +222,7 @@ function readData(body) {
219
222
  }
220
223
  function selectSubjectCardAlias(value, context) {
221
224
  const aliases = publicAliases(value);
222
- const candidate = aliases.find((alias) => context.sector === 'animal-care'
225
+ const candidate = aliases.find((alias) => isAnimalSector(context.sector)
223
226
  ? alias.includes(':card:vetchain:')
224
227
  : alias.includes(':card:uhc:'));
225
228
  if (!candidate)
@@ -228,13 +231,16 @@ function selectSubjectCardAlias(value, context) {
228
231
  return candidate;
229
232
  }
230
233
  function requireCanonicalSubjectDid(subjectDid, context) {
231
- if (context.sector === 'animal-care' && !parseAnimalCardDidWeb(subjectDid)) {
234
+ if (isAnimalSector(context.sector) && !parseAnimalCardDidWeb(subjectDid)) {
232
235
  throw new Error('animal_card_did_invalid');
233
236
  }
234
- if (context.sector !== 'animal-care' && !/^did:web:[^\s]+:card:uhc:(?:personal|professional):[^\s]+$/i.test(subjectDid)) {
237
+ if (!isAnimalSector(context.sector) && !/^did:web:[^\s]+:card:uhc:(?:personal|professional):[^\s]+$/i.test(subjectDid)) {
235
238
  throw new Error('human_card_did_invalid');
236
239
  }
237
240
  }
241
+ function isAnimalSector(sector) {
242
+ return sector.toLowerCase().startsWith('animal-');
243
+ }
238
244
  function publicAliases(value) {
239
245
  const values = Array.isArray(value) ? value : String(value ?? '').split(',');
240
246
  return [...new Set(values.map((alias) => String(alias).trim()).filter(Boolean))];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sos-sdk-node-ts",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Product-neutral Node adapters shared by SOSChain, Vet and UHC runtimes",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Connecting Solution & Applications Ltd",