-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(content-serve): delegate with token caveat #1603
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,13 +65,54 @@ export const allocate = capability({ | |
}) | ||
|
||
/** | ||
* The capability grants permission for all content serve operations that fall under the "space/content/serve" namespace. | ||
* It can be derived from any of the `space/*` capability that has matching `with`. | ||
* "Manage the serving of content owned by the subject Space." | ||
* | ||
* A Principal who may `space/content/serve/*` is permitted to perform all | ||
* operations related to serving content owned by the Space, including actually | ||
* serving it and recording egress charges. | ||
*/ | ||
|
||
export const contentServe = capability({ | ||
can: 'space/content/serve/*', | ||
/** | ||
* The Space which contains the content. This Space will be charged egress | ||
* fees if content is actually retrieved by way of this invocation. | ||
*/ | ||
with: SpaceDID, | ||
nb: Schema.struct({ | ||
/** The authorization token, if any, used for this request. */ | ||
token: Schema.string().nullable(), | ||
}), | ||
derives: equalWith, | ||
}) | ||
|
||
/** | ||
* "Serve content owned by the subject Space over HTTP." | ||
* | ||
* A Principal who may `space/content/serve/transport/http` is permitted to | ||
* serve any content owned by the Space, in the manner of an [IPFS Gateway]. The | ||
* content may be a Blob stored by a Storage Node, or indexed content stored | ||
* within such Blobs (ie, Shards). | ||
* | ||
* Note that the args do not currently specify *what* content should be served. | ||
* Invoking this command does not currently *serve* the content in any way, but | ||
* merely validates the authority to do so. Currently, the entirety of a Space | ||
* must use the same authorization, thus the content does not need to be | ||
* identified. In the future, this command may refer directly to a piece of | ||
* content by CID. | ||
* | ||
* [IPFS Gateway]: https://specs.ipfs.tech/http-gateways/path-gateway/ | ||
*/ | ||
export const transportHttp = capability({ | ||
can: 'space/content/serve/transport/http', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IDK if "transport" is useful, makes it very verbose. Suggestion: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. I'm not sure now who originally proposed |
||
/** | ||
* The Space which contains the content. This Space will be charged egress | ||
* fees if content is actually retrieved by way of this invocation. | ||
*/ | ||
with: SpaceDID, | ||
nb: Schema.struct({ | ||
/** The authorization token, if any, used for this request. */ | ||
token: Schema.string().nullable(), | ||
}), | ||
derives: equalWith, | ||
}) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this defined at this level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that defining it at the top level could be overly restrictive. Allowing its use within the
transport/http
capability seems like a good approach, as it enables revocation without affecting the ability to serve content or record egress. @Peeja, what are your thoughts on this?