@volr/react 0.1.125 → 0.1.126

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.cjs CHANGED
@@ -20768,6 +20768,40 @@ function blobToBase642(blob) {
20768
20768
  reader.readAsDataURL(blob);
20769
20769
  });
20770
20770
  }
20771
+ async function decryptEntropyForMigration(params) {
20772
+ const {
20773
+ client,
20774
+ userId,
20775
+ blobUrl,
20776
+ prfInput,
20777
+ credentialId,
20778
+ rpId = typeof window !== "undefined" ? window.location.hostname : "localhost",
20779
+ rpName = "Volr"
20780
+ } = params;
20781
+ const arrayBuffer = await client.postBinary("/blob/download", { key: blobUrl });
20782
+ const blobBytes = new Uint8Array(arrayBuffer);
20783
+ const nonceLength = 12;
20784
+ const cipherLength = blobBytes.length - nonceLength;
20785
+ if (cipherLength <= 0) {
20786
+ throw new Error("Invalid blob format: blob too small");
20787
+ }
20788
+ const cipher = blobBytes.slice(0, cipherLength);
20789
+ const nonce = blobBytes.slice(cipherLength);
20790
+ const keyStorageType = "passkey";
20791
+ const version5 = "v1";
20792
+ const aadBytes = new TextEncoder().encode(
20793
+ `volr/master-seed/v1|${userId}|${keyStorageType}|${version5}`
20794
+ );
20795
+ const prfSalt = sdkCore.deriveWrapKey(prfInput);
20796
+ const passkeyAdapter = createPasskeyAdapter({ rpId});
20797
+ const { prfOutput } = await passkeyAdapter.authenticate({
20798
+ salt: prfSalt,
20799
+ credentialId
20800
+ });
20801
+ const wrapKey = prfOutput;
20802
+ const entropy = await sdkCore.unsealMasterSeed(cipher, wrapKey, aadBytes, nonce);
20803
+ return entropy;
20804
+ }
20771
20805
  async function requestMigration(params) {
20772
20806
  const { client, targetOrigin } = params;
20773
20807
  const response = await client.post("/wallet/migration/request", { targetOrigin });
@@ -21142,6 +21176,7 @@ exports.completeMigration = completeMigration;
21142
21176
  exports.createGetNetworkInfo = createGetNetworkInfo;
21143
21177
  exports.createPasskeyAdapter = createPasskeyAdapter;
21144
21178
  exports.debugTransactionFailure = debugTransactionFailure;
21179
+ exports.decryptEntropyForMigration = decryptEntropyForMigration;
21145
21180
  exports.defaultIdempotencyKey = defaultIdempotencyKey;
21146
21181
  exports.detectWalletConnector = detectWalletConnector;
21147
21182
  exports.diagnoseTransactionFailure = diagnoseTransactionFailure;