Skip to content

Commit

Permalink
0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ovx committed May 12, 2024
1 parent e0f866b commit c1f2b98
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cjs/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ async function createChallenge(options) {
params.set('expires', String(Math.floor(options.expires.getTime() / 1000)));
}
let salt = options.salt || (0, helpers_js_1.ab2hex)((0, helpers_js_1.randomBytes)(saltLength));
if (params.size) {
// params.size doesn't work with Node 16
if (Object.keys(Object.fromEntries(params)).length) {
salt = salt + '?' + params.toString();
}
const number = options.number === void 0 ? (0, helpers_js_1.randomInt)(maxnumber) : options.number;
Expand Down
3 changes: 2 additions & 1 deletion deno_dist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export async function createChallenge(
params.set('expires', String(Math.floor(options.expires.getTime() / 1000)));
}
let salt = options.salt || ab2hex(randomBytes(saltLength));
if (params.size) {
// params.size doesn't work with Node 16
if (Object.keys(Object.fromEntries(params)).length) {
salt = salt + '?' + params.toString();
}
const number =
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export async function createChallenge(options) {
params.set('expires', String(Math.floor(options.expires.getTime() / 1000)));
}
let salt = options.salt || ab2hex(randomBytes(saltLength));
if (params.size) {
// params.size doesn't work with Node 16
if (Object.keys(Object.fromEntries(params)).length) {
salt = salt + '?' + params.toString();
}
const number = options.number === void 0 ? randomInt(maxnumber) : options.number;
Expand Down
3 changes: 2 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export async function createChallenge(
params.set('expires', String(Math.floor(options.expires.getTime() / 1000)));
}
let salt = options.salt || ab2hex(randomBytes(saltLength));
if (params.size) {
// params.size doesn't work with Node 16
if (Object.keys(Object.fromEntries(params)).length) {
salt = salt + '?' + params.toString();
}
const number =
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "altcha-lib",
"version": "0.2.1",
"version": "0.3.0",
"description": "A library for creating and verifying ALTCHA challenges for Node.js, Bun and Deno.",
"author": "Daniel Regeci",
"license": "MIT",
Expand Down

0 comments on commit c1f2b98

Please sign in to comment.