webauthncbor

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: BSD-3-Clause Imports: 1 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

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

Marshal encodes the value pointed to by v following the CTAP2 canonical CBOR encoding form. (https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#message-encoding)

func Unmarshal

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

Unmarshal parses the CBOR-encoded data into the value pointed to by v following the CTAP2 canonical CBOR encoding form. (https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#message-encoding)

The data must hold exactly one CBOR item. Bytes which follow that item are malformed input rather than something to discard, so they are reported. Callers decoding an item embedded in a larger byte sequence want UnmarshalFirst.

func UnmarshalFirst added in v0.18.0

func UnmarshalFirst(data []byte, v any) (n int, err error)

UnmarshalFirst parses the first CBOR-encoded item in data into the value pointed to by v following the CTAP2 canonical CBOR encoding form, and returns the number of bytes of data which that item consumed. Callers which decode an item embedded in a larger byte sequence must use this rather than deriving a length from the re-encoded output of Marshal, as the encoded form is not guaranteed to be the same size as the form which was decoded.

Types

type RawMessage added in v0.18.0

type RawMessage = cbor.RawMessage

RawMessage is a raw encoded CBOR value, which callers can use to defer the decoding of a member whose shape depends on another member of the same structure. It is an alias so that a value of this type satisfies the underlying library's own marshalling interfaces, and exists so that consumers of this package do not have to import that library directly.

Jump to

Keyboard shortcuts

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