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

Implement 0.8 spec #52

Merged
merged 2 commits into from
Mar 29, 2022
Merged

Implement 0.8 spec #52

merged 2 commits into from
Mar 29, 2022

Conversation

icidasset
Copy link
Member

@icidasset icidasset commented Feb 18, 2022

This PR implements the 0.8.1 spec and thus closes #47.

The biggest change involves attenuations. I've taken the capability types, revised them to the new spec, taken them out of the types.ts module and split them up in several parts under src/capabilities/, plus the top level src/capabilities.ts module. Each module in there has the types, utility functions, encoders/decoders, type checking functions, etc.

Notes:

  • Introduced semver version parsing in the compatibility module
  • Legacy UCAN version 0.0.1 has been changed to 0.3.0
  • Categorised things in the types module
  • Moved WNFS things to tests, should be moved to webnative in the future.
  • Moved tests/emailCapabilities.ts to tests/capabilities/email.ts

Todo/Questions:

  • Do we need additional utility functions for the capabilities?
  • Do we need more spec enforcing? (ie. such as enforcing the URI format for capability resource pointers)
  • Does the spec enforcing cause any issues anywhere? (eg. check encoding/decoding of URI format of resource pointers)
  • Did I miss anything in the spec? (go over spec once more)

@icidasset icidasset marked this pull request as ready for review March 21, 2022 17:19
with: resourcePointer.prf(selector),
can: ability
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we have functions for wnfs and email too? I realise they're not part of the spec, but could be helpful?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm 🤔 For now I think we should keep them outside the public API 👍

@icidasset
Copy link
Member Author

I think this PR also partially implements #43? It's got some utility functions for creating prf capabilities and for superuser* resources/abilities.

In capability checking it essentially allows you to "forward" who the "originator" is for all capabilities without having to mention concrete capabilities.

@matheus23 Do you think that after my 0.8 changes we need to adjust the CapabilitySemantics parsing/delegating?

README.md Outdated Show resolved Hide resolved
src/token.ts Show resolved Hide resolved
Copy link
Contributor

@bgins bgins left a comment

Choose a reason for hiding this comment

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

Looks great! Love how the customizable capability semantics have come out here. 💯 🎉

@icidasset
Copy link
Member Author

I'll wait for @matheus23 to give this a look as well.

Copy link
Member

@matheus23 matheus23 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! :) Thanks for reorganizing a bit & cleaning stuff up, too 🙏

@matheus23 Do you think that after my 0.8 changes we need to adjust the CapabilitySemantics parsing/delegating?

Yep! But we should do that in another PR. Let's ship incrementally 🚢
If you have any questions about how that hairy capabilities iterator works today, feel free to ping me in discord.

Also we'll likely want some tests for this stuff, but I think that makes most sense with the new capability semantics/parsing stuff from above 👆

@icidasset icidasset merged commit 978dfd2 into main Mar 29, 2022
@icidasset icidasset deleted the icidasset/0.8 branch March 29, 2022 15:43
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.

Support UCAN 0.8.x
3 participants