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!: content serve authorization #1590

Merged
merged 11 commits into from
Dec 4, 2024
Merged

feat!: content serve authorization #1590

merged 11 commits into from
Dec 4, 2024

Conversation

fforbeck
Copy link
Member

@fforbeck fforbeck commented Nov 26, 2024

Context

To enable a gateway to serve content from a specific space, we must ensure that the space owner delegates the space/content/serve/* capability to the Gateway. This delegation allows the Gateway to serve content and log egress events appropriately.

I created a new function authorizeContentServe for this implementation and included it in the createSpace flow. This is a breaking change because now the user is forced to provide the DIDs of the Content Serve services, and the connection, or skip the authorization flow.

Additionally, with the authorizeContentServe function, we can implement a feature in the Console App that enables users to explicitly authorize the Freeway Gateway to serve content from existing/legacy spaces.

Main Changes

  • New Functionality: Added a new function, authorizeContentServe, in the w3up-client module to facilitate the delegation process. Integrated it with the createdSpace flow.
  • Testing: Introduced test cases to verify the authorization of specified gateways.
  • Fixes: Resolved issues with previously broken test cases (Egress Record).

Related Issues

@fforbeck fforbeck self-assigned this Nov 26, 2024
@fforbeck fforbeck force-pushed the feat/gateway-authorization branch 2 times, most recently from b98e723 to 5d8ba9b Compare November 27, 2024 14:08
@fforbeck fforbeck marked this pull request as ready for review November 27, 2024 14:08
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/test/capability/space.test.js Outdated Show resolved Hide resolved
packages/w3up-client/test/client.test.js Outdated Show resolved Hide resolved
Peeja
Peeja previously requested changes Nov 29, 2024
Copy link
Member

@Peeja Peeja left a comment

Choose a reason for hiding this comment

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

Looking good! Just the TypeScript / JSDoc thing.

Not My Type Mexican

packages/w3up-client/test/mocks/service.js Outdated Show resolved Hide resolved
packages/w3up-client/test/capability/space.test.js Outdated Show resolved Hide resolved
@fforbeck fforbeck force-pushed the feat/gateway-authorization branch from 9984a07 to 7a395a9 Compare November 29, 2024 16:37
@fforbeck fforbeck requested review from Peeja and alanshaw November 29, 2024 16:41
@fforbeck fforbeck changed the title feat: authorize gateway feat!: content serve authorization Nov 29, 2024
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
packages/w3up-client/src/client.js Outdated Show resolved Hide resolved
@fforbeck fforbeck force-pushed the feat/gateway-authorization branch 2 times, most recently from e0fb6fb to d533b7a Compare December 2, 2024 14:06
@fforbeck fforbeck force-pushed the feat/gateway-authorization branch from d533b7a to 5f414b0 Compare December 2, 2024 14:09
@fforbeck fforbeck requested a review from alanshaw December 2, 2024 14:14
@@ -13,13 +13,15 @@ export const provide = (ctx) =>

/**
* Checks if the given Principal is an Account.
*
Copy link
Member Author

@fforbeck fforbeck Dec 2, 2024

Choose a reason for hiding this comment

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

fixed lint issue

* @param {API.Principal} principal
* @returns {principal is API.Principal<API.DID<'mailto'>>}
*/
const isAccount = (principal) => principal.did().startsWith('did:mailto:')

