key

package
v0.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// KEY_AGREEMENT_MULTICODEC_STRING = "x25519-pub"
	KEY_AGREEMENT_MULTICODEC = mc.X25519Pub
	KEY_AGREEMENT_KEY_TYPE   = "MultiKey"
)
View Source
const (
	ASSERTION_METHOD_KEY_TYPE   = "MultiKey"
	ASSERTION_METHOD_MULTICODEC = mc.Ed25519Pub
)

Variables

View Source
var (
	ErrNoType                     = errors.New("key has no type")
	ErrInvalidAssertionMethodType = fmt.Errorf("key type must be %s", ASSERTION_METHOD_KEY_TYPE)
	ErrInvalidKeyAgreementType    = fmt.Errorf("key type must be %s", KEY_AGREEMENT_KEY_TYPE)
	ErrNoPrivateKey               = errors.New("key has no private key")
	ErrNoPublicKey                = errors.New("key has no public key")
	ErrNoPublicKeyMultibase       = errors.New("key has no public key multibase")
	ErrInvalidPublicKeyMultibase  = errors.New("invalid public key multibase")
	ErrInvalidMulticodec          = errors.New("invalid multicodec")
)

Functions

func GenerateSymmetricKey

func GenerateSymmetricKey(shared []byte, size int, label []byte) []byte

Generate a symmetric key from a shared secret.

Types

type EncryptionKey

type EncryptionKey struct {
	DID                did.DID
	Type               string
	PrivKey            [32]byte // Private key
	PubKey             [32]byte // Public key
	PublicKeyMultibase string
}

func NewEncryptionKey

func NewEncryptionKey(identifier string) (EncryptionKey, error)

func (EncryptionKey) IsValid added in v0.6.0

func (k EncryptionKey) IsValid() bool

func (EncryptionKey) Verify added in v0.6.0

func (k EncryptionKey) Verify() error

type SigningKey

type SigningKey struct {
	DID                did.DID
	Type               string
	PrivKey            ed25519.PrivateKey
	PubKey             ed25519.PublicKey
	PublicKeyMultibase string
}

func NewSigningKey

func NewSigningKey(identifier string) (SigningKey, error)

Generates a signing key for the given identifier, ie. IPNS name

func (SigningKey) IsValid added in v0.6.0

func (s SigningKey) IsValid() bool

func (*SigningKey) Sign

func (k *SigningKey) Sign(data []byte) ([]byte, error)

func (SigningKey) Verify added in v0.6.0

func (s SigningKey) Verify() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL