bbs

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProofStatus = map[C.int]string{
	400: "The proof failed because the signature proof of knowledge failed",
	401: "The proof failed because a hidden message was invalid when the proof was created",
	402: "The proof failed because a revealed message was invalid",
}

Functions

This section is empty.

Types

type BlindCommitmentContext

type BlindCommitmentContext Handle

func BlindCommitmentContextInit

func BlindCommitmentContextInit() (*BlindCommitmentContext, error)

BlindCommitmentContextInit initializes a BlindCommitmentContext

func (*BlindCommitmentContext) AddMessage

func (r *BlindCommitmentContext) AddMessage(message string, index int) error

AddMessage adds a message and its associated index to the BlindCommitmentContext

func (*BlindCommitmentContext) Finish

Finish generates a commitment, context, and blinding factor from the BlindCommitmentContext

func (*BlindCommitmentContext) SetNonce

func (r *BlindCommitmentContext) SetNonce(nonce []byte) error

SetNonce sets the nonce on the BlindedCommitmentContext

func (*BlindCommitmentContext) SetPublicKey

func (r *BlindCommitmentContext) SetPublicKey(publicKey HandleByteBuffer) error

SetPublicKey sets the bbs public key on the BlindCommitmentContext

type BlindSignContext

type BlindSignContext Handle

func BlindSignContextInit

func BlindSignContextInit() (*BlindSignContext, error)

BlindSignContext initializes a blind sign context

func (*BlindSignContext) AddMessage

func (r *BlindSignContext) AddMessage(message string, index int) error

AddMessage adds the message and associated index to BlindSignContext

func (*BlindSignContext) Finish

func (r *BlindSignContext) Finish() (*BlindedSignature, error)

Finish generates a BlindedSignature from a BlindSignContext

func (*BlindSignContext) SetCommitment

func (r *BlindSignContext) SetCommitment(blindCommitment HandleByteBuffer) error

SetCommitment sets the commitment on the BlindSignContext

func (*BlindSignContext) SetPublicKey

func (r *BlindSignContext) SetPublicKey(publicKey HandleByteBuffer) error

SetPublicKey sets the bbs public key on the BlindSignContext

func (*BlindSignContext) SetSecretKey

func (r *BlindSignContext) SetSecretKey(secretKey HandleByteBuffer) error

SetSecretKey sets the bls secret key on the BlindSignContext

type BlindedCommitment

type BlindedCommitment struct {
	Commitment     C.ByteBuffer
	Context        C.ByteBuffer
	BlindingFactor C.ByteBuffer
}

func (*BlindedCommitment) Free

func (r *BlindedCommitment) Free()

FreeCommitment deallocates the Commitment, Context, and BlindingFactor instances from the BlindedCommitment

type BlindedSignature

type BlindedSignature HandleByteBuffer

func (*BlindedSignature) Unblind

func (r *BlindedSignature) Unblind(blindingFactor HandleByteBuffer) (*Signature, error)

Unblind returns the Signature from the BlindedSignature

type BlsKeyPair

type BlsKeyPair struct {
	PublicKey C.ByteBuffer
	SecretKey C.ByteBuffer
}

func GenerateBlsKey

func GenerateBlsKey(data []byte) (*BlsKeyPair, error)

GenerateKey generates a bls key pair

func (*BlsKeyPair) BlsPublicKeyToBBSKey

func (r *BlsKeyPair) BlsPublicKeyToBBSKey(messageCount int) (*HandleByteBuffer, error)

BlsPublicKeyToBBSKey converts a bls public key to a BBS public key

func (*BlsKeyPair) FreePublicKey

func (r *BlsKeyPair) FreePublicKey()

FreeSecretKey deallocates the public key instance

func (*BlsKeyPair) FreeSecretKey

func (r *BlsKeyPair) FreeSecretKey()

FreeSecretKey deallocates the secret key instance

type Handle

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

type HandleByteBuffer

type HandleByteBuffer struct {
	Buffer C.ByteBuffer
}

func (HandleByteBuffer) Free

func (r HandleByteBuffer) Free()

type Proof

type Proof HandleByteBuffer

func (*Proof) Free

func (r *Proof) Free()

Free deallocates the proof instance

type ProofContext

type ProofContext Handle

func ProofContextInit

func ProofContextInit() (*ProofContext, error)

ProofContextInit creates the proof asynchronous

func (*ProofContext) AddProofMessages

func (r *ProofContext) AddProofMessages(messages []string, messageType ProofMessageType, blindingFactor HandleByteBuffer) error

AddProofMessage adds a proof message to the proof context

func (*ProofContext) Finish

func (r *ProofContext) Finish() (*Proof, error)

Finish generates a proof from the ProofContext

func (*ProofContext) SetNonce

func (r *ProofContext) SetNonce(nonce []byte) error

