Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Secure Token Generator

security.generate_secure_token

ProductionBounded custom (Class B)best-effortinstantv1.0.0
No network

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

Note
Draws 16-64 random bytes from SecureRandom, encodes them as base64url, hex, base32, or alphanumeric, applies an optional prefix, and reports the entropy width in bits.

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

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

generationrandomness

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input4 KB

How we handle your data

Sensitive output possible
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
bytesintegerNoEntropy bytes; omit it for 32.
encodingstringNoToken alphabet; omit it for base64url.
prefixstringNoVisible credential prefix joined with an underscore; omit it for a bare random token.

Output schema

FieldTypeRequiredDescription
tokenstringYesGenerated prefixed or bare token.
encodingstringYesApplied random-part alphabet.
bytesintegerYesEntropy width in bytes actually drawn.
entropyBitsintegerYesEntropy width in bits.
tokenLengthintegerYesComplete token character count.
prefixedbooleanYesWhether a prefix was applied.

API contract

POST /v1/execute
curl
curl -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"}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
TOKEN_ENCODING_UNSUPPORTED400NoThe skill does not support the requested variant.
TOKEN_PREFIX_INVALID400NoThe request payload failed this skill's input validation.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "skillKey": "security.generate_secure_token",
  "input": {
    "bytes": 32
  }
}

Examples

Default 32-byte base64url token

Inputjson
{
  "bytes": 32
}
Expected outputjson
{
  "prefixed": false,
  "encoding": "base64url",
  "entropyBits": 256,
  "tokenLength": 43,
  "bytes": 32,
  "token": "3Yx1kQpZ9mHrTdVbN2sLwEgAjCfUoIeXvBnMk4tQzR0"
}
Tip
32 bytes in base64url is 43 characters; yours will be a different value every call

Prefixed hex token

Inputjson
{
  "bytes": 16,
  "encoding": "hex",
  "prefix": "sk_live"
}
Expected outputjson
{
  "prefixed": true,
  "encoding": "hex",
  "entropyBits": 128,
  "tokenLength": 40,
  "bytes": 16,
  "token": "sk_live_9f2c41ab7d0e5836b1c4a97e2d5f0813"
}
Tip
The prefix is joined with '_' and is not part of the random material
  • 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)

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.

Tags

cryptographysecurityentropygeneration