Documentation
¶
Index ¶
- Variables
- type Reader
- func (ctn Reader) GetAllDelegations() iter.Seq2[cid.Cid, *delegation.Token]
- func (ctn Reader) GetAllInvocations() iter.Seq2[cid.Cid, *invocation.Token]
- func (ctn Reader) GetDelegation(cid cid.Cid) (*delegation.Token, error)
- func (ctn Reader) GetInvocation() (*invocation.Token, error)
- func (ctn Reader) GetToken(cid cid.Cid) (token.Token, error)
- type Writer
- func (ctn Writer) AddSealed(data []byte)
- func (ctn Writer) ToBase64StdPadding() (string, error)
- func (ctn Writer) ToBase64StdPaddingGzipped() (string, error)
- func (ctn Writer) ToBase64StdPaddingGzippedWriter(w io.Writer) error
- func (ctn Writer) ToBase64StdPaddingWriter(w io.Writer) error
- func (ctn Writer) ToBase64URL() (string, error)
- func (ctn Writer) ToBase64URLGzip() (string, error)
- func (ctn Writer) ToBase64URLGzipWriter(w io.Writer) error
- func (ctn Writer) ToBase64URLWriter(w io.Writer) error
- func (ctn Writer) ToBytes() ([]byte, error)
- func (ctn Writer) ToBytesGzipped() ([]byte, error)
- func (ctn Writer) ToBytesGzippedWriter(w io.Writer) error
- func (ctn Writer) ToBytesWriter(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
var EmptyCid = cid.MustParse([]byte{01, 55, 00, 00})
EmptyCid is a "zero" Cid: zero-length "identity" multihash with "raw" codec It can be used to have at least one root in a CARv1 file (making it legal), yet denote that it can be ignored.
var ErrMultipleInvocations = fmt.Errorf("multiple invocations")
var ErrNotFound = fmt.Errorf("not found")
Functions ¶
This section is empty.
Types ¶
type Reader ¶
Reader is a token container reader. It exposes the tokens conveniently decoded.
func FromReader ¶
FromReader decodes a container from an io.Reader.
func FromString ¶
FromString decodes a container from a string
func (Reader) GetAllDelegations ¶
func (ctn Reader) GetAllDelegations() iter.Seq2[cid.Cid, *delegation.Token]
GetAllDelegations returns all the delegation.Token in the container.
func (Reader) GetAllInvocations ¶
func (ctn Reader) GetAllInvocations() iter.Seq2[cid.Cid, *invocation.Token]
GetAllInvocations returns all the invocation.Token in the container.
func (Reader) GetDelegation ¶
func (ctn Reader) GetDelegation(cid cid.Cid) (*delegation.Token, error)
GetDelegation is the same as GetToken but only return a delegation.Token, with the right type. If not found, delegation.ErrDelegationNotFound is returned.
func (Reader) GetInvocation ¶
func (ctn Reader) GetInvocation() (*invocation.Token, error)
GetInvocation returns a single invocation.Token. If none are found, ErrNotFound is returned. If more than one invocation exists, ErrMultipleInvocations is returned.
type Writer ¶
type Writer map[string]struct{}
Writer is a token container writer. It provides a convenient way to aggregate and serialize tokens together.
func (Writer) AddSealed ¶
AddSealed includes a "sealed" token (serialized with a ToSealed* function) in the container.
func (Writer) ToBase64StdPadding ¶
ToBase64StdPadding encode the container into a base64 string, with standard encoding and padding.
func (Writer) ToBase64StdPaddingGzipped ¶
ToBase64StdPaddingGzipped encode the container into a pre-gzipped base64 string, with standard encoding and padding.
func (Writer) ToBase64StdPaddingGzippedWriter ¶
ToBase64StdPaddingGzippedWriter is the same as ToBase64StdPaddingGzipped, but with an io.Writer.
func (Writer) ToBase64StdPaddingWriter ¶
ToBase64StdPaddingWriter is the same as ToBase64StdPadding, but with an io.Writer.
func (Writer) ToBase64URL ¶
ToBase64URL encode the container into base64 string, with URL-safe encoding and no padding.
func (Writer) ToBase64URLGzip ¶
ToBase64URL encode the container into pre-gzipped base64 string, with URL-safe encoding and no padding.
func (Writer) ToBase64URLGzipWriter ¶
ToBase64URLWriter is the same as ToBase64URL, but with an io.Writer.
func (Writer) ToBase64URLWriter ¶
ToBase64URLWriter is the same as ToBase64URL, but with an io.Writer.
func (Writer) ToBytesGzipped ¶
ToBytesGzipped encode the container into gzipped bytes.
func (Writer) ToBytesGzippedWriter ¶
ToBytesGzippedWriter is the same as ToBytesGzipped, but with an io.Writer.