@learncard/sss-key-manager 0.2.4 → 0.2.5
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/README.md +15 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/sss-key-manager.cjs.development.js +14 -0
- package/dist/sss-key-manager.cjs.development.js.map +2 -2
- package/dist/sss-key-manager.cjs.production.min.js +6 -6
- package/dist/sss-key-manager.cjs.production.min.js.map +3 -3
- package/dist/sss-key-manager.esm.js +14 -0
- package/dist/sss-key-manager.esm.js.map +2 -2
- package/dist/sss-strategy.d.ts +4 -0
- package/dist/sss-strategy.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/critical-paths.test.ts +20 -24
- package/src/index.ts +1 -0
- package/src/sss-strategy.test.ts +11 -0
- package/src/sss-strategy.ts +18 -0
|
@@ -27790,6 +27790,15 @@ var EscrowRequestError = class extends Error {
|
|
|
27790
27790
|
__name(this, "EscrowRequestError");
|
|
27791
27791
|
}
|
|
27792
27792
|
};
|
|
27793
|
+
var DuplicateShareCoordinateError = class extends Error {
|
|
27794
|
+
static {
|
|
27795
|
+
__name(this, "DuplicateShareCoordinateError");
|
|
27796
|
+
}
|
|
27797
|
+
constructor() {
|
|
27798
|
+
super("Stored shares have the same coordinate and cannot be combined");
|
|
27799
|
+
this.name = "DuplicateShareCoordinateError";
|
|
27800
|
+
}
|
|
27801
|
+
};
|
|
27793
27802
|
var fetchAuthShareRaw = /* @__PURE__ */ __name(async (serverUrl, token, providerType, shareVersion, tenantId) => {
|
|
27794
27803
|
const response = await fetch(`${serverUrl}/keys/auth-share`, {
|
|
27795
27804
|
method: "POST",
|
|
@@ -28729,6 +28738,10 @@ function createSSSStrategy(config) {
|
|
|
28729
28738
|
};
|
|
28730
28739
|
},
|
|
28731
28740
|
async reconstructKey(localKey, remoteKey) {
|
|
28741
|
+
const coordinate = localKey.slice(-2).toLowerCase();
|
|
28742
|
+
if (localKey.length === remoteKey.length && /^(?:[0-9a-f]{2}){2,}$/i.test(localKey) && /^(?:[0-9a-f]{2}){2,}$/i.test(remoteKey) && coordinate !== "00" && coordinate === remoteKey.slice(-2).toLowerCase()) {
|
|
28743
|
+
throw new DuplicateShareCoordinateError();
|
|
28744
|
+
}
|
|
28732
28745
|
return reconstructFromShares([localKey, remoteKey]);
|
|
28733
28746
|
},
|
|
28734
28747
|
async verifyKeys(localKey, remoteKey, expectedDid, didFromPrivateKey) {
|
|
@@ -30423,6 +30436,7 @@ export {
|
|
|
30423
30436
|
AtomicUpdateError,
|
|
30424
30437
|
export_AuthSessionError as AuthSessionError,
|
|
30425
30438
|
DEFAULT_KDF_PARAMS,
|
|
30439
|
+
DuplicateShareCoordinateError,
|
|
30426
30440
|
EMAIL_RELAY_ALGORITHM,
|
|
30427
30441
|
EMAIL_RELAY_ENVELOPE_VERSION,
|
|
30428
30442
|
ESCROW_ALGORITHM,
|