encoding

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DecMode, _ = DecOpts.DecMode()
View Source
var DecOpts = cbor.DecOptions{
	DupMapKey:        cbor.DupMapKeyEnforcedAPF,
	IndefLength:      cbor.IndefLengthForbidden,
	MaxArrayElements: 100_000,
	MaxMapPairs:      1_000_000,
	UTF8:             cbor.UTF8DecodeInvalid,
}
View Source
var EncMode, _ = EncOpts.EncMode()
View Source
var EncOpts = cbor.EncOptions{
	Sort:          cbor.SortBytewiseLexical,
	Time:          cbor.TimeRFC3339Nano,
	ShortestFloat: cbor.ShortestFloat16,
	NaNConvert:    cbor.NaNConvert7e00,
	InfConvert:    cbor.InfConvertFloat16,
	IndefLength:   cbor.IndefLengthForbidden,
	BigIntConvert: cbor.BigIntConvertNone,
}

Functions

func CheckSumHex

func CheckSumHex(data []byte) string

func DecodeQuoteString

func DecodeQuoteString(str string) ([]byte, error)

func DecodeQuoteStringWithLen

func DecodeQuoteStringWithLen(str string, expectedLen int) ([]byte, error)

func DecodeString

func DecodeString(str string) ([]byte, error)

DecodeString [str] to bytes from raw base64url.

func DecodeStringWithLen

func DecodeStringWithLen(str string, expectedLen int) ([]byte, error)

func EncodeToQuoteString

func EncodeToQuoteString(bytes []byte) string

func EncodeToString

func EncodeToString(bytes []byte) string

EncodeToString bytes to a string using raw base64url format.

func MarshalCBOR

func MarshalCBOR(v any) ([]byte, error)

func MarshalJSONData

func MarshalJSONData(data []byte) json.RawMessage

func MustMarshalCBOR

func MustMarshalCBOR(v any) []byte

func MustMarshalJSON added in v0.1.0

func MustMarshalJSON(v any) []byte

func Sum256

func Sum256(msg []byte) []byte

Sum256 returns the SHA3-256 digest of the data.

func UnmarshalCBOR

func UnmarshalCBOR(data []byte, v any) error

func UnmarshalCBORWithLen

func UnmarshalCBORWithLen(data []byte, expectedLen int) ([]byte, error)

func UnmarshalJSONData

func UnmarshalJSONData(data json.RawMessage) []byte

func ValidCBOR

func ValidCBOR(data []byte) error

Types

type RawData

type RawData []byte

func (RawData) MarshalJSON

func (r RawData) MarshalJSON() ([]byte, error)

func (*RawData) UnmarshalJSON

func (r *RawData) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL