Skip to content

refactor: revisit marshaling interfaces #49

@setrofim

Description

@setrofim

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions