Skip to content
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

Merged
merged 6 commits into from
Mar 5, 2024
Merged

Conversation

travis
Copy link
Contributor

@travis travis commented Feb 7, 2024

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 the X-Auth-Secret and Authorization headers of the HTTP request users make to the bridge.

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
@travis travis requested review from alanshaw, Gozala and gobengo and removed request for alanshaw February 26, 2024 18:57
@travis travis changed the title wip: introduce bridge generate-tokens command feat: introduce bridge generate-tokens command Feb 26, 2024
Copy link
Member

@alanshaw alanshaw left a 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
Copy link
Member

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.'
Copy link
Member

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.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'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.',

Copy link
Contributor Author

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!

@travis travis merged commit 5de8579 into main Mar 5, 2024
1 check passed
@travis travis deleted the feat/ucan-bridge branch March 5, 2024 17:47
travis added a commit that referenced this pull request Mar 5, 2024
A few followups from feedback to #175 :

- remove unused --output option
- add --json option
- clarify documentation
travis added a commit that referenced this pull request Mar 5, 2024
A few followups from feedback to #175 :

- remove unused --output option
- add --json option
- clarify documentation
travis added a commit that referenced this pull request Mar 5, 2024
A few followups from feedback to
#175 :

- remove unused --output option
- add --json option
- clarify documentation
travis added a commit to storacha/w3infra that referenced this pull request Mar 5, 2024
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
travis pushed a commit that referenced this pull request Mar 5, 2024
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants