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

Builder.delegateCapability fails for tokens originating from delegation #86

Open
dholms opened this issue Aug 15, 2022 · 1 comment
Open

Comments

@dholms
Copy link
Collaborator

dholms commented Aug 15, 2022

delegateCapability on the Builder API passes the issuer as both audience and requiredIssuer to Store.findWithCapability.

This works if the UCAN you are looking for has the capability by parenthood but not if the capability came from delegation

https://github.com/ucan-wg/ts-ucan/blob/main/packages/core/src/builder.ts#L224

@matheus23
Copy link
Member

matheus23 commented Aug 17, 2022

Yeah, right.

It seems like we'd need to actually provide the expected rootIssuer to delegateCapability, in case a Store was passed to it.

Maybe delegateCapability should just be two functions with two different signatures.

  • delegateCapability(requiredCapability: Capability, proof: DelegationChain, semantics: DelegationSemantics) and
  • delegateCapabilityFromStore(requiredCapability: Capability, rootIssuer: string, store: Store)

Possibly with better names 😅

Maybe we can drop the Capability, so it's just delegate and delegateFromStore. And simplify the param name from requiredCapability to capability.

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