fix(server): edge case where nonce validation might fail when nonce is 0

This commit is contained in:
Tiago
2025-08-27 11:54:16 +01:00
parent 32eb43184c
commit 5cd76cd117
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -288,7 +288,7 @@ class Cap extends EventEmitter {
const isValid = challenges.every(([salt, target], i) => {
return (
solutions[i] &&
typeof solutions[i] === "number" &&
crypto
.createHash("sha256")
.update(salt + solutions[i])
@@ -402,6 +402,8 @@ class Cap extends EventEmitter {
* @returns {Promise<void>}
*/
async _loadTokens() {
if (this.config.noFSState || this.config.storage?.tokens) return;
try {
const dirPath = this.config.tokens_store_path
.split("/")
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@cap.js/server",
"version": "3.0.0",
"version": "3.0.1",
"author": "Tiago",
"repository": {
"type": "git",