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

Delegation should have method for listing capabilities it delegates #254

Open
Gozala opened this issue Mar 11, 2023 · 3 comments
Open

Delegation should have method for listing capabilities it delegates #254

Gozala opened this issue Mar 11, 2023 · 3 comments

Comments

@Gozala
Copy link
Collaborator

Gozala commented Mar 11, 2023

Problem

Given that we have support for can: * and with: ucan:* it is no longer clear just by looking at the .capabilities what resources and actions are delegated by the specific delegation. In most cases { can: *, with: ucan:* } would be re-delegating capabilities from the linked proofs.

Proposal

It would be a good idea to introduce new function into the @ucanto/core that allows querying capabilities provided, which could look something along the lines of:

interface Extension {
  allows(delegation: Delegation, match?: Allows): Allows
}

interface Allows {
  [key:Resource]: {
     [key:Ability]: Record<string, unknown>[]
  }
}

Note that it maps the structure we're considering in next version of UCANs, but it also provides more convenient way to identify resources (spaces). Optional match also seems like good way to check for specific capability without having to iterate over results and what not.

I would expect implementation to go down the delegation chain until it's able to loose all the * or until it reaches the bottom.

It would be nice to provide a way to consider linked proofs that aren't included, but it's probably out of scope here.

Doing validation is also tempting but I think it should be out of scope here as well.

@gobengo
Copy link
Contributor

gobengo commented Mar 11, 2023

sounds super useful!

@gobengo
Copy link
Contributor

gobengo commented Mar 24, 2023

I think this is done via #259 . @Gozala wdyt?

@Gozala
Copy link
Collaborator Author

Gozala commented Mar 24, 2023

I think this is done via #259 . @Gozala wdyt?

Almost unlike proposal #259 does not allow you to select via match, so I'll keep this open until it's implemented

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

No branches or pull requests

2 participants