LanguageValues and typesStandard typesSecurity
Jwk
On this page
A public key that a token is checked against, as an identity provider publishes it.
Use it with crypto.verify_jwt. To check other signatures with a raw Ed25519 key, use PublicKey.
Shape
| Field | Type | Required? |
|---|---|---|
kty |
Text |
Yes |
crv |
Text |
No |
x |
Text |
No |
y |
Text |
No |
n |
Text |
No |
e |
Text |
No |
kid |
Text |
No |
alg |
Text |
No |
use |
Text |
No |
key_ops |
Set<Text> |
No |
x5c |
List<Text> |
No |
Write every field when you build one, and give a field that isn't required as none.
Its parts keep these rules, and a value that breaks one fails with the rule's name:
parts_of_its_kty: anOKPkey hascrvEd25519andx, anRSAkeynande, and anECkeycrvP-256,xandy, and none another'salgorithm_of_its_kty: alg is EdDSA for anOKPkey, RS256 for anRSAkey and ES256 for anECkeya_usable_key: anRSAkey's modulus is 2,048 to 4,096 bits and odd, its exponent odd and from 3 to 2^32 - 1; anECkey's point is on P-256
Example
Jwk { kty: "OKP" crv: "Ed25519" x: "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo" y: none n: none e: none kid: none alg: none use: none key_ops: none x5c: none}
Good to know
ktydecides which of the other parts it needs:OKP,RSAorEC.==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"kty":"OKP","crv":"Ed25519","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo","kid":"2026-10","alg":"EdDSA","use":"sig"}{"kty":"OKP","crv":"Ed25519","x":"PUAXw-hDiVqStwqnTRt-vJyYLM8uxJaMwM1V8Sr0Zgw"}{"kty":"OKP","crv":"Ed25519","x":"PUAXw-hDiVqStwqnTRt-vJyYLM8uxJaMwM1V8Sr0Zgw","key_ops":["verify"]}
When you read one, a field that isn't required may be left out, or sent as null.
Details
Text form, storage, how it is shown, and operations
Jwk is in the group Security, and has been in Jadpo since 0.1.0.
Text form
It has no single text form, so text.from and text.parse don't take it.
How it is stored
It is stored in 11 columns, each named for the field, _ and its suffix. This is {"kty":"EC","crv":"P-256","x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4","y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM","kid":"1","use":"sig"}:
| Column | Type | Holds |
|---|---|---|
<field>_kty |
text |
'EC' |
<field>_crv |
text |
'P-256' |
<field>_x |
text |
'MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4' |
<field>_y |
text |
'4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM' |
<field>_n |
text |
NULL::text |
<field>_e |
text |
NULL::text |
<field>_kid |
text |
'1' |
<field>_alg |
text |
NULL::text |
<field>_use |
text |
'sig' |
<field>_key_ops |
text[] |
NULL::text[] |
<field>_x5c |
text[] |
NULL::text[] |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"kty":"OKP","crv":"Ed25519","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo","kid":"2026-10","alg":"EdDSA","use":"sig"} |
2026-10 |
{"kty":"OKP","crv":"Ed25519","x":"PUAXw-hDiVqStwqnTRt-vJyYLM8uxJaMwM1V8Sr0Zgw"} |
PUAXw-hDiVqStwqnTRt-vJyYLM8uxJaMwM1V8Sr0Zgw |
{"kty":"OKP","crv":"Ed25519","x":"PUAXw-hDiVqStwqnTRt-vJyYLM8uxJaMwM1V8Sr0Zgw","key_ops":["verify"]} |
PUAXw-hDiVqStwqnTRt-vJyYLM8uxJaMwM1V8Sr0Zgw |
{"kty":"EC","crv":"P-256","x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4","y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM","kid":"1","use":"sig"} |
1 |
{"kty":"RSA","n":"0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfA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Ma2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ |
Operations
crypto.verify_jwt(token: Jwt, keys: List<Jwk>, issuer: Text?, audience: Text?, as: Type?) -> JwtClaims: The registered claims oftokenonce it holds: signed by one ofkeyswith that key's own algorithm (Ed25519, RS256 for an RSA key, ES256 for a P-256 key), never the one the token names, sononeand every other algorithm failinvalid_signature; not expired, not used before itsnbfand not issued later than now, against the clock with 30 seconds' leeway (expired,not_yet_valid); issued byissuerwhen one is given (wrong_issuer); and foraudience, or for no audience when none is given (wrong_audience). A token that isn't one, or has noexp, ismalformed. Withas:, an object type of the application's, it gives instead the token's claims the type names, read asjson.readreads it, a registered one asJwtClaimsholds it, and failsmismatchwhen they aren't the type. It reads the clock, so it is called only in actions.
It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-jwk.md.Built from Jadpo main at aee2e8f.