Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifying secret #63

Closed
AltFreq07 opened this issue May 31, 2021 · 1 comment
Closed

Verifying secret #63

AltFreq07 opened this issue May 31, 2021 · 1 comment

Comments

@AltFreq07
Copy link

AltFreq07 commented May 31, 2021

How do I go about using the optional secret data?

The below code works fine for creating the hash, with changing the encodedSecret resulting in a different hash

      const enc = new TextEncoder()
      const encodedSecret = enc.encode(secret)
return argon2.hash({
            pass: inputPassword,
            salt: inputSalt
            time: 1, // the number of iterations
            mem: 128000, // used memory, in KiB
            hashLen: 32, // desired hash length
            parallelism: 1, // desired parallelism (will be computed in parallel only for PNaCl)
            secret: encodedSecret, // optional secret data
            type: argon2.ArgonType.Argon2id, // or argon2.ArgonType.Argon2i or argon2.ArgonType.Argon2id
          })

I can not seem to verify with a secret though and cant find examples.

    const enc = new TextEncoder()
      const encodedSecret = enc.encode(secret)
      return argon2.verify({
        pass: inputPassword,
        encoded: encodedHash,
        secret: encodedSecret,
      })

Seems if I remove the secret from the hash function the verify will work even with the secret argument set which leads me to believe secret is either not implemented or called something other than secret in the verify function.

@antelle
Copy link
Owner

antelle commented May 31, 2021

Thanks! Added secret: https://github.com/antelle/argon2-browser/blob/master/test/suite/verify.js#L130-L137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants