-
Notifications
You must be signed in to change notification settings - Fork 7
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: introduce bridge generate-tokens
command
#175
Conversation
In service of the UCAN bridge implementation in storacha/w3infra#325 this PR proposes a new `bridge generate-tokens` command that will generate values for the `Authorization` header and `proof` field of the HTTP request users make to the bridge. This PR is currently intended as a stake-in-the-ground and is expected to change significantly. TODO - [ ] clean up and refactor bridge - [ ] finalize command names - [ ] decouple from coupon code (?)
send all auth info in headers and base64url multibase encode both values
bridge generate-tokens
commandbridge generate-tokens
command
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.
Might be worth adding a --json
option?
I've approved, but please remove the unused --output
option.
|
||
Generate tokens that can be used as the `X-Auth-Secret` and `Authorization` headers required to use the UCAN-HTTP bridge. | ||
|
||
TODO: link to UCAN-HTTP bridge specification once it lands |
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.
You can probably link to where it will land and not block :)
) | ||
.option( | ||
'-o, --output', | ||
'Path of file to write the exported delegation data to.' |
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.
Does not appear to be used?
.option('-c, --can', 'One or more abilities to delegate.') | ||
.option( | ||
'-e, --expiration', | ||
'Unix timestamp when the delegation is no longer valid. Zero indicates no expiration.', |
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.
'Unix timestamp when the delegation is no longer valid. Zero indicates no expiration.', | |
'Unix timestamp (in seconds) when the delegation is no longer valid. Zero indicates no expiration.', |
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.
whoops - when I scanned this PR I somehow missed these comments - will address and submit a followup PR right now!
A few followups from feedback to #175 : - remove unused --output option - add --json option - clarify documentation
A few followups from feedback to #175 : - remove unused --output option - add --json option - clarify documentation
A few followups from feedback to #175 : - remove unused --output option - add --json option - clarify documentation
To support users in languages that do not have existing UCAN invocation implementations, we are going to launch a bridge that allows them to make simple HTTP requests with JSON bodies that we transform into proper UCAN invocations. This follows the specification here: storacha/specs#112 Values for authorization headers can be generated using the `bridge generate-tokens` w3cli command proposed here: storacha/w3cli#175 - [x] factor core bridge logic out to a separate library (filed as #338) - [x] factor HTTP input wrangling out to a separate function - [x] rename `UPLOAD_API_DID` and `ACCESS_SERVICE_URL` environment variables to `W3UP_SERVICE_DID` and `W3UP_SERVICE_URL` (filed as #337) - [x] add tests - [x] expand and formalize bridge specification, move it to the specs repo (done - storacha/specs#112) - [x] document response format
🤖 I have created a release *beep* *boop* --- ## [7.6.0](v7.5.0...v7.6.0) (2024-03-05) ### Features * introduce `bridge generate-tokens` command ([#175](#175)) ([5de8579](5de8579)) * updates from PR feedback ([#179](#179)) ([75f2195](75f2195)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
In service of the UCAN bridge implementation in storacha/w3infra#325 this PR introduces a new
bridge generate-tokens
command that will generate values for theX-Auth-Secret
andAuthorization
headers of the HTTP request users make to the bridge.