-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98630cb
commit a07ad72
Showing
1 changed file
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# Space | ||
|
||
![status:reliable](https://img.shields.io/badge/status-reliable-green.svg?style=flat-square) | ||
|
||
## Editors | ||
|
||
- [Vasco Santos], [Protocol Labs] | ||
|
||
## Authors | ||
|
||
- [Vasco Santos], [Protocol Labs] | ||
|
||
## Abstract | ||
|
||
A Space can be defined as a namespace for stored content. It is created locally, offline, and associated with a cryptographic key pair (identified by the did:key of the public key). Afterwards, a space MAY be registered with a web3.storage [account](./w3-account.md) and [providers](./w3-provider.md) MAY be added to the space. | ||
|
||
- [Capabilities](#capabilities) | ||
- [`space/info`](#spaceinfo) | ||
- [`space/allocate`](#spaceallocate) | ||
|
||
## Language | ||
|
||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119](https://datatracker.ietf.org/doc/html/rfc2119). | ||
|
||
## Capabilities | ||
|
||
### `space/info` | ||
|
||
Get information about a given space, such as registered providers. | ||
|
||
> `did:key:zAliceAgent` invokes `space/info` capability provided by `did:web:web3.storage` | ||
```json | ||
{ | ||
"iss": "did:key:zAliceAgent", | ||
"aud": "did:web:web3.storage", | ||
"att": [ | ||
{ | ||
"with": "did:key:zAlice", | ||
"can": "space/info" | ||
} | ||
], | ||
"prf": [], | ||
"sig": "..." | ||
} | ||
``` | ||
|
||
#### Space Info Failure | ||
|
||
```json | ||
{ | ||
"ran": "bafy...spaceInfo", | ||
"out": { | ||
"error": { | ||
"name": "SpaceUnknown" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
#### Space Info Success | ||
|
||
```json | ||
{ | ||
"ran": "bafy...spaceInfo", | ||
"out": { | ||
"ok": { | ||
"did": "did:key:zAlice", | ||
"providers": [ | ||
"did:web:free.web3.storage" | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### `space/allocate` | ||
|
||
Allocate space to write content into the space | ||
|
||
> `did:key:zAliceAgent` invokes `space/allocate` capability provided by `did:web:web3.storage` | ||
```json | ||
{ | ||
"iss": "did:key:zAliceAgent", | ||
"aud": "did:web:web3.storage", | ||
"att": [ | ||
{ | ||
"with": "did:key:zAlice", | ||
"can": "space/allocate", | ||
"nb": { | ||
"size": 1000 | ||
} | ||
} | ||
], | ||
"prf": [], | ||
"sig": "..." | ||
} | ||
``` | ||
|
||
#### Space Allocate Failure | ||
|
||
```json | ||
{ | ||
"ran": "bafy...spaceAllocate", | ||
"out": { | ||
"error": { | ||
"name": "InsufficientStorage" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
#### Space Allocate Success | ||
|
||
```json | ||
{ | ||
"ran": "bafy...spaceAllocate", | ||
"out": { | ||
"ok": {} | ||
} | ||
} | ||
``` | ||
|
||
[Protocol Labs]: https://protocol.ai/ | ||
[Vasco Santos]: https://github.com/vasco-santos |