SetNonce sets the nonce on the ProofContext

func (*ProofContext) SetPublicKey

func (r *ProofContext) SetPublicKey(publicKey HandleByteBuffer) error

SetPublicKey sets the bbs public key on the ProofContext

func (*ProofContext) SetSignature

func (r *ProofContext) SetSignature(signature *Signature) error

SetSignature sets the signature on the ProofContext

type ProofMessageType

type ProofMessageType int
const (
	Revealed                    ProofMessageType = 1
	HiddenProofSpecificBlinding ProofMessageType = 2
	HiddenExternalBlinding      ProofMessageType = 3
)

type SignContext

type SignContext Handle

func SignContextInit

func SignContextInit() (*SignContext, error)

SignContextInit initializes a sign context

func (*SignContext) AddMessages

func (r *SignContext) AddMessages(messages []string) error

AddMessages adds messages to the SignContext

func (*SignContext) Finish

func (r *SignContext) Finish() (*Signature, error)

Finish generates a Signature from the SignContext

func (*SignContext) SetPublicKey

func (r *SignContext) SetPublicKey(publicKey HandleByteBuffer) error

SetPublicKey sets the public key on the SignContext

func (*SignContext) SetSecretKey

func (r *SignContext) SetSecretKey(secretKey HandleByteBuffer) error

SetSecretKey sets the bls secret key on teh SignContext

type Signature

type Signature HandleByteBuffer

func (*Signature) Free

func (r *Signature) Free()

Free deallocates the Signature instance

type VerifyBlindCommitmentContext

type VerifyBlindCommitmentContext Handle

func VerifyBlindCommitmentContextInit

func VerifyBlindCommitmentContextInit() (*VerifyBlindCommitmentContext, error)

VerifyBlindCommitmentContextInit initializes a VerifyBlindCommitmentContext

func (*VerifyBlindCommitmentContext) AddBlinded

func (r *VerifyBlindCommitmentContext) AddBlinded(index int) error

AddBlinded adds the index of the blinded message to the VerifyBlindCommitmentContext

func (*VerifyBlindCommitmentContext) Finish

func (r *VerifyBlindCommitmentContext) Finish() error

Finish verifies the BlindCommitmentContext

func (*VerifyBlindCommitmentContext) SetNonce

func (r *VerifyBlindCommitmentContext) SetNonce(nonce []byte) error

SetNonce sets the nonce on the VerifyBlindCommitmentContext

func (*VerifyBlindCommitmentContext) SetProof

SetProof sets the context from the BlindCommitmentContext on the VerifyBlindCommitmentContext

func (*VerifyBlindCommitmentContext) SetPublicKey

func (r *VerifyBlindCommitmentContext) SetPublicKey(publicKey HandleByteBuffer) error

SetPublicKey sets the bbs public key on the VerifyBlindCommitmentContext

type VerifyContext

type VerifyContext Handle

func VerifyContextInit

func VerifyContextInit() (*VerifyContext, error)

VerifyContextInit initializes a VerifyContext

func (*VerifyContext) AddMessages

func (r *VerifyContext) AddMessages(messages []string) error

AddMessages adds the messages to the VerifyContext

func (*VerifyContext) Finish

func (r *VerifyContext) Finish() (bool, error)

Finish verifies a BBS+ signature for a set of messages with a BBS public key

func (*VerifyContext) SetPublicKey

func (r *VerifyContext) SetPublicKey(publicKey HandleByteBuffer) error

SetPublicKey sets the bbs public key on the VerifyContext

func (*VerifyContext) SetSignature

func (r *VerifyContext) SetSignature(signature *Signature) error

SetSignature sets the signature on the VerifyContext

type VerifyProofContext

type VerifyProofContext Handle

func VerifyProofContextInit

func VerifyProofContextInit() (*VerifyProofContext, error)

VerifyProofContextInit initializes a VerifyProofContext

func (*VerifyProofContext) AddMessage

func (r *VerifyProofContext) AddMessage(message string, index int) error

AddMessages adds the message and the associated index to the VerifyProofContext

func (*VerifyProofContext) Finish

func (r *VerifyProofContext) Finish() error

Finish verifies a proof

func (*VerifyProofContext) SetNonce

func (r *VerifyProofContext) SetNonce(nonce []byte) error

SetNonce sets the nonce on the VerifyProofContext

func (*VerifyProofContext) SetProof

func (r *VerifyProofContext) SetProof(proof HandleByteBuffer) error

SetProof sets the proof on the VerifyProofContext

func (*VerifyProofContext) SetPublicKey

func (r *VerifyProofContext) SetPublicKey(publicKey HandleByteBuffer) error

SetPublicKey sets the bbs public key on the VerifyProofContext

Jump to

Keyboard shortcuts

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