Documentation ¶
Overview ¶
Package dagjose is an implementation of the IPLD codec.
Data that is encoded using the dag-jose multicodec is guaranteed to be a CBOR encoding of the general serialization of either a JWE or a JWS. In order to access this information using go-ipld-prime we need two things:
* We need to register an encoder and a encoder which will be used by the cidlink package to decode the raw data into the IPLD data model
* An implementation of ipld.NodeAssembler which knows how to interpret the IPLD data into some concrete go data type which implements ipld.Node
The first of these points is handled by importing this package. There is a side effecting operation in the module initialiation which registers the encoder and decoder with go-ipld-prime.
The latter point is provided by the dagjose.DagJOSE data type. This type represents the union of the dagjose.DagJWS and dagjose.DagJWE types. Typically you will use dagjose.LoadJOSE(..) to load a dagjose.DagJOSE object, then you will use DagJOSE.AsJWS and DagJOSE.AsJWE to determine whether you have a JWS or JWE object respectively.
This package does not provide any direct access to the fields of the JWS and JWE objects, instead each kind of JOSE object has a GeneralJSONSerialization method which can be used to obtain the general json serialization to be passed to third party libraries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBuilder ¶
func NewBuilder() ipld.NodeBuilder
Returns an instance of the DagJOSENodeBuilder which can be passed to ipld.Link.Load and will build a dagjose.DagJOSE object. This should only be neccesary in reasonably advanced situations, most of the time you should be able to use dagjose.LoadJOSE
Types ¶
type DagJOSE ¶
type DagJOSE struct {
// contains filtered or unexported fields
}
This is a union of the DagJWE and DagJWS types. Typically you will want to use AsJWE and AsJWS to get a concrete JOSE object.
func (*DagJOSE) AsJWE ¶
If this jose object is a JWE then this will return a DagJWE, if it is a JWS then AsJWE will return nil
type DagJOSENodePrototype ¶
type DagJOSENodePrototype struct{}
func (*DagJOSENodePrototype) NewBuilder ¶
func (d *DagJOSENodePrototype) NewBuilder() ipld.NodeBuilder
type DagJWE ¶
type DagJWE struct {
// contains filtered or unexported fields
}
func ParseJWE ¶
Given a JSON string reresenting a JWE in either general or compact serialization this will return a DagJWE
func (*DagJWE) AsJOSE ¶
Returns a DagJOSE object that implements ipld.Node and can be passed to ipld related infrastructure
func (*DagJWE) FlattenedSerialization ¶
Return the flattened json serialization of this JWE
func (*DagJWE) GeneralJSONSerialization ¶
Return the general json serialization of this JWE
type DagJWS ¶
type DagJWS struct {
// contains filtered or unexported fields
}
func ParseJWS ¶
Given a JSON string reresenting a JWS in either general or compact serialization this will return a DagJWS
func (*DagJWS) AsJOSE ¶
Returns a DagJOSE object that implements ipld.Node and can be passed to ipld related infrastructure
func (*DagJWS) FlattenedSerialization ¶
Return the flattened json serialization of this JWS
func (*DagJWS) GeneralJSONSerialization ¶
Return the general json serialization of this JWS