/**
* Returns true when the delegation has a `ucan:*` capability.
*
Copy link
Member Author

@fforbeck fforbeck Dec 2, 2024

Choose a reason for hiding this comment

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

fixed lint issue

* @param {Agent<S>} agent
* @param {Types.Invocation} invocation
Copy link
Member Author

Choose a reason for hiding this comment

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

fixed lint issue

@fforbeck fforbeck dismissed Peeja’s stale review December 2, 2024 18:35

Implemented suggested changes.

@fforbeck fforbeck force-pushed the feat/gateway-authorization branch from 990df46 to 8ab9792 Compare December 3, 2024 15:24
@travis travis merged commit 8b553a5 into main Dec 4, 2024
9 checks passed
@travis travis deleted the feat/gateway-authorization branch December 4, 2024 17:10
fforbeck pushed a commit that referenced this pull request Dec 9, 2024
🤖 I have created a release *beep* *boop*
---


##
[18.0.0](capabilities-v17.4.1...capabilities-v18.0.0)
(2024-12-05)


### ⚠ BREAKING CHANGES

* content serve authorization
([#1590](#1590))

### Features

* content serve authorization
([#1590](#1590))
([8b553a5](8b553a5))


### Fixes

* **egressRecord:** Remove unnecessary multiplication for ts conversion
([#1588](#1588))
([b7bc90e](b7bc90e))


### Other Changes

* **main:** release w3up-client 16.4.1
([#1577](#1577))
([1482d69](1482d69))

---
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>
fforbeck pushed a commit that referenced this pull request Dec 9, 2024
🤖 I have created a release *beep* *boop*
---


##
[8.0.0](filecoin-api-v7.3.2...filecoin-api-v8.0.0)
(2024-12-09)


### ⚠ BREAKING CHANGES

* content serve authorization
([#1590](#1590))

### Features

* content serve authorization
([#1590](#1590))
([8b553a5](8b553a5))


### Other Changes

* **main:** release w3up-client 16.4.1
([#1577](#1577))
([1482d69](1482d69))

---
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>
fforbeck pushed a commit that referenced this pull request Dec 9, 2024
🤖 I have created a release *beep* *boop*
---


##
[19.0.0](upload-api-v18.1.4...upload-api-v19.0.0)
(2024-12-09)


### ⚠ BREAKING CHANGES

* content serve authorization
([#1590](#1590))

### Features

* content serve authorization
([#1590](#1590))
([8b553a5](8b553a5))

---
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>
fforbeck pushed a commit that referenced this pull request Dec 9, 2024
🤖 I have created a release *beep* *boop*
---


##
[17.0.0](w3up-client-v16.5.2...w3up-client-v17.0.0)
(2024-12-09)


### ⚠ BREAKING CHANGES

* content serve authorization
([#1590](#1590))

### Features

* content serve authorization
([#1590](#1590))
([8b553a5](8b553a5))

---
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>
@juliangruber
Copy link

I created a new function authorizeContentServe for this implementation and included it in the createSpace flow. This is a breaking change because now the user is forced to provide the DIDs of the Content Serve services, and the connection, or skip the authorization flow.

Do you have any documentation / getting started example for this new behavior?

@fforbeck
Copy link
Member Author

Do you have any documentation / getting started example for this new behavior?

Not yet @juliangruber . This functionality will align with other ongoing changes, like this issue. Once those are finalized, the documentation will be updated with all the necessary details to explain the new behavior.

@juliangruber
Copy link

Got it, thanks. For now we shouldn't upgrade to that version, correct?

@fforbeck
Copy link
Member Author

Got it, thanks. For now we shouldn't upgrade to that version, correct?

That's correct. If you keep your w3up-client on version 16.5.2, you won't be required to set the authorization details.

fforbeck added a commit to storacha/upload-service that referenced this pull request Dec 11, 2024
To enable a gateway to serve content from a specific space, we must
ensure that the space owner delegates the `space/content/serve/*`
capability to the Gateway. This delegation allows the Gateway to serve
content and log egress events appropriately.

I created a new function `authorizeContentServe` for this implementation
and included it in the `createSpace` flow. This is a breaking change
because now the user is forced to provide the DIDs of the Content Serve
services, and the connection, or skip the authorization flow.

Additionally, with the `authorizeContentServe` function, we can
implement a feature in the Console App that enables users to explicitly
authorize the Freeway Gateway to serve content from existing/legacy
spaces.

- **New Functionality:** Added a new function, `authorizeContentServe`,
in the `w3up-client` module to facilitate the delegation process.
Integrated it with the `createdSpace` flow.
- **Testing:** Introduced test cases to verify the authorization of
specified gateways.
- **Fixes:** Resolved issues with previously broken test cases (Egress
Record).

- storacha/project-tracking#158
- storacha/project-tracking#160
fforbeck added a commit to storacha/upload-service that referenced this pull request Dec 11, 2024
To enable a gateway to serve content from a specific space, we must
ensure that the space owner delegates the `space/content/serve/*`
capability to the Gateway. This delegation allows the Gateway to serve
content and log egress events appropriately.

I created a new function `authorizeContentServe` for this implementation
and included it in the `createSpace` flow. This is a breaking change
because now the user is forced to provide the DIDs of the Content Serve
services, and the connection, or skip the authorization flow.

Additionally, with the `authorizeContentServe` function, we can
implement a feature in the Console App that enables users to explicitly
authorize the Freeway Gateway to serve content from existing/legacy
spaces.

- **New Functionality:** Added a new function, `authorizeContentServe`,
in the `w3up-client` module to facilitate the delegation process.
Integrated it with the `createdSpace` flow.
- **Testing:** Introduced test cases to verify the authorization of
specified gateways.
- **Fixes:** Resolved issues with previously broken test cases (Egress
Record).

- storacha/project-tracking#158
- storacha/project-tracking#160
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.

5 participants