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