@tinycloud/sdk-services 2.2.0 → 2.2.1-beta.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.
package/dist/index.js CHANGED
@@ -5005,6 +5005,15 @@ function verifyDecryptResponse(input) {
5005
5005
  })
5006
5006
  };
5007
5007
  }
5008
+ if (response.nodeId !== request.targetNode) {
5009
+ return {
5010
+ ok: false,
5011
+ error: encryptionError({
5012
+ code: "RESPONSE_BINDING_MISMATCH",
5013
+ field: "nodeId"
5014
+ })
5015
+ };
5016
+ }
5008
5017
  if (response.alg !== request.alg) {
5009
5018
  return {
5010
5019
  ok: false,
@@ -5149,6 +5158,14 @@ var EncryptionService = class extends BaseService {
5149
5158
  try {
5150
5159
  const validated = validateEnvelope(this.crypto, envelope);
5151
5160
  if (!validated.ok) return validated;
5161
+ if (options?.aad !== void 0 && validated.data.aad !== base64Encode2(options.aad)) {
5162
+ return encErr(
5163
+ encryptionError({
5164
+ code: "INVALID_INPUT",
5165
+ message: "decryptEnvelope aad does not match the envelope"
5166
+ })
5167
+ );
5168
+ }
5152
5169
  let descriptor;
5153
5170
  if (options?.descriptor !== void 0) {
5154
5171
  descriptor = options.descriptor;