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
- Delegatable: Users can grant subsets of their capabilities to others
- Cryptographically signed: Tamper-proof and verifiable
ReCap Integration
ReCap embeds capability claims within SIWE messages, allowing Ethereum wallets to authorize specific actions. The flow works as follows:Ability String Format
TinyCloud uses a hierarchical ability string format: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 paths within a space:Delegation Chains
One of UCAN’s most powerful features is the ability to delegate capabilities to others. TinyCloud enforces strict rules to ensure security.Delegation Hierarchy
Constraint Rules
When creating a delegation, the child capability must be a subset of the parent: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.
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/.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.
Best Practices
- Principle of least privilege: Delegate only the minimum capabilities needed
- Short expiry times: Use shorter expiry periods for sensitive operations
- Path scoping: Limit access to specific paths rather than entire spaces
- Disable sub-delegation: When the recipient should not share access further
- Use PKH DIDs: Always use
.pkhDidfor the delegatee (see DID Formats)