Skip to content

About

No description, website, or topics provided.

Resources

Stars

26 stars

Watchers

2 watching

Forks

Latest commit

 

History

1,572 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyCloud Protocol header

TinyCloud Node

TinyCloud Node is the server component of the TinyCloud Protocol — a framework for creating interoperable software applications where users retain full sovereignty over their data. It provides a decentralized or user-controlled "cloud" that can serve as the backend for multiple apps, allowing users to maintain control over their data without ceding ownership or privacy to third parties.

TinyCloud Node hosts user data spaces, processes delegations, and serves the KV storage API. It is a descendant of Kepler and is architected as a decentralized storage system that uses DIDs and Authorization Capabilities to define TinyCloud Spaces, where your data lives and who has access.

Access control is not encryption. The node does not yet encrypt ordinary KV or SQL values itself, so whoever operates a node can read them unless the application encrypts them first; docs/at-rest/INTERFACES.md tracks the at-rest work. A wallet you run keeps its signing key with you; OpenKey holds and uses its keys in its own service. See Security and trust for key custody, application encryption and authorized-client boundaries.

Protocol Version

TinyCloud Node v1.0.0 introduces a protocol version system for SDK-node compatibility. The node exposes a public /version endpoint:

GET /version
{
  "protocol": 1,
  "version": "1.0.0",
  "features": ["kv", "delegation", "sharing"]
}

The SDK checks this endpoint during sign-in and requires an exact protocol version match. This ensures clients and servers are always running compatible versions.

API Endpoints

Method Endpoint Auth Description
GET /version No Protocol version and feature discovery
POST /invoke Yes Execute KV/SQL/DuckDB operations or read storage usage
POST /signed/kv Yes Create an expiring signed URL for an exact KV object read
GET /signed/kv/<ticketId> Signed URL ticket Fetch a KV object, including single byte ranges
POST /delegate Yes Create capability delegations
POST /session/retire Session-key UCAN Sign out: retire the session key that signed the request
GET /peer/generate/<space> No Generate space host key pair
GET /healthz No Health check
GET /admin/stats NODE_STATS_READ_TOKEN bearer Distinct owner addresses that hold data beyond automatic sign-in records and vault metadata (read-only; disabled unless the token is set, at least 32 bytes)

Storage usage and full-space writes

Send POST /invoke with a normal signed invocation granting tinycloud.space/info on the target space's space service, for example tinycloud:pkh:eip155:1:<address>:<space>/space. The body may be {}. The target comes from the signed resource, not the body; all capabilities in this invocation must be space/info for the same space. Normal delegation, expiry, revocation and replay checks apply. No admin credential is needed.

The 200 application/json response is:

{
  "space": {"usedBytes": 123, "limitBytes": 456},
  "account": {"usedBytes": 789, "limitBytes": 1000, "plan": "free"},
  "manageUrl": "https://account.tinycloud.xyz/storage"
}

All sizes are bytes. space.limitBytes is null when unlimited; empty spaces report zero usage. account is omitted unless billing supplied both account totals in a non-degraded answer. plan is omitted when older billing omits it. Account numbers use the quota cache's existing stale-while-revalidate policy. Clients must explicitly request tinycloud.space/info in their session authority; existing SDK default sessions do not include it. The node does not expand existing grants.

Storage rejections use application/json with error, message, space, and the same optional account object. HTTP 402 uses "error":"storage_quota_exceeded" and preserves the message Storage quota exceeded. Used: X bytes, Limit: Y bytes. HTTP 413 uses "error":"storage_limit_reached" and preserves Write exceeds remaining storage. Used: X bytes, Limit: Y bytes. Other 413 errors, such as oversized query responses, are not storage errors. Delegated authority is rechecked against the current time after quota fetching or upload staging delays a storage rejection. Expired authority receives 403 without space or account totals.

Reads remain available on full spaces. SQLite writes run in a savepoint: page growth or a failed request rolls back all its mutations. Caller transaction control is forbidden, including extra statements hidden after a PRAGMA. Deletes, drops, no-op schema initialization and writes that reuse existing pages can succeed. Guarded SQLite and DuckDB writes replace the durable checkpoint without accumulating WAL charges, but are refused if the serialized checkpoint would exceed the existing artifact's charged size. No-ops against absent databases do not create charged artifacts. DuckDB uses a conservative transactional guard for deletes, drops and existing IF NOT EXISTS objects; other writes remain refused while full. Deletion need not shrink the physical database immediately. Below the limit, the existing database one-write overshoot policy is unchanged.

Exports do not persist checkpoints or change storage charges. Both engines return DatabaseNotFound when no durable artifact exists, even if a query created a temporary actor. Rejected guarded requests close absent-database actors. DuckDB exports replay durable WAL in a disposable copy, leaving the live actor's WAL base unchanged for subsequent writes.

Set TINYCLOUD_QUOTA_URL to billing's base URL. The node fetches GET /api/quota/<space> with Authorization: Bearer <TINYCLOUD_ADMIN_SECRET> when that shared service secret is configured. The same secret protects /admin/quota; never expose it to browser clients. Old billing responses containing only storage_limit_bytes remain supported. Local testing can set an in-memory limit with authenticated PUT /admin/quota/<space> and {"limit_bytes":1}; overrides reset on restart.

The billing request percent-encodes the original space ID as one path segment; the quota/cache key itself is unchanged. The client never follows redirects, so the service bearer is sent only on the configured billing request. A 3xx answer uses the existing quota fallback policy, with the existing 3-second total and 2-second connect deadlines.

Admin stats (GET /admin/stats)

Read-only list of the wallet addresses that hold data on this node, for the scoreboard's protocol-user count (TC-1482). It is disabled (answers 404, exactly like an unknown route) unless NODE_STATS_READ_TOKEN is set to a value of at least 32 bytes that differs from TINYCLOUD_ADMIN_SECRET. Send it as Authorization: Bearer <NODE_STATS_READ_TOKEN>; a missing or wrong credential is a bare 401. The token is separate from the admin secret: the admin secret does not open this route and this token opens no other /admin/* route. Use a random value of at least 32 bytes (a shorter value disables the route; use openssl rand -hex 32, 64 hex characters), kept in the secret store; the node never logs it or any address.

