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

refactor: revisit marshaling interfaces #49

Open
setrofim opened this issue Jul 18, 2024 · 0 comments
Open

refactor: revisit marshaling interfaces #49

setrofim opened this issue Jul 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@setrofim
Copy link
Contributor

setrofim commented Jul 18, 2024

When originally implmented, psatoken eschewed the "standard" marshaler/unmarshaler interfaces defined by the encoding libraries (e.g. UnmarshalCBOR) and defined its own methods (e.g FromCBOR) that tied validation and marshaling. This proved problematic in some situations, so "unvalidated" versions of the methods were later added (e.g. FromUnvalidatedCBOR), which did not do validation as part marshaling. As a result, the current marshaling solution deviates from Golang norms and is confusing.

Proposed solution: we should switch to standard (un)marshaler interface implementations (i.e. just implement MarshalCBOR, UnmarshalCBOR, MarshalJSON, and UnmarshalJSON), and perform validation as a distinct operation.

@setrofim setrofim added the enhancement New feature or request label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant