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

Add support for custom token types through generics #39

Merged
merged 7 commits into from
Sep 16, 2024
Merged

Conversation

aidantwoods
Copy link
Owner

@aidantwoods aidantwoods commented May 12, 2023

Adds support for converting custom structs into PASETO tokens, without needing to manually copy claims over one by one.

This change also permits a PASETO token to be parsed into a custom type, where the type system can be take advantage of to interface with claims.

In order to retain the non-failableness of certain crypto methods
we move encoding outside of the crypto execution to permit callers
to do encoding first (which may fail) and then perform the crypto
call (which generally is guaranteed to succeed with no error handling
required).
This should hopefully avoid any confusion that this is somehow
a fully formed token (mistaking "encoded" for "encryped" in the
prior name).
@aidantwoods aidantwoods merged commit 9bc11b0 into main Sep 16, 2024
13 checks passed
@aidantwoods aidantwoods deleted the generic-api branch September 16, 2024 21:30
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