Documentation
¶
Index ¶
- Variables
- func AreIdentical(did1 *DID, did2 *DID) bool
- func GenerateFragment() string
- func GetFragment(did string) string
- func GetIdentifier(did string) string
- func IsValidDID(didStr string) bool
- func IsValidFragment(str string) bool
- func IsValidIdentifier(identifier string) bool
- func ValidateDID(didStr string) error
- type DID
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidID = errors.New("invalid ID") ErrInvalidFragment = errors.New("invalid fragment") )
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.
func GenerateFragment ¶
func GenerateFragment() string
func GetFragment ¶
func GetIdentifier ¶
func IsValidDID ¶
func IsValidFragment ¶
This simply checks that the string is a valid nanoID, prefixed with a "#".
func IsValidIdentifier ¶
func ValidateDID ¶
Types ¶
type DID ¶
type DID struct { // The identifier is the IPNS name without the /ipns/ prefix Identifier string // The Fragment is the key shortname and internal name for the key Fragment string }
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.
func (*DID) IsIdenticalTo ¶
Click to show internal directories.
Click to hide internal directories.