Replies: 4 comments
|
bump, need this for sign in with apple server side validation |
0 replies
|
I'd like this, too. Surprised it wasn't added in the beginning. |
0 replies
|
any update on this? |
0 replies
|
This is supported in Hono 4.13.13. import { sign } from 'hono/jwt'
const privateJwk = await crypto.subtle.exportKey('jwk', privateKey)
privateJwk.alg = 'RS256'
privateJwk.kid = 'key-1'
const token = await sign({ sub: 'user-123' }, privateJwk, 'RS256')I ran this with an RSA key pair on |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Currently the header of jwt sign is fixed, and consist of { alg, typ: 'JWT' }
hono/src/utils/jwt/jwt.ts
Line 53 in f9a23a9
To support adding kid in the header during signing, I’ve had to copy all the helper functions from Hono’s JWT sign functionality, allowing me to set kid in the header manually. This approach is definitely not super clean and duplicating codes:
https://github.com/ValueMelody/melody-auth/blob/main/server/src/services/jwt.ts#L52
Since including kid in the JWT header is a common practice when signing tokens with RS256, I’m wondering if there are any plans to officially support it directly in Hono’s JWT sign function.
All reactions