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