identity

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2019 License: ISC Imports: 8 Imported by: 10

Documentation

Overview

zkidentity package manages public and private identities.

Index

Constants

View Source
const (
	PrivateKeySize = ed25519.PrivateKeySize
	SignatureSize  = ed25519.SignatureSize
	PublicKeySize  = ed25519.PublicKeySize
)

Variables

View Source
var (
	ErrNotEqual         = errors.New("not equal")
	ErrInvalidSignature = errors.New("invalid signature")
)

Functions

func SignatureFromString

func SignatureFromString(signature string) (*[SignatureSize]byte, error)

Types

type FullIdentity

type FullIdentity struct {
	Public     PublicIdentity       // public key
	PrivateKey [PrivateKeySize]byte // private key, exported for marshaling
}

func LoadFullIdentity

func LoadFullIdentity(filename string) (*FullIdentity, error)

func New

func New() (*FullIdentity, error)

func UnmarshalFullIdentity

func UnmarshalFullIdentity(data []byte) (*FullIdentity, error)

func (*FullIdentity) Marshal

func (fi *FullIdentity) Marshal() ([]byte, error)

func (*FullIdentity) Save

func (fi *FullIdentity) Save(filename string) error

func (*FullIdentity) SignMessage

func (fi *FullIdentity) SignMessage(message []byte) [SignatureSize]byte

type PublicIdentity

type PublicIdentity struct {
	Key [PublicKeySize]byte // public key
}

func LoadPublicIdentity

func LoadPublicIdentity(filename string) (*PublicIdentity, error)

func PublicIdentityFromBytes

func PublicIdentityFromBytes(data []byte) (*PublicIdentity, error)

func UnmarshalPublicIdentity

func UnmarshalPublicIdentity(data []byte) (*PublicIdentity, error)

func (PublicIdentity) Fingerprint

func (p PublicIdentity) Fingerprint() string

func (*PublicIdentity) Marshal

func (p *PublicIdentity) Marshal() ([]byte, error)

func (*PublicIdentity) SavePublicIdentity

func (pi *PublicIdentity) SavePublicIdentity(filename string) error

func (PublicIdentity) String

func (p PublicIdentity) String() string

func (PublicIdentity) VerifyMessage

func (p PublicIdentity) VerifyMessage(msg []byte, sig [SignatureSize]byte) bool

Jump to

Keyboard shortcuts

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