serde

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README

Serde

Serialization and deserialization utilities using CBOR (Concise Binary Object Representation) format.

Features

  • CBOR Encoding/Decoding - Generic functions for marshaling and unmarshaling data
  • Type Registration - Register types with CBOR tags for deterministic serialization
  • Tagged Serialization - Serialize values with explicit CBOR tags
  • Strict Validation - Enforces strict decoding rules (no duplicate keys, required tags, etc.)

Built on fxamacker/cbor with deterministic encoding for cryptographic applications.

Documentation

Overview

Package serde provides serialisation and deserialization utilities using CBOR (Concise Binary Object Representation) format.

See README.md for details.

Index

Constants

View Source
const (
	DefaultMaxArrayElements = 131072
	DefaultMaxMapPairs      = 131072
	DefaultMaxNestedLevels  = 32
)

Variables

View Source
var (
	ErrSerialisation   = errs.New("serialisation error")
	ErrDeserialisation = errs.New("deserialisation error")
)

Functions

func MarshalCBOR

func MarshalCBOR[T any](t T) ([]byte, error)

MarshalCBOR serialises the given value to CBOR format.

func MarshalCBORTagged

func MarshalCBORTagged[T any](t T, tag uint64) ([]byte, error)

MarshalCBORTagged serialises the given value to CBOR format with the specified tag.

func Register

func Register[T any](tag uint64)

Register registers the concrete type parameter T with a fixed CBOR tag.

func UnmarshalCBOR

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

UnmarshalCBOR deserialises the given CBOR data into the specified type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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