jwtSecretKey function
Builds a symmetric JsonWebKey from a plain-text secret.
The secret is UTF-8 encoded and then base64url-encoded to produce
a JWK with key type 'oct', suitable for HMAC-based algorithms
such as HS256.
final key = jwtSecretKey('my-secret');
Implementation
JsonWebKey jwtSecretKey(String secret) {
return JsonWebKey.fromJson({
'kty': 'oct',
'k': base64UrlEncode(utf8.encode(secret)),
});
}