dleq

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package dleq provides a sub-api built on top of the go-dleq package for our atomic swaps. The API allows you to verify that a Monero public spend key on the ed25519 curve have the same discrete logarithm (same shared secret) as a public key on the secp256k1 curve. A ZK DLEq proof is used to prove equivalence of the secret key corresponding to public keys on both curves.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultDLEq

type DefaultDLEq = GoDLEq

DefaultDLEq is the default DLEq prover. Currently, the only implementation is GoDLEq.

type GoDLEq

type GoDLEq struct{}

GoDLEq is a wrapper around the go-dleq library prover and verifier.

func (*GoDLEq) Prove

func (d *GoDLEq) Prove() (*Proof, error)

Prove generates a secret scalar and a proof that it has a corresponding public key on the secp256k1 and ed25519 curves.

func (*GoDLEq) Verify

func (d *GoDLEq) Verify(p *Proof) (*VerifyResult, error)

Verify verifies the given proof. It returns the secp256k1 and ed25519 public keys corresponding to the secret value.

type Interface

type Interface interface {
	Prove() (*Proof, error)
	Verify(*Proof) (*VerifyResult, error)
}

Interface ...

type Proof

type Proof struct {
	// contains filtered or unexported fields
}

Proof represents a DLEq proof

func NewProofWithoutSecret

func NewProofWithoutSecret(p []byte) *Proof

NewProofWithoutSecret returns a new Proof without a secret from the given proof slice

func (*Proof) Proof

func (p *Proof) Proof() []byte

Proof returns the encoded DLEq proof

func (*Proof) Secret

func (p *Proof) Secret() [32]byte

Secret returns the proof's 32-byte secret

type VerifyResult

type VerifyResult struct {
	// contains filtered or unexported fields
}

VerifyResult contains the public keys resulting from verifying a DLEq proof

func (*VerifyResult) Ed25519PublicKey

func (r *VerifyResult) Ed25519PublicKey() *mcrypto.PublicKey

Ed25519PublicKey returns the ed25519 public key associated with the DLEq verification

func (*VerifyResult) Secp256k1PublicKey

func (r *VerifyResult) Secp256k1PublicKey() *secp256k1.PublicKey

Secp256k1PublicKey returns the secp256k1 public key associated with the DLEq verification

Jump to

Keyboard shortcuts

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