gdc-sdk-node-ts 2.4.11 → 2.4.12
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/dist/node-managed-wallet.js +14 -4
- package/package.json +1 -1
|
@@ -358,9 +358,11 @@ export class NodeManagedWallet {
|
|
|
358
358
|
header: {
|
|
359
359
|
typ: 'JWS',
|
|
360
360
|
},
|
|
361
|
-
claims
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
// GW KMS decodes the JWS claims as the DIDComm message itself. Wrapping
|
|
362
|
+
// the message in `{ payload: ... }` hides `iss`, `thid` and `body` one
|
|
363
|
+
// level too deep and makes every encrypted resource action fail before
|
|
364
|
+
// routing or signature verification.
|
|
365
|
+
claims: content,
|
|
364
366
|
key: signingKey,
|
|
365
367
|
});
|
|
366
368
|
return this.buildCompactJwe(options.context, {
|
|
@@ -404,8 +406,16 @@ export class NodeManagedWallet {
|
|
|
404
406
|
throw new Error('NodeManagedWallet.unpackWithContext expected a compact JWS payload.');
|
|
405
407
|
}
|
|
406
408
|
const payload = Content.base64UrlSafeToJSON(parts[1]);
|
|
409
|
+
const decodedPayload = payload;
|
|
410
|
+
const legacyWrappedContent = Object.keys(decodedPayload).length === 1
|
|
411
|
+
&& decodedPayload.payload
|
|
412
|
+
&& typeof decodedPayload.payload === 'object'
|
|
413
|
+
? decodedPayload.payload
|
|
414
|
+
: decodedPayload;
|
|
407
415
|
return {
|
|
408
|
-
|
|
416
|
+
// Read the canonical direct-message JWS and retain compatibility
|
|
417
|
+
// with SDK <=2.4.11 envelopes already queued by an outbox.
|
|
418
|
+
content: legacyWrappedContent,
|
|
409
419
|
meta: {
|
|
410
420
|
jwe: { protected: decodedProtectedHeader },
|
|
411
421
|
jws: {
|