— No reviews yet
0 installs
6 views
0.0% view→install
Install
$ agentstack add skill-lonsdale201-wp-agent-skills-br-single-use-token ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Are you the author of Br Single Use Token? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claimAbout
better-route: Single-use tokens
Use this when a token must be atomically consumed before a handler continues. Common examples: OAuth authorization codes, password reset tokens, magic links, invite tokens, and email confirmation tokens.
Pattern
use BetterRoute\Middleware\Write\SingleUseTokenMiddleware;
use BetterRoute\Middleware\Write\WpdbSingleUseTokenStore;
register_activation_hook(__FILE__, static function (): void {
(new WpdbSingleUseTokenStore())->installSchema();
});
$singleUse = new SingleUseTokenMiddleware(
store: new WpdbSingleUseTokenStore(),
tokenSource: static fn ($request): ?string => $request->get_param('code'),
hashSalt: MYAPP_SINGLE_USE_TOKEN_SALT,
ttlSeconds: 300
);
$router->post('/oauth/token', $handler)
->middleware([$singleUse])
->publicRoute();
Store a token before it is used:
$singleUse->storeToken($rawCode, [
'client_id' => $clientId,
'redirect_uri' => $redirectUri,
'subject' => $userId,
], ttlSeconds: 120);
Store choices
WpdbSingleUseTokenStore: production default when DB writes are acceptable; callinstallSchema()on activation.WpCacheSingleUseTokenStore: object-cache lock plus transient-backed record; useful when DB table migration is not desired.ArraySingleUseTokenStore: tests only.
Critical rules
- Never store raw token values. Use
storeToken()orhashToken()with a dedicated salt. - Use a salt dedicated to the token class or application; do not reuse OAuth client secrets as storage salts.
- Consume before issuing side effects. If consume returns null, fail closed.
- A reused token returns conflict semantics (
single_use_token_reused). - Unknown or expired tokens fail as invalid.
- Keep TTL short for auth codes; use longer TTL only for flows such as password reset where product requirements demand it.
Cross-references
- Use
br-atomic-idempotencyfor retry-safe side-effectful writes; that is different from one-time token consumption. - Use
br-cryptofor generating the raw one-time token. - Use
br-error-contractfor401 invalid_single_use_tokenand409 single_use_token_reused.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: Lonsdale201
- Source: Lonsdale201/wp-agent-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.