ENGINEERING LAB / EXECUTABLE EVIDENCE
See the logic.
Run the decisions.
Four self-contained examples adapted from real project policies. Change the input, run the logic, and inspect the outcome. No live accounts, external services or private records are used.
19Reproducible scenariosDownload the same example code and tests to run locally.
Permission-scoped access
Evaluate a read-only request against a consent grant. The real implementation also validates token binding, expiration and PKCE during authorization.
01 / Sample input
{
"grant": {
"status": "active",
"expiresAt": 1796213700000,
"scopes": [
"shows:read"
],
"showIds": [
"demo-show"
]
},
"request": {
"operation": "read",
"scope": "shows:read",
"showId": "demo-show"
},
"now": 1796212800000
}02 / Computed result
Run the example to see the computed result.
Inspect the executable JavaScript
export function authorizeRead({grant,request,now}) {
if (!grant || grant.status !== "active" || !Number.isFinite(now) ||
!Number.isFinite(grant.expiresAt) || grant.expiresAt <= now)
return {allowed:false,reason:"Grant inactive or expired"};
if (request.operation !== "read")
return {allowed:false,reason:"Read-only integration"};
if (!Array.isArray(grant.scopes) || !grant.scopes.includes(request.scope))
return {allowed:false,reason:"Scope not authorized"};
if (!Array.isArray(grant.showIds) || !grant.showIds.includes(request.showId))
return {allowed:false,reason:"Show not authorized"};
return {allowed:true,reason:"Authorized read"};
}