zkidentity

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: ISC Imports: 9 Imported by: 0

Documentation

Overview

zkidentity package manages public and private identities.

Index

Constants

View Source
const (
	IdentitySize = sha256.Size
)

Variables

View Source
var (
	ErrNotEqual = errors.New("not equal")
	ErrVerify   = errors.New("verify error")
)

Functions

func Fingerprint

func Fingerprint(id [IdentitySize]byte) string

func String2ID

func String2ID(to string) (*[32]byte, error)

Types

type FullIdentity

type FullIdentity struct {
	Public        PublicIdentity
	PrivateSigKey [ed25519.PrivateKeySize]byte
	PrivateKey    [sntrup4591761.PrivateKeySize]byte
}

func New

func New(name, nick string) (*FullIdentity, error)

func UnmarshalFullIdentity

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

func (*FullIdentity) Marshal

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

func (*FullIdentity) RecalculateDigest

func (fi *FullIdentity) RecalculateDigest() error

func (*FullIdentity) SignMessage

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

type PublicIdentity

type PublicIdentity struct {
	Name      string
	Nick      string
	SigKey    [ed25519.PublicKeySize]byte
	Key       [sntrup4591761.PublicKeySize]byte
	Identity  [sha256.Size]byte
	Digest    [sha256.Size]byte           // digest of name, keys and identity
	Signature [ed25519.SignatureSize]byte // signature of Digest
}

A zkc public identity consists of a name and nick (e.g "John Doe" and "jd" respectively), a ed25519 public signature key, and a NTRU Prime public key (used to derive symmetric encryption keys). An extra Identity field, taken as the SHA256 of the NTRU public key, is used as a short handle to uniquely identify a user in various zkc structures.

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) String

func (p PublicIdentity) String() string

func (*PublicIdentity) Verify

func (p *PublicIdentity) Verify() bool

func (PublicIdentity) VerifyMessage

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

Jump to

Keyboard shortcuts

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