Skip to content

Commit

Permalink
9.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorm committed Jun 2, 2024
1 parent 6a1cc96 commit b2057d8
Show file tree
Hide file tree
Showing 23 changed files with 932 additions and 185 deletions.
20 changes: 10 additions & 10 deletions dist/otpauth.esm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @license otpauth 9.2.4 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
// @license noble-hashes 1.4.0 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
// @ts-nocheck
//! otpauth 9.3.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
//! noble-hashes 1.4.0 | (c) Paul Miller | MIT | https://github.com/paulmillr/noble-hashes
/// <reference types="./otpauth.d.ts" />
// @ts-nocheck
/**
* Converts an integer to an Uint8Array.
* @param {number} num Integer.
Expand Down Expand Up @@ -1144,12 +1144,12 @@ const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);
* @param {Uint8Array} message Message.
* @returns {Uint8Array} Digest.
*/ const hmacDigest = (algorithm, key, message)=>{
{
if (hmac) {
const hash = OPENSSL_NOBLE_HASHES[algorithm.toUpperCase()];
if (typeof hash === "undefined") {
throw new TypeError("Unknown hash function");
}
if (!hash) throw new TypeError("Unknown hash function");
return hmac(hash, key, message);
} else {
throw new Error("Missing HMAC function");
}
};

Expand Down Expand Up @@ -1260,11 +1260,11 @@ const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);
/**
* TextEncoder instance.
* @type {TextEncoder|null}
*/ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder("utf-8") : null;
*/ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
/**
* TextDecoder instance.
* @type {TextDecoder|null}
*/ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder("utf-8") : null;
*/ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
/**
* Converts an UTF-8 string to an Uint8Array.
* @param {string} str String.
Expand Down Expand Up @@ -1861,6 +1861,6 @@ const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);
/**
* Library version.
* @type {string}
*/ const version = "9.2.4";
*/ const version = "9.3.0";

export { HOTP, Secret, TOTP, URI, version };
12 changes: 6 additions & 6 deletions dist/otpauth.esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/otpauth.esm.min.js.map

Large diffs are not rendered by default.

44 changes: 6 additions & 38 deletions dist/otpauth.node.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @license otpauth 9.2.4 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
// @ts-nocheck
//! otpauth 9.3.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
/// <reference types="./otpauth.d.ts" />
// @ts-nocheck
'use strict';

var crypto = require('node:crypto');
Expand Down Expand Up @@ -41,20 +41,6 @@ var crypto__namespace = /*#__PURE__*/_interopNamespaceDefault(crypto);
return arr;
};

const hmac = undefined;

const sha1 = undefined;

const sha224 = undefined;
const sha256 = undefined;
const sha384 = undefined;
const sha512 = undefined;

const sha3_224 = undefined;
const sha3_256 = undefined;
const sha3_384 = undefined;
const sha3_512 = undefined;

/**
* "globalThis" ponyfill.
* @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
Expand Down Expand Up @@ -84,20 +70,6 @@ const sha3_512 = undefined;
return undefined;
})();

/**
* OpenSSL-Noble hashes map.
* @type {Object.<string, sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512>}
*/ const OPENSSL_NOBLE_HASHES = {
SHA1: sha1,
SHA224: sha224,
SHA256: sha256,
SHA384: sha384,
SHA512: sha512,
"SHA3-224": sha3_224,
"SHA3-256": sha3_256,
"SHA3-384": sha3_384,
"SHA3-512": sha3_512
};
/**
* Calculates an HMAC digest.
* In Node.js, the command "openssl list -digest-algorithms" displays the available digest algorithms.
Expand All @@ -111,11 +83,7 @@ const sha3_512 = undefined;
hmac.update(globalScope.Buffer.from(message));
return hmac.digest();
} else {
const hash = OPENSSL_NOBLE_HASHES[algorithm.toUpperCase()];
if (typeof hash === "undefined") {
throw new TypeError("Unknown hash function");
}
return hmac(hash, key, message);
throw new Error("Missing HMAC function");
}
};

Expand Down Expand Up @@ -226,11 +194,11 @@ const sha3_512 = undefined;
/**
* TextEncoder instance.
* @type {TextEncoder|null}
*/ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder("utf-8") : null;
*/ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
/**
* TextDecoder instance.
* @type {TextDecoder|null}
*/ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder("utf-8") : null;
*/ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
/**
* Converts an UTF-8 string to an Uint8Array.
* @param {string} str String.
Expand Down Expand Up @@ -831,7 +799,7 @@ const sha3_512 = undefined;
/**
* Library version.
* @type {string}
*/ const version = "9.2.4";
*/ const version = "9.3.0";

exports.HOTP = HOTP;
exports.Secret = Secret;
Expand Down
14 changes: 7 additions & 7 deletions dist/otpauth.node.min.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/otpauth.node.min.cjs.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions dist/otpauth.node.min.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/otpauth.node.min.mjs.map

Large diffs are not rendered by default.

44 changes: 6 additions & 38 deletions dist/otpauth.node.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @license otpauth 9.2.4 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
// @ts-nocheck
//! otpauth 9.3.0 | (c) Héctor Molinero Fernández | MIT | https://github.com/hectorm/otpauth
/// <reference types="./otpauth.d.ts" />
// @ts-nocheck
import * as crypto from 'node:crypto';

/**
Expand All @@ -20,20 +20,6 @@ import * as crypto from 'node:crypto';
return arr;
};

const hmac = undefined;

const sha1 = undefined;

const sha224 = undefined;
const sha256 = undefined;
const sha384 = undefined;
const sha512 = undefined;

const sha3_224 = undefined;
const sha3_256 = undefined;
const sha3_384 = undefined;
const sha3_512 = undefined;

/**
* "globalThis" ponyfill.
* @see [A horrifying globalThis polyfill in universal JavaScript](https://mathiasbynens.be/notes/globalthis)
Expand Down Expand Up @@ -63,20 +49,6 @@ const sha3_512 = undefined;
return undefined;
})();

/**
* OpenSSL-Noble hashes map.
* @type {Object.<string, sha1|sha224|sha256|sha384|sha512|sha3_224|sha3_256|sha3_384|sha3_512>}
*/ const OPENSSL_NOBLE_HASHES = {
SHA1: sha1,
SHA224: sha224,
SHA256: sha256,
SHA384: sha384,
SHA512: sha512,
"SHA3-224": sha3_224,
"SHA3-256": sha3_256,
"SHA3-384": sha3_384,
"SHA3-512": sha3_512
};
/**
* Calculates an HMAC digest.
* In Node.js, the command "openssl list -digest-algorithms" displays the available digest algorithms.
Expand All @@ -90,11 +62,7 @@ const sha3_512 = undefined;
hmac.update(globalScope.Buffer.from(message));
return hmac.digest();
} else {
const hash = OPENSSL_NOBLE_HASHES[algorithm.toUpperCase()];
if (typeof hash === "undefined") {
throw new TypeError("Unknown hash function");
}
return hmac(hash, key, message);
throw new Error("Missing HMAC function");
}
};

Expand Down Expand Up @@ -205,11 +173,11 @@ const sha3_512 = undefined;
/**
* TextEncoder instance.
* @type {TextEncoder|null}
*/ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder("utf-8") : null;
*/ const ENCODER = globalScope.TextEncoder ? new globalScope.TextEncoder() : null;
/**
* TextDecoder instance.
* @type {TextDecoder|null}
*/ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder("utf-8") : null;
*/ const DECODER = globalScope.TextDecoder ? new globalScope.TextDecoder() : null;
/**
* Converts an UTF-8 string to an Uint8Array.
* @param {string} str String.
Expand Down Expand Up @@ -810,6 +778,6 @@ const sha3_512 = undefined;
/**
* Library version.
* @type {string}
*/ const version = "9.2.4";
*/ const version = "9.3.0";

export { HOTP, Secret, TOTP, URI, version };
Loading

0 comments on commit b2057d8

Please sign in to comment.