zk

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeECDSASecp256k1Signature

func DeserializeECDSASecp256k1Signature(sigBytes []byte) (*curves.EcdsaSignature, error)

func GetEncryptionKeyFromSecp256k1

func GetEncryptionKeyFromSecp256k1(publicKey PubKey) ([]byte, error)

func GetSecretFromSecp256k1

func GetSecretFromSecp256k1(publicKey PubKey) (*accumulator.SecretKey, error)

func RunIteratedProtocol

func RunIteratedProtocol(firstParty pv1.Iterator, secondParty pv1.Iterator) (error, error)

For DKG bob starts first. For refresh and sign, Alice starts first.

func SerializeECDSASecp256k1Signature

func SerializeECDSASecp256k1Signature(sig *curves.EcdsaSignature) ([]byte, error)

func StringListToZkElements

func StringListToZkElements(strs ...string) []accumulator.Element

func StringToZkElement

func StringToZkElement(str string) accumulator.Element

Types

type Accumulator

type Accumulator = accumulator.Accumulator

type Element

type Element = accumulator.Element

type KeyshareRole

type KeyshareRole string
const (
	// KeyshareRolePublic is the default role for the alice dkg
	KeyshareRolePublic KeyshareRole = "alice"

	// KeyshareRoleUser is the role for an encrypted keyshare for a user
	KeyshareRoleUser KeyshareRole = "bob"
)

type PubKey

type PubKey = cryptotypes.PubKey

type Secp256k1PublicKey

type Secp256k1PublicKey = *secp256k1.PubKey

type SecretKey

type SecretKey = accumulator.SecretKey

type ZKAccumulator

type ZKAccumulator = accumulator.Accumulator

type ZKEphemeralKey

type ZKEphemeralKey []byte

func GetEphemeralFromSecp256k1

func GetEphemeralFromSecp256k1(publicKey PubKey) (ZKEphemeralKey, error)

func (ZKEphemeralKey) String

func (zk ZKEphemeralKey) String() string

type ZKSet

type ZKSet string

func CreateZkSet

func CreateZkSet(publicKey PubKey, initialIds ...string) (ZKSet, error)

CreateZkSet creates a new ZKSet from a public key and a list of initial ids

func LoadZKSet

func LoadZKSet(str string) (ZKSet, error)

LoadZKSet loads a zero-knowledge set from a list of zero-knowledge proofs.

func NewZKSet

func NewZKSet(pubKey *crypto.Secp256k1PubKey, initialIds ...string) (ZKSet, error)

NewZKSet creates a new zero-knowledge set from a list of zero-knowledge proofs.

func OpenZkSet

func OpenZkSet(str string) (ZKSet, error)

OpenZkSet takes a plain string and returns a ZkSet on success

func (ZKSet) AddElement

func (c ZKSet) AddElement(pk PubKey, elem string) error

AddElement adds an element to the accumulator

func (ZKSet) Decrypt

func (c ZKSet) Decrypt(key PubKey, ciphertext []byte) ([]byte, error)

Decrypt decrypts a ciphertext using the public key

func (ZKSet) Encrypt

func (c ZKSet) Encrypt(key PubKey, bz []byte) ([]byte, error)

Encrypt encrypts a message with the ZKSet

func (ZKSet) GetAccumulator

func (s ZKSet) GetAccumulator() *ZKAccumulator

GetAccumulator returns the accumulator for the ZKSet

func (ZKSet) RemoveElement

func (c ZKSet) RemoveElement(pk PubKey, elem string) error

RemoveElement removes an element from the accumulator

func (ZKSet) SetAccumulator

func (s ZKSet) SetAccumulator(a *ZKAccumulator) error

SetAccumulator sets the accumulator for the ZKSet

func (ZKSet) String

func (s ZKSet) String() string

String returns the string representation of the ZKSet

func (ZKSet) ValidateMembership

func (c ZKSet) ValidateMembership(spk PubKey, elem string) bool

ValidateMembership validates that an element is a member of the set

Jump to

Keyboard shortcuts

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