{ "owners": ["0x…", "0x…"], "count": 2, "generatedAt": "2026-10-19T12:00:00Z" }
  • What is counted (the complete rule).

    • Counts: an owner holding live (deleted = false) KV in any space except account, or a SQL/DuckDB database artifact in any space except account and secrets, except KV in the public space whose key starts with .well-known/vault- (vault metadata).
    • Excluded (automatic sign-in records, not use of the node): the account space entirely (its KV and its databases); the secrets table that OpenKey's bootstrap creates (database artifacts in secrets; KV stored in secrets still counts); and the vault metadata that vault.unlock() writes (.well-known/vault-pubkey, .well-known/vault-version, .well-known/vault-space in public). An app may unlock the vault automatically, so counting those rows would inflate "users with data" the same way the secrets table did.
    • App first-use data counts. A database an app creates on first use (for example listen's conversations database or feed-learn's tables) is a person actually using an app that stores on TinyCloud. Artifact rows are never deleted, so a database that was created and later emptied or dropped still counts.

    The space match is on the exact space name (the last :-separated segment of the space id), so secrets2, my-account, Secrets or Account are ordinary spaces. The vault exclusion is exactly the public space and keys that start with .well-known/vault- (case-sensitive, starts-with): other .well-known/* keys (including .well-known/vault), any other KV in public, and the same prefix in any other space all count, and a public space with at least one live KV row that is not vault metadata makes its owner count. An owner who only signed in, or only signed in and unlocked the vault, is therefore not listed. This is stricter than "spaces with usage_bytes > 0" (/admin/usage), which counts the account space's bytes.

  • Owner. Parsed from tinycloud:pkh:eip155:<chain>:0x<address>:<name>, lowercased and de-duplicated across spaces and chains. Spaces whose owner is not an eip155 address (a did:key owner) are skipped. owners is sorted.

  • Cost. One SQL statement (one round trip) however many spaces exist; no per-space store_size call. For each space it makes one primary-key probe of current_kv, plus one pass over database_artifact's space column. The cost grows with the number of space rows (about six per bootstrapped account), not only with listed owners: 4.35 s warm on a local PostgreSQL 14 with 300,000 spaces and 1.5 million keys (measured before the vault-metadata condition, which adds one prefix comparison per current_kv row a probe reads; in a public space that is at most the vault rows before the first other live row). Re-measure before the node holds several times that many spaces; the consumer gives up after 15 s.

  • Bound, never a partial list. The consumer makes no partial use of a response, so the route never answers a shorter list with 200. More than 200,000 owners (or more than 400,000 distinct counted spaces, which bounds memory; spaces that do not count are not included) is a bare 507. Every entry is exactly 0x followed by 40 lowercase hex digits; a space whose owner is not such an eip155 address is left out.

  • Nothing else about spaces, keys, sizes or timing is returned, and the response is Cache-Control: no-store.

Signed KV URLs

POST /signed/kv accepts a normal TinyCloud invocation whose authorized capabilities include a tinycloud.kv/get capability that can be attenuated to the requested {space, path}. The invocation may include other capabilities. The JSON body is:

{
  "space": "tinycloud:...",
  "path": "transcripts/audio.wav",
  "ttlSeconds": 60
}

The response includes a short relative url, opaque ticketId, and RFC3339 expiresAt:

{
  "url": "/signed/kv/JUWkXuA4mqnxDVXcaxXoVME8uYUTumgmuwbllQFxHnQ",
  "ticketId": "JUWkXuA4mqnxDVXcaxXoVME8uYUTumgmuwbllQFxHnQ",
  "expiresAt": "2026-05-12T16:25:00Z"
}

The node stores the ticket durably in its database with the exact KV scope, issuer/subject DID, ability, service, creation and expiry timestamps, content hash/ETag binding, parent expiry metadata, and proof metadata. If the request omits contentHash and etag, the node binds the ticket to the current object hash. The bearer URL does not contain the space, path, or signed claims. Reads load the ticket, validate expiry and scope, then perform a private KV read; signed KV URLs are not limited to public spaces.

Ticket expiry is the earliest of the requested TTL, node maximum TTL, invocation expiry, and parent delegation expiry when known. maxUses is rejected in v1 because limited-use URLs need durable counters and replay protection to stay correct across restarts and multi-node deployments.

Signed KV reads support one standard HTTP byte range at a time:

GET /signed/kv/JUWkXuA4mqnxDVXcaxXoVME8uYUTumgmuwbllQFxHnQ
Range: bytes=1048576-2097151
If-Range: "blake3-<64 hex characters>"

A satisfiable range returns 206 Partial Content with Accept-Ranges: bytes, Content-Range, Content-Length, and the strong TinyCloud ETag. An out-of-bounds range returns 416 Range Not Satisfiable. If If-Range does not match, the node returns the full object. Filesystem reads seek to the requested offset and S3 reads use an object-store range request, so the node does not read or proxy the omitted bytes.

With telemetry enabled, backend time-to-first-byte is recorded under the server.signed_kv.kv_get_range span. tinycloud_signed_kv_bytes_total{measure="object"} and {measure="served"} expose the transfer reduction from range reads.

Quickstart

For a self-hosted HTTPS deployment with persistent data, unique identity, backup/restore, and a verified upgrade path, follow the personal-node guide. The source-checkout example below is for local development only. It deliberately requires a unique key: the shipped configuration no longer contains a usable key.

Install Rustup; rust-toolchain.toml selects Rust 1.97.1. Provision a private key file once and retain it across restarts:

umask 077
mkdir -p data/blocks
openssl rand -base64 48 | tr '+/' '-_' | tr -d '=\n' > node.key
TINYCLOUD_KEYS__SECRET="$(cat node.key)" cargo run

Keep node.key out of git, back it up separately from the data directory, and do not replace it during an upgrade: derived node identities and sealed data depend on it. TINYCLOUD_KEYS__TYPE=Dstack remains an explicit alternative only for a properly configured dstack TEE.

For an existing node, do not generate a new root during upgrade. Recover the installation's original key from its private backup or its existing operator configuration, provide that same root explicitly, and compare the public node identity and encrypted/sealed data before accepting the upgrade. If the original root is unavailable, stop: a replacement is a different node identity and does not recover data sealed under the prior root. Changing the identity also invalidates trust bindings that refer to its DID or public keys.

Configuration

TinyCloud Protocol instances are configured by the tinycloud.toml configuration file, or via environment variables. You can either modify them in this file, or specify them through environment variable using the prefix TINYCLOUD_.

The following common options are available:

Option env var description
log_level TINYCLOUD_LOG_LEVEL Default log verbosity: "off", "critical" (warnings and errors), "normal" (info) or "debug". Used when RUST_LOG is unset. Request URIs are never logged at any level; each request is logged once by route template, status and latency
(n/a) RUST_LOG Override the log verbosity with a tracing EnvFilter, e.g. debug or tinycloud=debug
address TINYCLOUD_ADDRESS Set the listening address of the TinyCloud Protocol instance
port TINYCLOUD_PORT Set the listening TCP port for the TinyCloud Protocol instance
storage.blocks.type TINYCLOUD_STORAGE_BLOCKS_TYPE Set the mode of block storage, options are "Local" and "S3"
storage.limit TINYCLOUD_STORAGE_LIMIT Set a maximum limit on storage available to Spaces hosted on this instance. Limits are written as strings, e.g. 10 MiB, 100 GiB
storage.database TINYCLOUD_STORAGE_DATABASE Set the location of the SQL database
storage.staging TINYCLOUD_STORAGE_STAGING Set the mode of content staging, options are "Memory" and "FileSystem"
keys.type TINYCLOUD_KEYS_TYPE Set the type of host key store, options are "Static"
spaces.allowlist TINYCLOUD_SPACES_ALLOWLIST Set the URL of an allowlist service for gating the creation of Space Peers
session_retire.ttl_secs TINYCLOUD_SESSION_RETIRE__TTL_SECS Minimum seconds a /session/retire is kept; default 2592000 (30 days); 0 refuses to start. A retire also lasts until the latest-expiring delegation, renewal stamp or active renewal lease the node holds for the key ends (forever for a delegation without an expiry).
session_retire.rate_limit_per_minute TINYCLOUD_SESSION_RETIRE__RATE_LIMIT_PER_MINUTE /session/retire requests allowed per client IP per minute; default 10. Over it answers 429.
spaces.registry_v2 TINYCLOUD_SPACES__REGISTRY_V2 Optional signed registry v2 origin for current per-space hosting authorization and read/write mode
spaces.registry_cache_max_age_seconds TINYCLOUD_SPACES__REGISTRY_CACHE_MAX_AGE_SECONDS Seconds the last confirmed registry record keeps admitting reads and writes during a registry outage; 0 (default) turns it off, at most 300, requires registry_v2
telemetry.enabled TINYCLOUD_TELEMETRY__ENABLED Enable Prometheus latency metrics on the configured Prometheus port
column_encryption.strict TINYCLOUD_COLUMN_ENCRYPTION__STRICT Require authenticated envelopes for recorded legacy columns; default false. Recorded v2 columns always require v2.
(n/a) ROCKET_MAX_BLOCKING Set Rocket's blocking-thread-pool cap (default 512). Note the ROCKET_ prefix, not TINYCLOUD_ — Rocket builds its tokio runtime from its own Figment before TinyCloud's config is loaded, so TINYCLOUD_MAX_BLOCKING is silently ignored for this setting
(n/a) NODE_STATS_READ_TOKEN Bearer token for the read-only GET /admin/stats (TC-1482). Unset, blank, shorter than 32 bytes, or equal to TINYCLOUD_ADMIN_SECRET disables the route (404). Generate it with openssl rand -hex 32 (64 hex characters). Separate from TINYCLOUD_ADMIN_SECRET, which it does not replace and which does not open it. Secret: set it in the deployment secret store, never in tinycloud.toml or a committed env file. See Admin stats

Signed registry v2 hosting

Enable registry-based hosting explicitly on a node:

[global.spaces]
registry_v2 = "http://127.0.0.1:48100"

Use an exact HTTPS origin, without a trailing slash or path. HTTP is accepted only for loopback 127.0.0.1 or [::1] lab origins. The node fetches /v2/locations/<ownerKey> and independently verifies the current owner-signed v2 record. EOA lookup uses the EIP-55 address independently of chain; Ed25519 owners use their exact did:key.

The signed space membership must list this node's DID. A listed read-only replica supports hosting/session registration and reads; ordinary data mutations require read-write membership. These checks also apply to previously hosted spaces, public and signed-URL reads, and hook streams. Missing or unavailable authorization is refused on a configured node. When registry_v2 is unset, existing hosting and onboarding behavior is unchanged.

Ordinary signatures, delegation chains, capability scopes, and revocation checks still apply. A valid data/session grant can activate a listed replica without a separate per-node hosting SIWE. A mixed grant is retained as its complete signed proof, but /delegate activates only this node's listed data spaces; its response keeps cid, activated, and skipped. Raw encryption-network grants and requests use the separately signed encryptionNode destination. Encryption-only registration returns a CID without activating an unlisted data space.

Re-registering the same still-valid grant after membership expands activates newly admitted spaces without changing its CID or signed proof. Repeating that registration after activation does not append duplicate epochs or events. Registry unavailability returns HTTP 503, including direct decrypt and hook authorization; it is not reported as invalid agent credentials.

Registry outage cache

registry_cache_max_age_seconds (default 0, off; at most 300) lets a node keep serving through a short registry outage. What the node knows then is the last record it fetched and verified successfully, and when that fetch began:

  • Only an outage uses it: the registry cannot be reached, times out, or answers 502, 503 or 504. A refusal (404, an invalid, tampered or older record) answers as without the cache and discards the cached record.
  • The cached record admits reads and writes exactly as the live one would: a write needs the cached record to list this node read-write for the space.
  • It expires registry_cache_max_age_seconds after the last successful lookup began. Requests it serves never extend it; past it, requests answer 503 before any effect.
  • It lives in memory only: after a restart nothing is admitted until the registry answers once.
  • Activating a replica for a new grant (/delegate) always needs the live registry.

Delegation revocation is enforced from the node's own database and needs no registry, so a revocation during an outage applies at once. A membership change published to the registry during an outage takes effect at most this window after the last successful lookup.

Details: TC-2481

Database Config

The SQL database can be configured with storage.database or the TINYCLOUD_STORAGE_DATABASE environment variable. It supports Sqlite, MySQL and PostgresSQL. For example:

Type Example Description
Sqlite "sqlite:./data/caps.db" Set TinyCloud Protocol to use a local Sqlite file at the relative path ./data/caps.db
MySQL "mysql://root:root@localhost:3306/example" Use the MySQL instance deployed at localhost:3306, with database name example
Postgres "postgres://root:root@localhost:5432/example" Use the Postgres instance deployed at localhost:5432 with database name example

This will default to an in-memory Sqlite database (i.e. sqlite::memory:).

PostgreSQL pool limits

These bound how long one PostgreSQL round trip can block a request (TC-1054). Each can be set in [global.database] or with the TINYCLOUD_DATABASE__<NAME> environment variable (for example TINYCLOUD_DATABASE__STATEMENT_TIMEOUT_MS).

Option Default Description
database.max_connections 100 Pool size.
database.idle_timeout_secs 210 Close a connection idle this long, so it is recycled before a NAT, load-balancer or proxy idle cutoff drops it silently. 210 s sits strictly below the common 4-minute middlebox cutoff, AWS NAT Gateway's 350 s and PlanetScale PSBouncer's 600 s server_idle_timeout. sqlx's reaper enforces it every min(idle_timeout, max_lifetime); meanwhile a connection idle 60 s or more is pinged before reuse, and keepalive probes every 15 s keep middlebox state alive. Also applies to MySQL.
database.max_lifetime_secs 1800 Close a connection this long after it opened. PlanetScale asks for at most 24 h; PSBouncer's server_lifetime is 3600 s. Also applies to MySQL.
database.tcp_keepalive true Set TCP keepalive and TCP_USER_TIMEOUT on every connection's socket (Linux only; elsewhere a logged no-op), so a connection the network silently drops fails within about 30 s instead of the kernel's ~15-minute retransmission timeout. A connect whose options cannot be set fails, so no connection is used without them. Out-of-range values (Linux caps TCP_KEEPCNT at 127, TCP_KEEPIDLE and TCP_KEEPINTVL at 32767 s) therefore stop the node from starting.
database.tcp_keepalive_idle_secs 15 Idle time before the first keepalive probe.
database.tcp_keepalive_interval_secs 5 Time between unanswered probes.
database.tcp_keepalive_retries 3 Unanswered probes before the connection is dropped (15 + 3 × 5 = 30 s).
database.tcp_user_timeout_ms 30000 TCP_USER_TIMEOUT: how long sent data may go unacknowledged before the connection is dropped. 0 keeps the kernel default.
database.statement_timeout_mode session How PostgreSQL's statement_timeout is applied: session sets it once on each new connection (no per-request cost; covers every statement); local sets it with SET LOCAL in each explicit transaction (safe behind a transaction-pooling proxy, but one more round trip per transaction, and autocommit statements are not covered); off disables it.
database.statement_timeout_ms 30000 statement_timeout for every statement, whole-checkpoint saves and hydration slices included. 0 disables it. At most 2147483647 (PostgreSQL's largest); the node refuses to start with more.
database.idle_in_transaction_timeout_ms 300000 PostgreSQL idle_in_transaction_session_timeout, set once on each new PostgreSQL connection (env TINYCLOUD_DATABASE__IDLE_IN_TRANSACTION_TIMEOUT_MS): the server ends a session left idle inside a transaction this long, so a stalled or leaked transaction cannot keep holding its locks and pooled connection; the pool replaces the session. It must exceed the 240 s a protected legacy meeting write holds its transaction across its upload; the node refuses to start with a non-zero value of 240 s or less, or more than 2147483647. 0 disables it. Not set when statement_timeout_mode is local: behind a transaction-pooling proxy a session setting would reach the proxy's other clients. SQLite is unaffected; the operator tool tinycloud-sql-identity opens its own pool without it.
database.retry_window_ms 10000 The time budget of one database operation's single retry. An operation (/delegate, the /invoke authorization step, a KV read, a read-audit batch, the metadata read that starts a SQL hydration) whose connection is lost is run once more only when nothing can have committed, and only if the first run leaves room in this budget for a short backoff and a second run; the second run is stopped when the budget ends. Statements, BEGIN and COMMIT are not retried on their own. A request timeout, pool timeout or statement timeout pauses all retries for 30 seconds. The budget does not bound the request or the per-database lock hold.

Schema migrations always run with no statement timeout. On PostgreSQL they wait at most 30 s for any lock (lock_timeout), so a session holding a conflicting table lock makes the node fail to start with an error naming the lock wait instead of hanging; the migrations roll back together and the next start applies them (TC-1176). Customer SQL (tinycloud.sql/*) runs in the node's local SQLite engine, never on PostgreSQL, so statement_timeout does not limit it.

A database failure gets one of two responses, which clients must tell apart by the body's leading code:

Status Body starts with Retry-After Meaning
503 unavailable_retryable: 1 No write of the request can have taken effect: no connection could be had, the request only read, its connection was lost before any write, or PostgreSQL refused a statement (statement timeout, serialization failure, deadlock) outside a read-write transaction. A fresh request is safe.
500 outcome_unknown: none A write may have been applied: the connection was lost after a write or COMMIT was sent, or any failure happened once a read-write transaction had begun. That includes a refused statement (40001, 40P01, 57014) inside one, such as a KV put or delete, a delegation, a revocation or a large checkpoint, where 1.20.4 answered 40001 and 40P01 with a plain 503. This is conservative, since such a transaction did not commit, but the node cannot tell it from a lost COMMIT. Read the state back before deciding to retry. Re-sending the identical signed request is answered 409 (replay protection) if the write committed, except a delegation, which is idempotent. A KV put or delete spends its replay row in its own transaction: if it rolled back, the identical request applies when re-sent, so read the state back first. A KV write refused by its precondition (412) commits only the replay row, so its request is 409 from then on. Other services spend the row before their write. A replayed KV write is refused after its upload is staged.

Other 503s (for example the identity-cutover fence) carry neither code.

With session, behind a transaction-pooling proxy (PgBouncer, PlanetScale PSBouncer on port 6432) the per-connection SET lands on whichever server connection served it, so coverage becomes best-effort and the setting can reach other clients of the same proxy. The scoped limits (no limit for migrations, the bulk limit) use SET LOCAL and stay inside their transaction. Use local there if full coverage matters.

The keepalive options are set by a vendored, patched sqlx-core 0.8.6 (vendor/sqlx-core, see its PATCH.md; TC-1061 tracks dropping it): sqlx 0.8 has no socket hook, so connect_tcp itself sets them on each new connection's socket as it connects, before TLS or any protocol byte, for the targets the node registers (its database host and port). No other socket is touched. The startup line PostgreSQL pool connection limits reports the values, sockets_configured and connections_opened. The public GET /info JSON carries the same two counts as "postgres": {"sockets_configured": …, "connections_opened": …}; nothing else, and the field is omitted when the database is not PostgreSQL. After a deploy, postgres.sockets_configured >= postgres.connections_opened > 0 means every connection got its options (see docs/releasing.md).

Migrations

TinyCloud Protocol will automatically apply the relevant migrations to your chosen SQL database. Use caution if you are sharing this database with another application.

New encrypted delegation, invocation (including read-audit), share-policy and webhook-secret writes use the v2 column format with key ids and row-bound authentication. Columns and webhook secrets use separate derived keys. Format metadata is stored alongside each value; existing rows retain format 0. Existing v1 values remain readable. Set strict = true in [global.column_encryption] to require authenticated legacy reads as well. Startup adds format metadata without rewriting existing values. Details: TC-2516, TC-2517.

Staging Config

TinyCloud Protocol will temporarily stage files it receives before writing them. It can do this in memory or in temporary files. This can be configured by setting storage.staging to Memory or FileSystem. Default is Memory.

Storage Config

Storage can be configured for Blocks depending on it's type.

Local Storage

When storage.blocks.type is Local, the local filesystem will be used for application content storage. The following config option will become available:

Option env var description
storage.blocks.path TINYCLOUD_STORAGE_BLOCKS_PATH Set the path of the block storage

AWS Storage

When storage.blocks.type is S3 the instance will use the S3 AWS service for application storage. The following config options will become available:

Option env var description
storage.blocks.type TINYCLOUD_STORAGE_BLOCKS_TYPE Set the mode of block storage, options are "Local" and "S3"
storage.blocks.bucket TINYCLOUD_STORAGE_BLOCKS_BUCKET Set the name of the S3 bucket
storage.blocks.endpoint TINYCLOUD_STORAGE_BLOCKS_ENDPOINT Set the URL of the S3 store

Additionally, the following environment variables must be present: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION.

Keys Config

TinyCloud Protocol hosts require key pairs to provide replication. The keys config fields specify how a TinyCloud Protocol instance generates and stores these key pairs.

Static Secret Derivation

When keys.type is Static the instance will use an array of bytes as a static secret from which it will derive key pairs on a per-Space basis. The following config options will be available:

Option env var description
keys.secret TINYCLOUD_KEYS_SECRET Unpadded base64Url-encoded byte string from which key pairs will be derived.

The secret MUST contain at least 32 bytes of entropy (either randomly generated or derived in a cryptographically secure way). It is STRONGLY RECOMMENDED that the secret be given via environment variables and NOT in the tinycloud.toml config file. Additionally it is STRONGLY RECOMMENDED that the secret be backed up in a secure place if used in production. Loss of the secret will result in total loss of function for the TinyCloud Protocol instance.

Running

TinyCloud Protocol instances can be started via command line, e.g.:

TINYCLOUD_PORT=8001 tinycloud

If the TinyCloud Protocol instance is not able to find or establish a connection to the configured storage, the instance will terminate.

Usage

TinyCloud Protocol is most easily used via the TinyCloud Protocol SDK. See the example DApps and tutorials for detailed information.

Sign-out: POST /session/retire (TC-3443)

A client signs out by retiring its session key. It sends an Authorization: Bearer <UCAN> header (the Bearer prefix is optional). The UCAN is issued by the session did:key (bare or with a #fragment) to this node's DID, carries exactly {"urn:tinycloud:session:self": {"tinycloud.session/retire": [{}]}}, cites no proofs, has a nonce, and expires no more than 120 seconds from now.

The optional JSON body {"delegations": ["<delegation>", ...]} carries the session's root delegations (at most 8), each encoded exactly as POST /delegate takes it in its Authorization header. The client must send every root it holds for the session key: one per space, including any it signed but never posted. Each must be to the retiring key, or the whole request is refused. Each is admitted as POST /delegate admits it, inside the retire, so the retire covers it and posting it later cannot bring the key back; one already stored is fine. If any is refused, the request answers 401 session_retire_invalid: delegation <i>: <reason> and nothing is written. A carried root that has already expired is skipped (it can never be posted) and its index is listed in "skipped". One not valid yet (its nbf is ahead) is not stored, but its signature and issuer are checked and the retire lasts at least until it expires.

The node answers 200 {"did": "<did:key>", "retiredAt": "<RFC3339>", "recorded": true, "expiresAt": "<RFC3339>", "skipped": [<i>, ...]} (skipped only when an expired root was skipped); a repeat call answers the first retiredAt. "recorded": false (and no expiresAt) means this node holds no live grant for the key and none was carried, so nothing was written. A bad request answers 401 session_retire_invalid: <reason>; too many requests from one IP answer 429. From then on, the key can no longer use any delegated authority, a delegation it signs that this node had not stored before the retire is refused, and nothing it holds is renewed. These answer 401 session_retired: <reason>. Authority the key holds as a root (a space or network it owns itself) is not delegated and is unaffected. Signed KV URL tickets and open hook streams obtained before the retire keep working for up to 300 seconds after it.

A retire is recorded only when the node holds a live grant for the key (a delegation, renewal stamp or active renewal lease whose end is still ahead), counting the roots carried with it. It lasts at least session_retire.ttl_secs and until the latest-expiring of those grants ends, so it never lapses while the key still holds one; a delegation without an expiry keeps it for good.

Sign-out covers only the grants this node holds or was given in the request. A root the client does not send and this node does not hold is not covered: posting it later makes the key usable here again until it expires. Sign-out does not end the delegations the key made before it, or their descendants; Revoke ends them. A node that starts hosting the space after the sign-out does not know about it and accepts the key until its session root expires (TC-3673).

UCAN DID verification (TC-1080, TC-1500)

The node verifies a UCAN signature only when it derives the signer's key offline. It accepts these DIDs, as issuers and as the holders of new grants:

  • did:key: Ed25519, secp256k1 and P-256 (compressed) keys, base58btc. The identifier must be exactly 48 (Ed25519) or 49 characters, checked before it is decoded.
  • did:jwk: Ed25519 (OKP) and secp256k1 or P-256 (EC) public keys, in an identifier of at most 256 characters, checked before it is decoded.
  • did:pkh: CAIP-10 accounts in the eip155, solana and bip122 (Bitcoin and Dogecoin mainnet) namespaces.

Keys must be valid points on their curve, and an Ed25519 key (including a solana account) must not be of small order. A DID of another method fails before resolution with did_method_disabled:. A did:key, did:jwk or did:pkh naming another key type or namespace (P-384, tezos, the legacy eth/sol/ btc forms) or a malformed identifier fails with did_unverifiable:. Issuer DID URLs carrying a query fail with did_url_query_rejected:.

POST /delegate also refuses a new grant whose holder (aud) is not such a DID with did_holder_unverifiable:. A Policy/v3 delegate, did:tinycloud:policy:<64 lowercase hex>, is exempt: it holds a policy root and never signs. Grants already stored are unchanged. DID parsing and string comparisons, including share-email did:web identifiers, are unchanged.

No setting enables network DID methods. did_resolution.network_methods (TINYCLOUD_DID_RESOLUTION__NETWORK_METHODS) was removed: a node that still sets it starts, warns that the setting is ignored, and refuses did:web. Full TC-1080 Part B hardening is REQUIRED before any future enable. The required node-side fetcher, destination enforcement, resource limits and local-listener acceptance checks are described in the developer gate.

Refusals increment tinycloud_did_resolution_refused_total{method,reason} (even when latency telemetry is disabled), with reasons method_disabled, unverifiable, holder_unverifiable and query_rejected. Unknown methods use the bounded label unknown. Warnings contain only the method, sanitized host and reason, with one warning per method/host per minute and at most ten per minute globally; the next warning reports suppressed counts.

Public GET /info also exposes only counts and booleans: "did_resolution": { "network_methods": false, "refused_total": 0 }. network_methods is always false. refused_total counts every refusal for this process lifetime and resets on restart. No DIDs, hosts, URLs or per-method data are exposed.

About

No description, website, or topics provided.

Resources

Stars

26 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages