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