Secure Token Generator
security.generate_secure_token
Overview
You choose the entropy width, alphabet, and optional prefix; we draw 16-64 cryptographically random bytes from SecureRandom, encode them as base64url (default), hex, base32, or alphanumeric, and report entropyBits so token strength is explicit. We never store or log the token. Do not use this when any random string will do (use platform.entropy_token) or when you need a UUID or password hash.
An LLM cannot produce randomness, and a token it invents is predictable however random it looks. Hand-rolled encoders also tend to reach for 'random byte % alphabet length', which skews the distribution and silently weakens every token issued.
Reliability
BEST_EFFORT and non-deterministic by design — repeated calls return different tokens. Every byte comes from the JVM's SecureRandom, and the alphanumeric alphabet uses rejection sampling rather than a modulo, so entropyBits is a floor on real randomness and never an overstatement. We do not store the token, so a lost value cannot be recovered. TOKEN_ENCODING_UNSUPPORTED — trigger: encoding was something other than base64url, hex, base32 or alphanumeric; retryable: no; next: pick one of the four and call again. TOKEN_PREFIX_INVALID — trigger: the prefix contained a character outside A-Z, a-z, 0-9, underscore and hyphen, or ran past 16 characters; retryable: no; next: shorten it or drop the offending characters. Input validation (not retryable): bytes outside 16 to 64, or a prefix longer than the accepted bound.
Context footprint
One call replaces a task an agent cannot perform at all, and returns the token plus the few fields needed to record its strength. A successful call costs 1 execution credit.
When to use it
When a credential must fit a specific alphabet, carry an environment prefix, or come with a stated entropy width.
When any random string will do — platform.entropy_token is the leaner primitive. When you need a UUID, a password hash, or a key derived from a passphrase.
Scope
Non-goals
- Does not store, register, or track the token — the platform never sees it again
- Does not hash or sign the token
- Does not generate human-memorable passwords or passphrases
- Does not generate UUIDs (use platform.uuid_v4 or platform.uuid_namespace_id)
- Does not derive a key from a password (not a KDF)
- Does not issue platform API keys — those come from the key-management surface
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| bytes | integer | No | Entropy bytes; omit it for 32. |
| encoding | string | No | Token alphabet; omit it for base64url. |
| prefix | string | No | Visible credential prefix joined with an underscore; omit it for a bare random token. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| token | string | Yes | Generated prefixed or bare token. |
| encoding | string | Yes | Applied random-part alphabet. |
| bytes | integer | Yes | Entropy width in bytes actually drawn. |
| entropyBits | integer | Yes | Entropy width in bits. |
| tokenLength | integer | Yes | Complete token character count. |
| prefixed | boolean | Yes | Whether a prefix was applied. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"security.generate_secure_token","input":{"bytes":32,"encoding":"hex","prefix":"sk_live"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("security.generate_secure_token", {"bytes":32});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| TOKEN_ENCODING_UNSUPPORTED | 400 | No | The skill does not support the requested variant. |
| TOKEN_PREFIX_INVALID | 400 | No | The request payload failed this skill's input validation. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not store, register, or track the token — the platform never sees it again
- Does not hash or sign the token
- Does not generate human-memorable passwords or passphrases
- Does not generate UUIDs (use platform.uuid_v4 or platform.uuid_namespace_id)
- Does not derive a key from a password (not a KDF)
- Does not issue platform API keys — those come from the key-management surface
- Any random string with no format requirement (use platform.entropy_token)
- Generating a UUID (use platform.uuid_v4)
- Producing a human-memorable password
- Deriving a key from a password (use a KDF, not a random draw)
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "security.generate_secure_token",
"input": {
"bytes": 32
}
}Examples
Default 32-byte base64url token
{
"bytes": 32
}{
"prefixed": false,
"encoding": "base64url",
"entropyBits": 256,
"tokenLength": 43,
"bytes": 32,
"token": "3Yx1kQpZ9mHrTdVbN2sLwEgAjCfUoIeXvBnMk4tQzR0"
}Prefixed hex token
{
"bytes": 16,
"encoding": "hex",
"prefix": "sk_live"
}{
"prefixed": true,
"encoding": "hex",
"entropyBits": 128,
"tokenLength": 40,
"bytes": 16,
"token": "sk_live_9f2c41ab7d0e5836b1c4a97e2d5f0813"
}Recommended use cases
- Mint an API key for a tenant's own downstream service in a required alphabet
- Generate a case-insensitive base32 code safe to read aloud or type
- Create a hex token for a system that rejects '-' and '_'
- Produce a prefixed credential such as 'sk_live_...' so its environment is visible in logs
Avoid for
- Any random string with no format requirement (use platform.entropy_token)
- Generating a UUID (use platform.uuid_v4)
- Producing a human-memorable password
- Deriving a key from a password (use a KDF, not a random draw)
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.