sos-sdk-node-ts 0.1.9 → 0.1.11

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,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.11 - 2026-10-20
6
+
7
+ - Keep valid owned human cards discoverable when the same verified identity
8
+ also has active profile or controller licenses whose authorized subject is
9
+ not a card DID; malformed card-shaped DIDs still fail closed.
10
+
11
+ ## 0.1.10 - 2026-10-20
12
+
13
+ - Discover canonical animal cards through any governed `animal-*` sector,
14
+ including `animal-research`, instead of treating `animal-care` as the only
15
+ animal subject directory.
16
+
5
17
  - Send authorized-subject directory submit and poll envelopes with the
6
18
  canonical `application/didcomm-plain+json` media type so compat-mode SOS
7
19
  gateways do not reject card discovery as legacy JSON.
@@ -170,7 +170,7 @@ function readOwnedSubjects(body, context, verified) {
170
170
  const subjectDid = selectSubjectCardAlias(claims[CLAIM_ORGANIZATION_SAME_AS], context);
171
171
  if (!subjectDid)
172
172
  return [];
173
- const role = context.sector === 'animal-care'
173
+ const role = isAnimalSector(context.sector)
174
174
  ? 'RESPRSN'
175
175
  : String(claims[CLAIM_ORGANIZATION_MEMBER_ROLE] || '').trim();
176
176
  const relatedPersonId = String(claims[CLAIM_ORGANIZATION_OWNER_IDENTIFIER] || '').trim();
@@ -193,6 +193,8 @@ function readAcceptedLicenses(body, context) {
193
193
  const subjectDid = String(meta.authorizedSubjectDid || '').trim();
194
194
  if (!subjectDid)
195
195
  return [];
196
+ if (!isSubjectCardCandidate(subjectDid, context))
197
+ return [];
196
198
  requireCanonicalSubjectDid(subjectDid, context);
197
199
  const claims = objectRecord(meta.claims);
198
200
  const relatedRoles = String(claims[CLAIM_RELATED_PERSON_ROLE] || '')
@@ -222,7 +224,7 @@ function readData(body) {
222
224
  }
223
225
  function selectSubjectCardAlias(value, context) {
224
226
  const aliases = publicAliases(value);
225
- const candidate = aliases.find((alias) => context.sector === 'animal-care'
227
+ const candidate = aliases.find((alias) => isAnimalSector(context.sector)
226
228
  ? alias.includes(':card:vetchain:')
227
229
  : alias.includes(':card:uhc:'));
228
230
  if (!candidate)
@@ -231,13 +233,21 @@ function selectSubjectCardAlias(value, context) {
231
233
  return candidate;
232
234
  }
233
235
  function requireCanonicalSubjectDid(subjectDid, context) {
234
- if (context.sector === 'animal-care' && !parseAnimalCardDidWeb(subjectDid)) {
236
+ if (isAnimalSector(context.sector) && !parseAnimalCardDidWeb(subjectDid)) {
235
237
  throw new Error('animal_card_did_invalid');
236
238
  }
237
- if (context.sector !== 'animal-care' && !/^did:web:[^\s]+:card:uhc:(?:personal|professional):[^\s]+$/i.test(subjectDid)) {
239
+ if (!isAnimalSector(context.sector) && !/^did:web:[^\s]+:card:uhc:(?:personal|professional):[^\s]+$/i.test(subjectDid)) {
238
240
  throw new Error('human_card_did_invalid');
239
241
  }
240
242
  }
243
+ function isSubjectCardCandidate(subjectDid, context) {
244
+ return isAnimalSector(context.sector)
245
+ ? subjectDid.toLowerCase().includes(':card:vetchain:')
246
+ : subjectDid.toLowerCase().includes(':card:uhc:');
247
+ }
248
+ function isAnimalSector(sector) {
249
+ return sector.toLowerCase().startsWith('animal-');
250
+ }
241
251
  function publicAliases(value) {
242
252
  const values = Array.isArray(value) ? value : String(value ?? '').split(',');
243
253
  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.9",
3
+ "version": "0.1.11",
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",