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

Delegations UI #130

Closed
hannahhoward opened this issue Sep 16, 2024 · 8 comments
Closed

Delegations UI #130

hannahhoward opened this issue Sep 16, 2024 · 8 comments
Assignees

Comments

@hannahhoward
Copy link
Member

As a Storacha user accessing an account in the console, I should be able to delegate access to a space to another Storacha account in the console.

Details:

  • For now, delegations are 1/0 -- "space/*" for a given DID. We'll have a seperate ticket for more fine grained permissions
  • For now, accounts that receive delegations will still need to have their own plan for storacha, even though the space isn't provisioned to that account (we'll create another ticket for granting console access without a plan)
  • Leave revocations out for now
  • Delegating access to the space should roughly follow the same flow as createRecovery, access/delegate, but with a different account email.

Acceptance criteria:

On the space detail UI, below the list of files (or perhaps to the side on sufficiently wide display), I should see a UI for delegating access. It should contain a list of email accounts I have delegated access to the space for, and a button to add a new delegation.

Image

When I add a new account to a space, and that account logs into the console, the space will show up in their UI. (after #125 merges)

@hannahhoward hannahhoward converted this from a draft issue Sep 16, 2024
@alanshaw
Copy link
Member

@hannahhoward is the intention that the delegation is stashed on the server by the issuer for the audience to claim? That's a very cool idea.

Where does the list of delegations you've made live? Are they just in localStorage/IndexedDB/what?

What if this sharing section was added to the "share" page that you get to via the link in the menu (see screenshot)?

Screenshot 2024-09-16 at 17 46 54

@fforbeck
Copy link
Member

@hannahhoward @alanshaw
I'm thinking about updating the JS Client to expose a new method: shareSpace that we'll invoke from the console to handle the delegation logic. The nice thing about this is that it will be available to be consumed by the CLI as well. Do you have any objections to this approach?

@hannahhoward
Copy link
Member Author

@fforbeck not really ... technically this is just the combo of "createRecovery" + call access/delegate capability, which is in the tutorial, so it's not inaccessible, but it's probably a nice convenience.

@hannahhoward
Copy link
Member Author

@alanshaw yes, it goes to the server -- is there any reason you need any more than access/delegate + access/claim for this? It's the same flow as normal for your own space just the claimer is different than the delegator.

@hannahhoward
Copy link
Member Author

Also @fforbeck UI wise I agree with Alan a share button makes more sense w/ a modal.

@alanshaw
Copy link
Member

I think by default if you want to use the space you'll need some of these capabilities https://github.com/storacha/w3up/blob/e02ddf3696553b03f8d2f7316de0a99a9303a60f/packages/access-client/src/access.js#L322-L334

I agree control over the exact delegations should be future work but I think by default you'll need/want to delegate the following abilities for each space (resource/with):

  • space/* - for uploading blobs
  • upload/*- for registering uploads
  • filecoin/* - for submitting to the filecoin pipeline
  • access/* - for re-delegating access to other devices
  • usage/* - for querying usage

@alanshaw
Copy link
Member

@alanshaw yes, it goes to the server -- is there any reason you need any more than access/delegate + access/claim for this? It's the same flow as normal for your own space just the claimer is different than the delegator.

Yes that makes sense. I was wondering about the list of accounts you have delegated to though. Is this persisted outside of the agent store in the browser?

@fforbeck fforbeck moved this from Sprint Backlog to In Progress in Storacha Project Planning Sep 18, 2024
fforbeck added a commit to storacha/w3up that referenced this issue Sep 20, 2024
# Add `shareSpace()` Method to Allow Sharing Spaces with Other Accounts

## Summary

This PR introduces a new `shareSpace()` method that allows users to
delegate access to an existing space with another Storacha account via
email. This feature enhances collaboration by enabling multiple accounts
to share access to a space, making data sharing more flexible.
By default, the following capabilities/permissions are set:
- space/* - for managing space metadata
- store/* - for managing stores
- upload/*- for registering uploads
- access/* - for re-delegating access to other devices
- filecoin/* - for submitting to the filecoin pipeline
- usage/* - for querying usage

## Changes

### New Feature: **Space Sharing**

- **Added `shareSpace()` Method**:
- The `shareSpace()` method allows users to share an existing space with
another Storacha account by delegating access to the specified email
address.
  - The method takes in the following options:
    - `space`: The space to be shared, identified by its DID.
- `delegateEmail`: The email address of the account to share the space
with.
  - The sharing process involves:
1. **Creating a delegation for the delegate account**: This ensures that
the delegate has access to the space.
2. **Delegating access**: Space access is delegated to the provided
email account, allowing the delegate to manage and access the space.
- If the sharing process fails, the method throws an error detailing the
issue.


## How to Test

1. Run the following commands:
```bash
npm run build && npm run test
```
2. Ensure all existing tests pass.

3. Verify that the new test cases for the `shareSpace()` method function
correctly.

## Related Issues

- [Issue #130](storacha/project-tracking#130):
Enable space sharing between accounts.

## Additional Notes

This implementation opens the door for future enhancements, such as
specifying different permission levels when sharing spaces.
@fforbeck
Copy link
Member

This is merged to the main branch and deployed to staging: https://www.loom.com/share/119d933569244e678fa3a899ea0d05ce?sid=0c9e8b2b-6178-44d8-996f-80ed058af35f

@fforbeck fforbeck moved this from In Progress to Done in Storacha Project Planning Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants