Documentation ¶
Index ¶
- func FindTag(node datamodel.Node) (string, error)
- type Info
- type Marshaller
- type Token
- func Decode(b []byte, decFn codec.Decoder) (Token, error)
- func DecodeReader(r io.Reader, decFn codec.Decoder) (Token, error)
- func FromDagCbor(b []byte) (Token, error)
- func FromDagCborReader(r io.Reader) (Token, error)
- func FromDagJson(b []byte) (Token, error)
- func FromDagJsonReader(r io.Reader) (Token, error)
- func FromSealed(data []byte) (Token, cid.Cid, error)
- func FromSealedReader(r io.Reader) (Token, cid.Cid, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Marshaller ¶
type Marshaller interface { // ToSealed wraps the token in an envelope, generates the signature, encodes // the result to DAG-CBOR and calculates the CID of the resulting binary data. ToSealed(privKey crypto.PrivKey) ([]byte, cid.Cid, error) // ToSealedWriter is the same as ToSealed but accepts an io.Writer. ToSealedWriter(w io.Writer, privKey crypto.PrivKey) (cid.Cid, error) // Encode marshals a Token to the format specified by the provided codec.Encoder. Encode(privKey crypto.PrivKey, encFn codec.Encoder) ([]byte, error) // EncodeWriter is the same as Encode, but accepts an io.Writer. EncodeWriter(w io.Writer, privKey crypto.PrivKey, encFn codec.Encoder) error // ToDagCbor marshals the Token to the DAG-CBOR format. ToDagCbor(privKey crypto.PrivKey) ([]byte, error) // ToDagCborWriter is the same as ToDagCbor, but it accepts an io.Writer. ToDagCborWriter(w io.Writer, privKey crypto.PrivKey) error // ToDagJson marshals the Token to the DAG-JSON format. ToDagJson(privKey crypto.PrivKey) ([]byte, error) // ToDagJsonWriter is the same as ToDagJson, but it accepts an io.Writer. ToDagJsonWriter(w io.Writer, privKey crypto.PrivKey) error }
type Token ¶
type Token interface { Marshaller // IsValidNow verifies that the token can be used at the current time, based on expiration or "not before" fields. // This does NOT do any other kind of verifications. IsValidNow() bool // IsValidNow verifies that the token can be used at the given time, based on expiration or "not before" fields. // This does NOT do any other kind of verifications. IsValidAt(t time.Time) bool }
func Decode ¶
Decode unmarshals the input data using the format specified by the provided codec.Decoder into an arbitrary UCAN token. An error is returned if the conversion fails, or if the resulting Token is invalid. Supported and returned types are: - delegation.Token - invocation.Token
func DecodeReader ¶
DecodeReader is the same as Decode, but accept an io.Reader.
func FromDagCbor ¶
FromDagCbor unmarshals an arbitrary DagCbor encoded UCAN token. An error is returned if the conversion fails, or if the resulting Token is invalid. Supported and returned types are: - delegation.Token - invocation.Token
func FromDagCborReader ¶
FromDagCborReader is the same as FromDagCbor, but accept an io.Reader.
func FromDagJson ¶
FromDagCbor unmarshals an arbitrary DagJson encoded UCAN token. An error is returned if the conversion fails, or if the resulting Token is invalid. Supported and returned types are: - delegation.Token - invocation.Token
func FromDagJsonReader ¶
FromDagJsonReader is the same as FromDagJson, but accept an io.Reader.
func FromSealed ¶
FromSealed decodes an arbitrary token type from the binary data, verifies that the envelope's signature is correct based on the public key taken from the issuer (iss) field and calculates the CID of the incoming data. Supported and returned types are: - delegation.Token - invocation.Token
Directories ¶
Path | Synopsis |
---|---|
Package delegation implements the UCAN delegation specification with an immutable Token type as well as methods to convert the Token to and from the envelope-enclosed, signed and DAG-CBOR-encoded form that should most commonly be used for transport and storage.
|
Package delegation implements the UCAN delegation specification with an immutable Token type as well as methods to convert the Token to and from the envelope-enclosed, signed and DAG-CBOR-encoded form that should most commonly be used for transport and storage. |
delegationtest
Package delegationtest provides a set of pre-built delegation tokens for a variety of test cases.
|
Package delegationtest provides a set of pre-built delegation tokens for a variety of test cases. |
internal
|
|
envelope
Package envelope provides functions that convert between wire-format encoding of a [UCAN] token's [Envelope] and the Go type representing a verified [TokenPayload].
|
Package envelope provides functions that convert between wire-format encoding of a [UCAN] token's [Envelope] and the Go type representing a verified [TokenPayload]. |
varsig
Package varsig implements the portion of the [varsig specification] that's needed for the UCAN [Envelope].
|
Package varsig implements the portion of the [varsig specification] that's needed for the UCAN [Envelope]. |
Package invocation implements the UCAN invocation specification with an immutable Token type as well as methods to convert the Token to and from the envelope-enclosed, signed and DAG-CBOR-encoded form that should most commonly be used for transport and storage.
|
Package invocation implements the UCAN invocation specification with an immutable Token type as well as methods to convert the Token to and from the envelope-enclosed, signed and DAG-CBOR-encoded form that should most commonly be used for transport and storage. |