gdc-sdk-node-ts 2.4.11 → 2.4.13

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.
@@ -307,6 +307,9 @@ export class NodeManagedWallet {
307
307
  };
308
308
  const protectedHeader = {
309
309
  enc: 'A256GCM',
310
+ // GW binds the encrypted channel to the sender's managed communication
311
+ // key before it decrypts or evaluates the nested DIDComm message.
312
+ skid: entry.descriptor.kid,
310
313
  ...(request.contentType ? { cty: request.contentType } : {}),
311
314
  };
312
315
  const plaintext = typeof request.plaintext === 'string'
@@ -358,9 +361,11 @@ export class NodeManagedWallet {
358
361
  header: {
359
362
  typ: 'JWS',
360
363
  },
361
- claims: {
362
- payload: content,
363
- },
364
+ // GW KMS decodes the JWS claims as the DIDComm message itself. Wrapping
365
+ // the message in `{ payload: ... }` hides `iss`, `thid` and `body` one
366
+ // level too deep and makes every encrypted resource action fail before
367
+ // routing or signature verification.
368
+ claims: content,
364
369
  key: signingKey,
365
370
  });
366
371
  return this.buildCompactJwe(options.context, {
@@ -404,8 +409,16 @@ export class NodeManagedWallet {
404
409
  throw new Error('NodeManagedWallet.unpackWithContext expected a compact JWS payload.');
405
410
  }
406
411
  const payload = Content.base64UrlSafeToJSON(parts[1]);
412
+ const decodedPayload = payload;
413
+ const legacyWrappedContent = Object.keys(decodedPayload).length === 1
414
+ && decodedPayload.payload
415
+ && typeof decodedPayload.payload === 'object'
416
+ ? decodedPayload.payload
417
+ : decodedPayload;
407
418
  return {
408
- content: payload.payload,
419
+ // Read the canonical direct-message JWS and retain compatibility
420
+ // with SDK <=2.4.11 envelopes already queued by an outbox.
421
+ content: legacyWrappedContent,
409
422
  meta: {
410
423
  jwe: { protected: decodedProtectedHeader },
411
424
  jws: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-sdk-node-ts",
3
- "version": "2.4.11",
3
+ "version": "2.4.13",
4
4
  "description": "Next-generation Node runtime package for the GDC SDK family",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Antifraud Services Inc.",