Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: more conventional marshaling
This commit refactors marshaling API. It has two objectives: - Align how marshaling works with conventional Go practices, ensuring new users familiar with other Go libraries have minimal surprises. - Minimize the impact of marshaling on IClaims interface, relieving the burden on current and future implementations. To that end, the following changes are made: - From/To* marshaling API are replaced with implementations of standard cbor and json marshaling interfaces (i.e. Unmasrshal/Marshal*). As per convention, these implementations do not validate. - There are no validating versions of marshaling methods (thus no requirement for every IClaims implementation to re-implement them). Instead, there are convenience functions that instantiate, marshal, and validate in a single call. - The functions have been renamed such that Decode* now only performs unmarshaling, and DecodeAndValidate* unmarshals and validates. - Decoding/Encoding functions for IClaims have been moved from profile.go to iclaims.go. note: this is implemented on top of a similar refactor inside psatoken BREAKING CHANGE: the From/To marshaling API have been removed; Decode* functions have been renamed to be consistent with marshaling (rather then DecodeXXX--that validates--and DecodeUnvalidatedXXX, there is now DecodeAndValidateXXX and DecodeXXX--that does not validate). Signed-off-by: Sergei Trofimov <sergei.trofimov@arm.com>
- Loading branch information