Documentation
¶
Index ¶
- Variables
- type Commitment
- type MaurerOption
- type Protocol
- func (p *Protocol[I, P]) Anchor() sigma.Anchor[I, P]
- func (p *Protocol[I, P]) ComputeProverCommitment(_ *Statement[I], _ *Witness[P]) (*Commitment[I], *State[P], error)
- func (p *Protocol[I, P]) ComputeProverResponse(_ *Statement[I], witness *Witness[P], _ *Commitment[I], state *State[P], ...) (*Response[P], error)
- func (p *Protocol[I, P]) Extract(x *Statement[I], a *Commitment[I], ei []sigma.ChallengeBytes, ...) (*Witness[P], error)
- func (p *Protocol[I, P]) GetChallengeBytesLength() int
- func (p *Protocol[I, P]) ImageGroup() algebra.FiniteGroup[I]
- func (p *Protocol[I, P]) Name() sigma.Name
- func (p *Protocol[I, P]) Phi() sigma.OneWayHomomorphism[I, P]
- func (p *Protocol[I, P]) PreImageGroup() algebra.FiniteGroup[P]
- func (p *Protocol[I, P]) RunSimulator(statement *Statement[I], challengeBytes sigma.ChallengeBytes) (*Commitment[I], *Response[P], error)
- func (p *Protocol[G, S]) SoundnessError() uint
- func (*Protocol[I, P]) SpecialSoundness() uint
- func (p *Protocol[I, P]) ValidateStatement(statement *Statement[I], witness *Witness[P]) error
- func (p *Protocol[I, P]) Verify(statement *Statement[I], commitment *Commitment[I], ...) error
- type Response
- type State
- type Statement
- type Witness
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidArgument indicates missing or inconsistent inputs. ErrInvalidArgument = errs.New("invalid argument") // ErrValidationFails indicates malformed or invalid data. ErrValidationFails = errs.New("validation failed") // ErrFailed signals unrecoverable error. ErrFailed = errs.New("validation failed") // ErrVerificationFailed signals failed proof verification. ErrVerificationFailed = errs.New("verification failed") )
Functions ¶
This section is empty.
Types ¶
type Commitment ¶
type Commitment[I algebra.GroupElement[I]] struct { A I `cbor:"a"` }
Commitment holds the prover commitment.
func (*Commitment[I]) Value ¶
func (c *Commitment[I]) Value() I
Value returns the commitment group element.
type MaurerOption ¶
type MaurerOption[I algebra.GroupElement[I], P algebra.GroupElement[P]] func(protocol *Protocol[I, P])
MaurerOption configures the Maurer09 protocol.
func WithImageScalarMul ¶
func WithImageScalarMul[I algebra.GroupElement[I], P algebra.GroupElement[P]](scalarMul func(I, []byte) I) MaurerOption[I, P]
WithImageScalarMul overrides the scalar multiplication in the image group.
func WithPreImageScalarMul ¶
func WithPreImageScalarMul[I algebra.GroupElement[I], P algebra.GroupElement[P]](scalarMul func(P, []byte) P) MaurerOption[I, P]
WithPreImageScalarMul overrides the scalar multiplication in the pre-image group.
type Protocol ¶
type Protocol[I algebra.GroupElement[I], P algebra.GroupElement[P]] struct { // contains filtered or unexported fields }
Protocol implements the Maurer09 sigma protocol.
func NewProtocol ¶
func NewProtocol[I algebra.GroupElement[I], P algebra.GroupElement[P]]( challengeByteLen int, soundnessError uint, name sigma.Name, imageGroup algebra.FiniteGroup[I], preImageGroup algebra.FiniteGroup[P], oneWayHomomorphism sigma.OneWayHomomorphism[I, P], anchor sigma.Anchor[I, P], prng io.Reader, options ...MaurerOption[I, P], ) (*Protocol[I, P], error)
NewProtocol constructs a Maurer09 protocol instance.
func (*Protocol[I, P]) ComputeProverCommitment ¶
func (p *Protocol[I, P]) ComputeProverCommitment(_ *Statement[I], _ *Witness[P]) (*Commitment[I], *State[P], error)
ComputeProverCommitment creates the Maurer09 commitment and state.
func (*Protocol[I, P]) ComputeProverResponse ¶
func (p *Protocol[I, P]) ComputeProverResponse(_ *Statement[I], witness *Witness[P], _ *Commitment[I], state *State[P], challengeBytes sigma.ChallengeBytes) (*Response[P], error)
ComputeProverResponse computes the Maurer09 response.
func (*Protocol[I, P]) Extract ¶
func (p *Protocol[I, P]) Extract(x *Statement[I], a *Commitment[I], ei []sigma.ChallengeBytes, zi []*Response[P]) (*Witness[P], error)
Extract derives the witness from two valid transcripts.
func (*Protocol[I, P]) GetChallengeBytesLength ¶
GetChallengeBytesLength returns the challenge size in bytes.
func (*Protocol[I, P]) ImageGroup ¶
func (p *Protocol[I, P]) ImageGroup() algebra.FiniteGroup[I]
ImageGroup returns the protocol image group.
func (*Protocol[I, P]) Phi ¶
func (p *Protocol[I, P]) Phi() sigma.OneWayHomomorphism[I, P]
Phi returns the protocol one-way homomorphism.
func (*Protocol[I, P]) PreImageGroup ¶
func (p *Protocol[I, P]) PreImageGroup() algebra.FiniteGroup[P]
PreImageGroup returns the protocol pre-image group.
func (*Protocol[I, P]) RunSimulator ¶
func (p *Protocol[I, P]) RunSimulator(statement *Statement[I], challengeBytes sigma.ChallengeBytes) (*Commitment[I], *Response[P], error)
RunSimulator simulates a Maurer09 transcript for a given challenge.
func (*Protocol[G, S]) SoundnessError ¶
SoundnessError returns the protocol soundness error.
func (*Protocol[I, P]) SpecialSoundness ¶
SpecialSoundness returns the protocol special soundness parameter.
func (*Protocol[I, P]) ValidateStatement ¶
ValidateStatement checks statement/witness consistency.
func (*Protocol[I, P]) Verify ¶
func (p *Protocol[I, P]) Verify(statement *Statement[I], commitment *Commitment[I], challengeBytes sigma.ChallengeBytes, response *Response[P]) error
Verify checks a Maurer09 proof response.
type Response ¶
type Response[P algebra.GroupElement[P]] struct { Z P `cbor:"z"` }
Response holds the prover response.
type State ¶
type State[P algebra.GroupElement[P]] struct { S P `cbor:"s"` }
State stores the prover's internal state.
type Statement ¶
type Statement[I algebra.GroupElement[I]] struct { X I `cbor:"x"` }
Statement holds the Maurer09 statement.
type Witness ¶
type Witness[P algebra.GroupElement[P]] struct { W P `cbor:"w"` }
Witness holds the Maurer09 witness.