@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.
@@ -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,