auth0.jwt.fast-auth.near and on testnet at auth0.jwt.fast-auth.testnet.
It is the reference implementation of the JwtGuard trait and the default guard for the Auth0 provider. The JWT Guard Router routes verification requests to it under the guard name jwt#auth0.
The guard only verifies. It never holds keys or produces signatures. When verification succeeds it returns the JWT’s
sub claim, which the NEAR Auth contract uses to derive the per-user MPC signing path.What it verifies
Every call toverify runs the full JwtGuard pipeline, then layers Auth0-specific custom-claim checks on top. All of the following must pass, or verification fails:
RS256 signature
The JWT signature is verified with RSA PKCS#1 v1.5 (SHA-256) against the guard’s stored 2048-bit public keys.
Issuer (iss)
The token’s
iss claim must match the issuer argument passed by the caller.Expiry & not-before
exp must be in the future and nbf (if present) must already be in effect at the current block time.Audience (aud)
aud must contain the guard’s own account id — the account the contract is deployed to.Transaction binding (fatxn)
The custom
fatxn claim must be byte-for-byte equal to the sign_payload passed in.Size
The JWT is bounded (max 7 KB) before any parsing or cryptography runs.
The two custom claims
The baseJwtGuard trait handles the signature and the standard iss / exp / nbf claims. The Auth0 Guard adds its own verify_custom_claims step, which deserializes the JWT payload into this structure:
custom_claims.rs
aud may be a single string or an array of strings, so the guard accepts either form and looks for its own env::current_account_id() among them:
verify_custom_claims.rs
fatxn must equal the sign_payload. The fatxn claim is the encoded transaction or delegate-action payload the user authorized at login time. The guard requires it to match the sign_payload the caller is asking to sign, exactly:
verify_custom_claims.rs
verify_custom_claims returns success and the guard returns the token’s sub claim to the caller.
Methods
verify
The main entry point, called by the NEAR Auth contract or the JWT Guard Router during a signing flow. It is a read-only method (no state change) and runs the full verification pipeline described above.
| Parameter | Type | Description |
|---|---|---|
issuer | String | The expected JWT issuer, e.g. https://login.testnet.fast-auth.com/. Must equal the token’s iss claim. |
jwt | String | The full Auth0-issued JWT to verify. |
sign_payload | Vec<u8> | The encoded transaction payload; must equal the token’s fatxn claim. |
predecessor | AccountId | The original caller’s account id, forwarded through the routing chain. |
(bool, String) tuple: the boolean is true when the JWT is valid, and the string carries the sub claim on success or an error message ("audience mismatch", "Transaction payload mismatch", and so on) on failure.
set_public_keys
Replaces the guard’s stored RSA public keys. Auth0’s signing keys rotate, so the owner keeps the guard’s key set current; the same method is used for emergency rotation after a suspected key compromise.
JwtPublicKey.rs
Owner and lifecycle methods
Owner and lifecycle methods
The guard also exposes standard owner-management and upgrade methods, all owner-gated:
owner()— returns the current ownerAccountId.change_owner(new_owner)— transfers ownership; only the current owner may call it.update_contract()— deploys new contract code to the guard account and runs amigratestate migration.
init(owner, public_keys) sets the owner and validates every supplied public key before storing it.How it fits the signing flow
The guard is invoked in the middle of a NEAR Auth signature request — it is never called directly by the SDK.A JWT is minted with fatxn and aud
The user authenticates through the Auth0 provider, which embeds the encoded transaction in the
fatxn claim and sets aud to the target guard’s account id.The app calls FastAuth.sign
The frontend calls
sign(guard_id, jwt, sign_payload, algorithm) on the NEAR Auth contract with guard_id: "jwt#auth0".The router forwards to this guard
The JWT Guard Router resolves
jwt#auth0 to auth0.jwt.fast-auth.near (or .testnet) and calls verify.The guard verifies everything
RS256 signature,
iss, exp/nbf, aud contains this account, and fatxn == sign_payload. On success it returns the sub claim.Related
JWTs in NEAR Auth
How the token is structured, the
fatxn claim, and on-chain RS256 verification.The Auth0 provider
How Auth0 mints the JWT and sets the signing audience for this guard.
JWT Guard Router
The registry that maps
jwt#auth0 to this guard’s account.NEAR Auth contract
The entry point that calls into the guard during a signing flow.