Overview
VerifyGrantToken verifies a grant token JWT locally using the Grantex JWKS endpoint. This avoids an API call per request and is ideal for high-throughput services.
Options
| Field | Type | Required | Description |
|---|---|---|---|
JwksURI | string | Yes | URL to fetch the JWKS from |
RequiredScopes | []string | No | Scopes the token must contain |
Audience | string | No | Expected aud claim |
ClockTolerance | time.Duration | No | Tolerance for clock skew |
Response (VerifiedGrant)
| Field | Type | Description |
|---|---|---|
TokenID | string | JWT jti claim |
GrantID | string | Grant ID (grnt claim, falls back to jti) |
PrincipalID | string | End-user (sub claim) |
AgentDID | string | Agent DID (agt claim) |
DeveloperID | string | Developer (dev claim) |
Scopes | []string | Granted scopes (scp claim) |
IssuedAt | int64 | Unix timestamp |
ExpiresAt | int64 | Unix timestamp |
ParentAgentDID | *string | Parent agent for delegated grants |
ParentGrantID | *string | Parent grant for delegated grants |
DelegationDepth | *int | Delegation depth (0 = root) |
Scope Checking
Error Handling
Returns*grantex.TokenError for:
- Missing or invalid JWKS URI
- Expired tokens
- Invalid signatures
- Missing required scopes
- Malformed JWTs