UCAN Fundamentals
UCAN is a decentralized authorization framework where capabilities are:- Bearer tokens: Whoever holds the token can use the capability
- Self-certifying: No central authority needed to verify — the token itself contains proof
- Delegatable: Users can grant subsets of their capabilities to others
- Cryptographically signed: Tamper-proof and verifiable by anyone
ReCap Integration with SIWE
ReCap embeds capability claims within SIWE (Sign-In with Ethereum) messages, allowing Ethereum wallets to authorize specific actions as part of the sign-in flow.Ability String Format
TinyCloud uses a hierarchical ability string format to define specific actions:tinycloud. prefix is the ReCap ability namespace (a spec-level concept), followed by the resource type and the specific action.
Key-Value Operations
| Ability | Description |
|---|---|
tinycloud.kv/get | Read values from the key-value store |
tinycloud.kv/put | Write values to the key-value store |
tinycloud.kv/del | Delete values from the key-value store |
tinycloud.kv/list | List keys in the key-value store |
tinycloud.kv/metadata | Read metadata about stored values |
Space Operations
| Ability | Description |
|---|---|
tinycloud.space/host | Access a space as a participant |
tinycloud.space/admin | Full administrative control over a space |
Capability Operations
| Ability | Description |
|---|---|
tinycloud.capabilities/read | Read and verify capability chains |
Path Scoping
Abilities can be scoped to specific key paths within a space. This limits what a capability holder can access, even within the same resource type.Delegation Chains
One of UCAN’s most powerful features is the ability to delegate capabilities to others. Each delegation creates a link in a verifiable chain.Delegation Hierarchy
docs/*; Bob can sub-delegate read access to docs/public/* to Carol, but Bob cannot grant Carol write access or access outside docs/*.
Constraint Rules
When creating a delegation, the child capability must be a strict subset of the parent across all dimensions:Expiry Constraint
Expiry Constraint
Child expiry must be less than or equal to parent expiry.If Alice’s capability expires on January 15, any delegation she creates must expire on or before January 15.
not_before Constraint
not_before Constraint
Child not_before must be greater than or equal to parent not_before.A delegation cannot become valid before the parent capability is valid. This prevents backdating attacks where a sub-delegation could be used before the original grant was intended to be active.
Action Subset Constraint
Action Subset Constraint
Child actions must be a subset of parent actions.You cannot delegate capabilities you do not have.
Path Constraint
Path Constraint
Child path must be within parent path.If Alice can only access
/projects/alpha/, she can delegate access to /projects/alpha/docs/ but not to /projects/beta/.How the Server Validates Chains
When a request arrives with a delegation token, the TinyCloud node walks the entire chain:Preventing Sub-delegation
To prevent further delegation of capabilities, use thedisableSubDelegation flag:
Revocation
Capabilities can be revoked before their expiry. When a capability in the chain is revoked:- The revoked capability becomes invalid immediately
- All downstream delegations derived from it also become invalid
- The revocation is permanent for that specific token
Revocation propagates down the chain. If Alice revokes Bob’s delegation, Carol’s sub-delegation from Bob also becomes invalid, even if Carol’s token has not expired.
Best Practices
- Principle of least privilege: Delegate only the minimum capabilities needed for the task
- Short expiry times: Use shorter expiry periods for sensitive operations; prefer hours over days
- Path scoping: Limit access to specific paths rather than granting access to entire spaces
- Disable sub-delegation: When the recipient should not be able to share access further
- Use the correct DID: Always use
tc.did(primary DID after signIn) for the delegatee (see DID Formats) - Audit delegation chains: Use
tinycloud.capabilities/readto inspect active capability chains in your space