Skip to content

Commit

Permalink
v0.31.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt committed Nov 4, 2023
1 parent bdb087c commit 617ac4d
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 128 deletions.
6 changes: 3 additions & 3 deletions argon2.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export const defaults: Options;
export const limits: OptionLimits;
export function hash(
plain: Buffer | string,
options: Options & { raw: true }
options: Options & { raw: true },
): Promise<Buffer>;
export function hash(
plain: Buffer | string,
options?: Options & { raw?: false }
options?: Options & { raw?: false },
): Promise<string>;
export function verify(
hash: string,
plain: Buffer | string,
options?: Options
options?: Options,
): Promise<boolean>;
export function needsRehash(hash: string, options?: Options): boolean;
4 changes: 2 additions & 2 deletions argon2.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const assertLimits =
const value = options[key];
assert(
min <= value && value <= max,
`Invalid ${key}, must be between ${min} and ${max}.`
`Invalid ${key}, must be between ${min} and ${max}.`,
);
};

Expand Down Expand Up @@ -114,7 +114,7 @@ const verify = async (digest, plain, options) => {
parallelism: +p,
...(data ? { associatedData: Buffer.from(data, "base64") } : {}),
}),
hash
hash,
);
};

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "argon2",
"version": "0.31.1",
"version": "0.31.2",
"description": "An Argon2 library for Node",
"main": "argon2.js",
"files": [
Expand Down Expand Up @@ -51,10 +51,10 @@
"node-addon-api": "^7.0.0"
},
"devDependencies": {
"@types/node": "^20.4.6",
"@types/node": "^20.8.10",
"c8": "^8.0.1",
"mocha": "^10.2.0",
"node-gyp": "^9.4.0",
"node-gyp": "^10.0.1",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
},
Expand Down
10 changes: 5 additions & 5 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ const hashes = Object.freeze({
"$argon2d$v=19$m=65536,t=3,p=4$c2FsdHNhbHRzYWx0c2FsdA$VtxJNl5Jr/yZ2UIhvfvL4sGPdDQyGCcy45Cs7rIdFq8",
rawArgon2id: Buffer.from(
"ac15942c3e63386a50cb7dab2ef19c9af40c56a2153409ab0ad7a45af500f1bc",
"hex"
"hex",
),
rawWithNull: Buffer.from(
"36a7210cec7059b701cc0fb482db02b72b29110c6a2857f8fcf3bf02822fa3e4",
"hex"
"hex",
),
rawArgon2i: Buffer.from(
"d42726a7b1026fe45be573e3a91c04b808c2b9f635c500ce2709c7ac1fa8ad9e",
"hex"
"hex",
),
rawArgon2d: Buffer.from(
"56dc49365e49affc99d94221bdfbcbe2c18f743432182732e390aceeb21d16af",
"hex"
"hex",
),
oldFormat:
"$argon2i$m=4096,t=3,p=1$tbagT6b1YH33niCo9lVzuA$htv/k+OqWk1V9zD9k5DOBi2kcfcZ6Xu3tWmwEPV3/nc",
Expand Down Expand Up @@ -235,7 +235,7 @@ describe("Argon2", () => {
});
assert(argon2.needsRehash(hash));
assert(
!argon2.needsRehash(hash, { memoryCost: defaults.memoryCost / 2 })
!argon2.needsRehash(hash, { memoryCost: defaults.memoryCost / 2 }),
);
});

Expand Down
Loading

0 comments on commit 617ac4d

Please sign in to comment.