zapo-js 1.2.0 → 1.2.1
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.
|
@@ -717,7 +717,12 @@ class WaAppStateSyncClient {
|
|
|
717
717
|
if (keyData !== null) {
|
|
718
718
|
const expectedSnapshotMac = await this.crypto.generateSnapshotMac(keyData, ltHash, version, collection);
|
|
719
719
|
if (!(0, bytes_1.uint8TimingSafeEqual)(expectedSnapshotMac, snapshot.mac)) {
|
|
720
|
-
|
|
720
|
+
// Poisoned server-side snapshot (MAC unverifiable by any client):
|
|
721
|
+
// keep partial state instead of throwing, which would loop refetch forever.
|
|
722
|
+
this.logger.warn('snapshot LT-hash verification failed, continuing with partial state', {
|
|
723
|
+
collection,
|
|
724
|
+
version
|
|
725
|
+
});
|
|
721
726
|
}
|
|
722
727
|
}
|
|
723
728
|
this.setCollectionState(collection, version, ltHash, indexValueMap);
|
|
@@ -714,7 +714,12 @@ export class WaAppStateSyncClient {
|
|
|
714
714
|
if (keyData !== null) {
|
|
715
715
|
const expectedSnapshotMac = await this.crypto.generateSnapshotMac(keyData, ltHash, version, collection);
|
|
716
716
|
if (!uint8TimingSafeEqual(expectedSnapshotMac, snapshot.mac)) {
|
|
717
|
-
|
|
717
|
+
// Poisoned server-side snapshot (MAC unverifiable by any client):
|
|
718
|
+
// keep partial state instead of throwing, which would loop refetch forever.
|
|
719
|
+
this.logger.warn('snapshot LT-hash verification failed, continuing with partial state', {
|
|
720
|
+
collection,
|
|
721
|
+
version
|
|
722
|
+
});
|
|
718
723
|
}
|
|
719
724
|
}
|
|
720
725
|
this.setCollectionState(collection, version, ltHash, indexValueMap);
|
package/dist/esm/util/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { base64ToBytes, bytesToBase64, bytesToBase64UrlSafe, bytesToHex, decodeBase64Url, hexToBytes, TEXT_DECODER, toBytesView, uint8Equal } from './bytes.js';
|
|
1
|
+
export { base64ToBytes, bytesToBase64, bytesToBase64UrlSafe, bytesToHex, decodeBase64Url, hexToBytes, TEXT_DECODER, toBytesView, uint8Equal, uint8TimingSafeEqual } from './bytes.js';
|
|
2
2
|
export { asBytes, asNumber, asOptionalBytes, asOptionalNumber, asOptionalString, asString, resolvePositive, toBoolOrUndef } from './coercion.js';
|
|
3
3
|
export { normalizeQueryLimit } from './collections.js';
|
|
4
4
|
export { toError, toSafeNumber } from './primitives.js';
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { base64ToBytes, bytesToBase64, bytesToBase64UrlSafe, bytesToHex, decodeBase64Url, hexToBytes, TEXT_DECODER, toBytesView, uint8Equal } from './bytes';
|
|
1
|
+
export { base64ToBytes, bytesToBase64, bytesToBase64UrlSafe, bytesToHex, decodeBase64Url, hexToBytes, TEXT_DECODER, toBytesView, uint8Equal, uint8TimingSafeEqual } from './bytes';
|
|
2
2
|
export { asBytes, asNumber, asOptionalBytes, asOptionalNumber, asOptionalString, asString, resolvePositive, toBoolOrUndef } from './coercion';
|
|
3
3
|
export { normalizeQueryLimit } from './collections';
|
|
4
4
|
export { toError, toSafeNumber } from './primitives';
|
package/dist/util/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBunRuntime = exports.toSafeNumber = exports.toError = exports.normalizeQueryLimit = exports.toBoolOrUndef = exports.resolvePositive = exports.asString = exports.asOptionalString = exports.asOptionalNumber = exports.asOptionalBytes = exports.asNumber = exports.asBytes = exports.uint8Equal = exports.toBytesView = exports.TEXT_DECODER = exports.hexToBytes = exports.decodeBase64Url = exports.bytesToHex = exports.bytesToBase64UrlSafe = exports.bytesToBase64 = exports.base64ToBytes = void 0;
|
|
3
|
+
exports.isBunRuntime = exports.toSafeNumber = exports.toError = exports.normalizeQueryLimit = exports.toBoolOrUndef = exports.resolvePositive = exports.asString = exports.asOptionalString = exports.asOptionalNumber = exports.asOptionalBytes = exports.asNumber = exports.asBytes = exports.uint8TimingSafeEqual = exports.uint8Equal = exports.toBytesView = exports.TEXT_DECODER = exports.hexToBytes = exports.decodeBase64Url = exports.bytesToHex = exports.bytesToBase64UrlSafe = exports.bytesToBase64 = exports.base64ToBytes = void 0;
|
|
4
4
|
var bytes_1 = require("./bytes");
|
|
5
5
|
Object.defineProperty(exports, "base64ToBytes", { enumerable: true, get: function () { return bytes_1.base64ToBytes; } });
|
|
6
6
|
Object.defineProperty(exports, "bytesToBase64", { enumerable: true, get: function () { return bytes_1.bytesToBase64; } });
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "hexToBytes", { enumerable: true, get: function (
|
|
|
11
11
|
Object.defineProperty(exports, "TEXT_DECODER", { enumerable: true, get: function () { return bytes_1.TEXT_DECODER; } });
|
|
12
12
|
Object.defineProperty(exports, "toBytesView", { enumerable: true, get: function () { return bytes_1.toBytesView; } });
|
|
13
13
|
Object.defineProperty(exports, "uint8Equal", { enumerable: true, get: function () { return bytes_1.uint8Equal; } });
|
|
14
|
+
Object.defineProperty(exports, "uint8TimingSafeEqual", { enumerable: true, get: function () { return bytes_1.uint8TimingSafeEqual; } });
|
|
14
15
|
var coercion_1 = require("./coercion");
|
|
15
16
|
Object.defineProperty(exports, "asBytes", { enumerable: true, get: function () { return coercion_1.asBytes; } });
|
|
16
17
|
Object.defineProperty(exports, "asNumber", { enumerable: true, get: function () { return coercion_1.asNumber; } });
|