Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidFragment = errors.New("fragment must be a valid NanoID") ErrMissingFragment = errors.New("missing fragment") ErrInvalidDID = errors.New("invalid DID") ErrEmptyDID = errors.New("empty DID") ErrDIDIsNil = errors.New("DID is nil") ErrInvalidPrefix = fmt.Errorf("invalid prefix. Must start with %s", ma.DID_PREFIX) ErrInvalidFormat = errors.New("invalid DID format, must contain both an identifier and a fragment and nothing else") ErrInvalidIdentifier = errors.New("identifier must be a valid IPNS name") ErrMissingIdentifier = errors.New("missing identifier") ErrIPFSKeyNotFound = errors.New("ipfsKey not found") )
Functions ¶
func AreIdentical ¶
AreIdentical checks if two DIDs have the same ID, ignoring the fragment. This is a stretched interpretation of the word Identical, but I couldn't help myself. It means they are derived from the same key, which makes them Identical in my book.
Types ¶
type DID ¶
type DID struct { // The Id is the full DID Id string // The Identifier is the IPNS name without the /ipns/ prefix Identifier string // The fragment is a NanoID that is used to identify the entity locally Fragment string }
func GetOrCreate ¶ added in v0.6.1
Creates a new DID my actually creating or fetching a new key in IPFS And get the names - notably the IPNS name from there.
func New ¶
This creates a new DID from an identifier. This is the base function for all the rest. The identitifier is the IPNS name and the fragment is the key shortname, eg did:ma:k51qzi5uqu5dj9807pbuod1pplf0vxh8m4lfy3ewl9qbm2s8dsf9ugdf9gedhr#bahner
Remember that is needs to pre-exist in IPFS or be published to IPFS to be useful.