Create key from string
Closed this issue · 4 comments
david-plugge commented
Is there a way to create a key from a random string for signing and verifying jwts using oslo?
If not, how to do it?
My goal is to be able to specify a secret as an env variable that is used for handling jwts.
david-plugge commented
It was too early in the morning...
practicatto commented
@david-plugge did you solve this? how did you that?
david-plugge commented
Simply use TextEncoder
const JWT_KEY = new TextEncoder().encode(env.MAGIC_LINK_TOKEN_SECRET);
await createJWT(
algorithm,
JWT_KEY,
{},
{
subject: email,
expiresIn: new TimeSpan(10, 'm')
}
);
practicatto commented
Yes silly me, thanks :)