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: HTTP to UCAN bridge #325
Commits on Feb 9, 2024
-
feat: first draft of UCAN bridge
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. So far this PR has: 1) an untested (but type-checking!) implementation of such a bridge 2) a markdown description of the bridge protocol, intended to be the first draft of an eventual specification Notable design choices: 1) I chose to include JUST the base64pad-encoded "secret" in the Authorization header to avoid running afoul of maximum header size restrictions that exist in [some HTTP environments](https://stackoverflow.com/questions/686217/maximum-on-http-header-values). 2) The `proof` field of the JSON body is a base64pad encoded "delegation archive" (created with `ucanto`'s `Delegation.archive` function) TODO - [ ] factor core bridge logic out to a separate library - [ ] factor HTTP input wrangling out to a separate function - [ ] rename `UPLOAD_API_DID` and `ACCESS_SERVICE_URL` environment variables to `W3UP_SERVICE_DID` and `W3UP_SERVICE_URL` - [ ] add tests - [ ] expand and formalize bridge specification, move it to the specs repo (?)
Configuration menu - View commit details
-
Copy full SHA for 5ebd1ea - Browse repository at this point
Copy the full SHA 5ebd1eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for b53de7c - Browse repository at this point
Copy the full SHA b53de7cView commit details
Commits on Feb 12, 2024
-
update spec to use https:// github.com/ucan-wg/ucan-http-bearer-token?tab=readme-ov-file#ucan-as-bearer-token-specification-v030 and move the secret to a new `X-Auth-Secret` header update implementation per this spec - currently typechecks cleanly but throws an error when I actually try to invoke: ``` TypeError: proof.export is not a function or its return value is not iterable at delegate (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/core/src/delegation.js:466:33) at IssuedInvocation.buildIPLDView (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/core/src/invocation.js:101:12) at writeInvocations (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/core/src/message.js:114:35) at MessageBuilder.buildIPLDView (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/core/src/message.js:79:52) at Object.build (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/core/src/message.js:30:49) at execute (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/client/src/connection.js:48:31) at Connection.execute (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/client/src/connection.js:35:12) at IssuedInvocation.execute (/Users/travis/dev/pl/w3infra/node_modules/@ucanto/core/src/invocation.js:115:39) at handlerFn (/Users/travis/dev/pl/w3infra/upload-api/functions/bridge.js:124:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` I think this is because the `@ipld/dag-ucan` `Ucan.View` is not a full `Delegation`
Configuration menu - View commit details
-
Copy full SHA for 4185a6d - Browse repository at this point
Copy the full SHA 4185a6dView commit details -
Configuration menu - View commit details
-
Copy full SHA for bbfcb35 - Browse repository at this point
Copy the full SHA bbfcb35View commit details
Commits on Feb 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 02440e0 - Browse repository at this point
Copy the full SHA 02440e0View commit details
Commits on Feb 21, 2024
-
feat: a bunch of additions from PRs and other discussions
1) add content negotiation and support CBOR 2) better parsing abstractions 3) validate tasks before casting one slightly weird thing I'm doing is converting the string I get from the AWS lambda to a ReadableStream and then reading it back again - seems silly in this implementation, but is necessary because I plan to pull out the abstraction and support other deployment environments like Cloudflare workers or Node's `fetch` API.
Configuration menu - View commit details
-
Copy full SHA for babea35 - Browse repository at this point
Copy the full SHA babea35View commit details
Commits on Feb 22, 2024
-
fix: support two more content types
also error on unsupported content type
Configuration menu - View commit details
-
Copy full SHA for 0a0f7d3 - Browse repository at this point
Copy the full SHA 0a0f7d3View commit details
Commits on Feb 23, 2024
-
feat: update to latest request and response format
need to update spec
Configuration menu - View commit details
-
Copy full SHA for fa74f9c - Browse repository at this point
Copy the full SHA fa74f9cView commit details
Commits on Feb 26, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 73447b7 - Browse repository at this point
Copy the full SHA 73447b7View commit details -
Configuration menu - View commit details
-
Copy full SHA for f86fb98 - Browse repository at this point
Copy the full SHA f86fb98View commit details -
Configuration menu - View commit details
-
Copy full SHA for e73ce81 - Browse repository at this point
Copy the full SHA e73ce81View commit details -
Configuration menu - View commit details
-
Copy full SHA for e45b667 - Browse repository at this point
Copy the full SHA e45b667View commit details -
Configuration menu - View commit details
-
Copy full SHA for bc2126c - Browse repository at this point
Copy the full SHA bc2126cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 40536e9 - Browse repository at this point
Copy the full SHA 40536e9View commit details
Commits on Mar 1, 2024
-
fix: factor env variables out of runtime
look up required env variables at deploy time
Configuration menu - View commit details
-
Copy full SHA for 9dbd9d7 - Browse repository at this point
Copy the full SHA 9dbd9d7View commit details -
feat: add integration test for bridge
had to upgrade w3up-client to bring in the coupon functionality
Configuration menu - View commit details
-
Copy full SHA for 8e783a4 - Browse repository at this point
Copy the full SHA 8e783a4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1acc53e - Browse repository at this point
Copy the full SHA 1acc53eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5d40271 - Browse repository at this point
Copy the full SHA 5d40271View commit details -
1) default to reading the request body as dag-json 2) use `p` and `s` instead of `data` and `sig`, to match https://github.com/ucan-wg/invocation/blob/c596f04bbaf56c58df76bb578c6dfd53bb88bece/README.md#receipt-response 3) use `dagJSON.decode`
Configuration menu - View commit details
-
Copy full SHA for b4bac79 - Browse repository at this point
Copy the full SHA b4bac79View commit details -
Configuration menu - View commit details
-
Copy full SHA for e1f020c - Browse repository at this point
Copy the full SHA e1f020cView commit details -
Configuration menu - View commit details
-
Copy full SHA for aadb19c - Browse repository at this point
Copy the full SHA aadb19cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5c69e18 - Browse repository at this point
Copy the full SHA 5c69e18View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1170dde - Browse repository at this point
Copy the full SHA 1170ddeView commit details -
Configuration menu - View commit details
-
Copy full SHA for e9389b4 - Browse repository at this point
Copy the full SHA e9389b4View commit details
Commits on Mar 2, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 78fd9a2 - Browse repository at this point
Copy the full SHA 78fd9a2View commit details -
Configuration menu - View commit details
-
Copy full SHA for c9c0864 - Browse repository at this point
Copy the full SHA c9c0864View commit details -
Configuration menu - View commit details
-
Copy full SHA for 82fd186 - Browse repository at this point
Copy the full SHA 82fd186View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1171b8a - Browse repository at this point
Copy the full SHA 1171b8aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0904d3a - Browse repository at this point
Copy the full SHA 0904d3aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6cf3325 - Browse repository at this point
Copy the full SHA 6cf3325View commit details -
Configuration menu - View commit details
-
Copy full SHA for d8af685 - Browse repository at this point
Copy the full SHA d8af685View commit details -
Configuration menu - View commit details
-
Copy full SHA for 60ba516 - Browse repository at this point
Copy the full SHA 60ba516View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9065b95 - Browse repository at this point
Copy the full SHA 9065b95View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9a349af - Browse repository at this point
Copy the full SHA 9a349afView commit details -
Configuration menu - View commit details
-
Copy full SHA for c43f4d6 - Browse repository at this point
Copy the full SHA c43f4d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for beeadce - Browse repository at this point
Copy the full SHA beeadceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 46011cc - Browse repository at this point
Copy the full SHA 46011ccView commit details
Commits on Mar 4, 2024
-
Configuration menu - View commit details
-
Copy full SHA for cb95b05 - Browse repository at this point
Copy the full SHA cb95b05View commit details -
The bridge was configured to point at staging even when it was running in a PR environment, because we don't customize the `ACCESS_SERVICE_URL` in those environments. It would be nice to figure out how to set the proper environment variables in different environments, but I suspect the right way to do that might change with the SST upgrade, so for now let's just add a function that encodes the rules we know, since these aren't likely to change soon and would require some code changes anyway.
Configuration menu - View commit details
-
Copy full SHA for 71d33eb - Browse repository at this point
Copy the full SHA 71d33ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 14e82d3 - Browse repository at this point
Copy the full SHA 14e82d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0fcbf83 - Browse repository at this point
Copy the full SHA 0fcbf83View commit details -
Configuration menu - View commit details
-
Copy full SHA for 91fa5d0 - Browse repository at this point
Copy the full SHA 91fa5d0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3dffb9c - Browse repository at this point
Copy the full SHA 3dffb9cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c55b512 - Browse repository at this point
Copy the full SHA c55b512View commit details
Commits on Mar 5, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0f521dc - Browse repository at this point
Copy the full SHA 0f521dcView commit details