@depay/widgets 12.0.0 → 12.0.2

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.
@@ -23468,17 +23468,6 @@ var NavigateProvider = (function (props) {
23468
23468
  }, props.children);
23469
23469
  });
23470
23470
 
23471
- let crypto;
23472
- let atob$1;
23473
-
23474
- if (typeof window === 'undefined') { // running in Node.js
23475
- crypto = new (require("@peculiar/webcrypto").Crypto)();
23476
- atob$1 = require('atob');
23477
- } else {
23478
- crypto = window.crypto;
23479
- atob$1 = window.atob;
23480
- }
23481
-
23482
23471
  const string2ArrayBuffer = (str)=> {
23483
23472
  const buf = new ArrayBuffer(str.length);
23484
23473
  const bufView = new Uint8Array(buf);
@@ -23488,9 +23477,9 @@ const string2ArrayBuffer = (str)=> {
23488
23477
  return buf
23489
23478
  };
23490
23479
 
23491
- const base64ToArrayBuffer = (b64)=> {
23480
+ const base64ToArrayBuffer = (b64, atob)=> {
23492
23481
  const safeB64 = b64.replace(/-/g, '+').replace(/_/g, '/');
23493
- const byteString = atob$1(safeB64);
23482
+ const byteString = atob(safeB64);
23494
23483
  let byteArray = new Uint8Array(byteString.length);
23495
23484
  for(let i=0; i < byteString.length; i++) {
23496
23485
  byteArray[i] = byteString.charCodeAt(i);
@@ -23498,17 +23487,24 @@ const base64ToArrayBuffer = (b64)=> {
23498
23487
  return byteArray
23499
23488
  };
23500
23489
 
23501
- const verify = async ({ signature, publicKey, data, saltLength = 64 })=>{
23490
+ var internalVerify = async ({ signature, publicKey, data, saltLength = 64, crypto, atob })=>{
23502
23491
 
23503
23492
  let innerPublicKey = publicKey.replace(/^.*?-----BEGIN PUBLIC KEY-----\n/, '').replace(/-----END PUBLIC KEY-----(\n)*$/, '').replace(/(\n)*/g, '');
23504
23493
  while (innerPublicKey.length % 4) { // add proper padding
23505
23494
  innerPublicKey += '=';
23506
23495
  }
23507
- const binaryString = atob$1(innerPublicKey);
23496
+ const binaryString = atob(innerPublicKey);
23508
23497
  const binaryStringArrayBuffer = string2ArrayBuffer(binaryString);
23509
23498
  const cryptoKey = await crypto.subtle.importKey("spki", binaryStringArrayBuffer, { name: "RSA-PSS", hash: "SHA-256" }, true, ["verify"]);
23510
23499
 
23511
- return await crypto.subtle.verify({ name: "RSA-PSS", saltLength }, cryptoKey, base64ToArrayBuffer(signature), string2ArrayBuffer(data))
23500
+ return await crypto.subtle.verify({ name: "RSA-PSS", saltLength }, cryptoKey, base64ToArrayBuffer(signature, atob), string2ArrayBuffer(data))
23501
+ };
23502
+
23503
+ const crypto = window.crypto;
23504
+ const atob$1 = window.atob;
23505
+
23506
+ const verify = ({ signature, publicKey, data, saltLength = 64 })=>{
23507
+ return internalVerify({ signature, publicKey, data, saltLength, crypto, atob: atob$1 })
23512
23508
  };
23513
23509
 
23514
23510
  function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }