@cardanowall/poe-standard 0.4.0 → 0.6.0

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/validator.js CHANGED
@@ -3576,13 +3576,13 @@ function readVarint(bytes, start) {
3576
3576
  function decodeMultibase(prefix, body) {
3577
3577
  switch (prefix) {
3578
3578
  case "b":
3579
- return decodeBase32(body.toLowerCase(), "rfc4648-lower");
3579
+ return decodeBase32(body, "rfc4648-lower");
3580
3580
  case "B":
3581
- return decodeBase32(body.toUpperCase(), "rfc4648-upper");
3581
+ return decodeBase32(body, "rfc4648-upper");
3582
3582
  case "f":
3583
- return decodeBase16(body.toLowerCase());
3583
+ return decodeBase16(body, "lower");
3584
3584
  case "F":
3585
- return decodeBase16(body.toUpperCase());
3585
+ return decodeBase16(body, "upper");
3586
3586
  case "z":
3587
3587
  return decodeBase58btc(body);
3588
3588
  default:
@@ -3591,10 +3591,10 @@ function decodeMultibase(prefix, body) {
3591
3591
  }
3592
3592
  var BASE16_LOWER = "0123456789abcdef";
3593
3593
  var BASE16_UPPER = "0123456789ABCDEF";
3594
- function decodeBase16(s3) {
3594
+ function decodeBase16(s3, variant) {
3595
3595
  if (s3.length % 2 !== 0) throw new Error("base16: odd-length");
3596
+ const alphabet = variant === "lower" ? BASE16_LOWER : BASE16_UPPER;
3596
3597
  const out = new Uint8Array(s3.length / 2);
3597
- const alphabet = s3 === s3.toLowerCase() ? BASE16_LOWER : BASE16_UPPER;
3598
3598
  for (let i = 0; i < out.length; i++) {
3599
3599
  const hi = alphabet.indexOf(s3[i * 2]);
3600
3600
  const lo = alphabet.indexOf(s3[i * 2 + 1]);