Replies: 1 comment
-
|
@rwieruch your migration looks almost right, just a couple of small things to fix:
import { sha256 } from '@oslojs/crypto/sha2';
import { encodeHexLowerCase } from '@oslojs/encoding';
// generating the token:
const tokenId = encodeBase32LowerCaseNoPadding(crypto.getRandomValues(new Uint8Array(20)));
// hashing for storage (no await needed):
const tokenHash = encodeHexLowerCase(sha256(new TextEncoder().encode(tokenId)));
the overall pattern (hash the token, store the hash, send the raw tokenId in the link, re-hash on verification) is correct. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The old documentation, if I recall correctly, had the following implementation for creating a password reset token:
If I only want to use Oslo, would this translate to the following?
Perhaps I should also replace
encodeHexwithencodeHexLowerCaseas it is shown for the session token in the new Lucia docs, correct?And then I would store the token in my DB for later usage (as before) and generate the passwordResetLink with the tokenId (as before):
Would this be correct?
Beta Was this translation helpful? Give feedback.
All reactions