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(ucanto): capability create / inovke methods #51

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

Gozala
Copy link
Collaborator

@Gozala Gozala commented Jun 23, 2022

This PR adds following features:

  1. derives is now optional in capability({ ... }). If not provided will use a default which:

    1. Verifies that claimed.with is same as delegated.with or that claimed.with is inside delegated.with if later ends with *.
    2. Verifies that all the delegated.caveats are same on claimed.caveats.

    In many instances you'd need to define custom derives, but I think sane default is probably a good idea.

  2. Capabilities defined with capability() now have .create({ with: resource, caveats: { ... } }) function which:

    1. Will create capability object with desired can field.
    2. Will pass inputs through decoders to avoid creating ones that will fail to parse on the other end.
    3. Will throw error if parameters are invalid.
  3. Capabilities defined with capability() now have .invoke({ ... }) function which is just like .create above, except it also takes issuer, audience and rest of the invocation specific options and returns IssuedInvocation

  4. IssuedInvocation now has delegate() method hopefully this sugar makes it less confusing delegate(invocation))

  5. invoke previously ignored things like expration etc... which is fixed now.

@Gozala Gozala requested a review from hugomrdias June 23, 2022 09:02
@Gozala Gozala merged commit ddf56b1 into main Jun 23, 2022
@hugomrdias hugomrdias deleted the feat/capability-invoke branch June 23, 2022 10:34
@Gozala Gozala mentioned this pull request Dec 2, 2022
This was referenced Dec 14, 2022
@github-actions github-actions bot mentioned this pull request Apr 11, 2023
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.

1 participant