Documentation ¶
Index ¶
Constants ¶
View Source
const ( CtxDIDv1 = "https://www.w3.org/ns/did/v1" CtxSecEd25519_2020v1 = "https://w3id.org/security/suites/ed25519-2020/v1" CtxSecX25519_2019v1 = "https://w3id.org/security/suites/x25519-2019/v1" )
View Source
const ( MCed25519 = 0xED MCP256 = 0x1200 MCSecp256k1 = 0xe7 KeyTypeSecp256k1 = "EcdsaSecp256k1VerificationKey2019" KeyTypeP256 = "EcdsaSecp256r1VerificationKey2019" KeyTypeEd25519 = "Ed25519VerificationKey2020" KeyTypeMultikey = "Multikey" )
View Source
const (
TEd25519 = "ed25519"
)
Variables ¶
View Source
var (
ErrInvalidSignature = fmt.Errorf("invalid signature")
)
Functions ¶
func VerifyDocumentSignature ¶
func VerifyDocumentSignature(sd *SignedDocument, pubk ed25519.PublicKey) error
Types ¶
type DID ¶
type DID struct {
// contains filtered or unexported fields
}
func DIDFromKey ¶
func OldDIDFromKey ¶
OldDIDFromKey is specific to ed25519.PublicKey and is the other way this package used to construct DIDs, using an encoding method that was inconsistent with itself.
func (DID) MarshalJSON ¶
func (*DID) UnmarshalJSON ¶
type Document ¶
type Document struct { Context []string `json:"@context"` ID DID `json:"id"` AlsoKnownAs []string `json:"alsoKnownAs"` Authentication []interface{} `json:"authentication"` VerificationMethod []VerificationMethod `json:"verificationMethod"` Service []Service `json:"service"` }
type PubKey ¶
func PubKeyFromDIDString ¶
func (*PubKey) MultibaseString ¶
type PublicKeyJwk ¶
func (*PublicKeyJwk) GetRawKey ¶
func (pk *PublicKeyJwk) GetRawKey() (interface{}, error)
func (*PublicKeyJwk) MarshalJSON ¶
func (pkj *PublicKeyJwk) MarshalJSON() ([]byte, error)
func (*PublicKeyJwk) UnmarshalJSON ¶
func (pkj *PublicKeyJwk) UnmarshalJSON(b []byte) error
type SignedDocument ¶
type SignedDocument struct { Signature *Signature `json:"signature"` Document *Document `json:"document"` }
func SignDocument ¶
func SignDocument(doc *Document, k ed25519.PrivateKey) (*SignedDocument, error)
type VerificationMethod ¶
type VerificationMethod struct { ID string `json:"id"` Type string `json:"type"` Controller string `json:"controller"` PublicKeyJwk *PublicKeyJwk `json:"publicKeyJwk,omitempty"` PublicKeyMultibase *string `json:"publicKeyMultibase,omitempty"` // contains filtered or unexported fields }
func VerificationMethodFromKey ¶
func VerificationMethodFromKey(k *PubKey) (*VerificationMethod, error)
func (*VerificationMethod) GetPublicKey ¶
func (vm *VerificationMethod) GetPublicKey() (*PubKey, error)
Click to show internal directories.
Click to hide internal directories.