Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeShieldedPaymentAddress(addr string) (a_pk, pk_enc, version []byte, err error)
- func DecodeSpendingKey(addr string) (a_sk, version []byte, err error)
- func DecodeViewingKey(addr string) (a_pk, sk_enc, version []byte, err error)
- func EncodeIncomingViewingKey(a_pk, sk_enc []byte) string
- func EncodeShieldedPaymentAddress(a_pk, pk_enc []byte) string
- func EncodeSpendingKey(a_sk []byte) string
- func KDF(dhsecret [32]byte, epk []byte, pk_enc [32]byte, nonce byte) []byte
- func ZC_generate_privkey(a_sk []byte) []byte
- func ZC_generate_pubkey(sk_enc []byte) []byte
- type PublicZSLAPI
- func (api *PublicZSLAPI) CreateShieldedTransfer(rho_1 common.Hash, sk_1 common.Hash, value_1 float64, treeIndex_1 float64, ...) (map[string]interface{}, error)
- func (api *PublicZSLAPI) CreateShielding(rho common.Hash, pk common.Hash, value float64) (map[string]interface{}, error)
- func (api *PublicZSLAPI) CreateUnshielding(rho common.Hash, sk common.Hash, addr common.Address, value float64, ...) (map[string]interface{}, error)
- func (api *PublicZSLAPI) DebugShieldedTransfer() (bool, error)
- func (api *PublicZSLAPI) DebugShielding() (bool, error)
- func (api *PublicZSLAPI) DebugUnshielding() (bool, error)
- func (api *PublicZSLAPI) GenerateZKeypair() (map[string]interface{}, error)
- func (api *PublicZSLAPI) GetCommitment(rho common.Hash, pk common.Hash, value float64) common.Hash
- func (api *PublicZSLAPI) GetNewAddress() (map[string]interface{}, error)
- func (api *PublicZSLAPI) GetRandomness() (common.Hash, error)
- func (api *PublicZSLAPI) GetSendNullifier(rho common.Hash) common.Hash
- func (api *PublicZSLAPI) GetSpendNullifier(rho common.Hash, sk common.Hash) common.Hash
- func (api *PublicZSLAPI) LoadTracker(filename string) (string, error)
- func (api *PublicZSLAPI) NoteDecrypt(a_sk string, blob string) (map[string]interface{}, error)
- func (api *PublicZSLAPI) SaveTracker(filename string, data string) bool
- func (api *PublicZSLAPI) Test() (map[string]interface{}, error)
- func (api *PublicZSLAPI) TestZaddr(shieldedAddress string) (map[string]interface{}, error)
- func (api *PublicZSLAPI) VerifyShieldedTransfer(proofHex string, anchor common.Hash, spend_nf_1 common.Hash, ...) (bool, error)
- func (api *PublicZSLAPI) VerifyShielding(proofHex string, send_nf common.Hash, cm common.Hash, value float64) (bool, error)
- func (api *PublicZSLAPI) VerifyUnshielding(proofHex string, spend_nf common.Hash, rt common.Hash, addr common.Address, ...) (bool, error)
Constants ¶
View Source
const ( ZSL_PROOF_SIZE int = 584 ZSL_TREE_DEPTH = 29 ZSL_V_SIZE = 16 ZSL_RHO_SIZE = 32 ZSL_NOTEPLAINTEXT_SIZE = ZSL_V_SIZE + ZSL_RHO_SIZE ZSL_NOTEENCRYPTION_AUTH_BYTES = 16 ZSL_NOTEENCRYPTION_CIPHER_KEYSIZE = 32 ZSL_crypto_aead_chacha20poly1305__IETF_NPUBBYTES = 12 ZSL_crypto_generichash_blake2b_PERSONALBYTES = 16 )
View Source
const CSBYTES = 4
Variables ¶
View Source
var ( ErrChecksum = errors.New("checksum error") ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing") )
Functions ¶
func DecodeSpendingKey ¶
func DecodeViewingKey ¶
func EncodeSpendingKey ¶
Types ¶
type PublicZSLAPI ¶
type PublicZSLAPI struct { }
func NewPublicZSLAPI ¶
func NewPublicZSLAPI() *PublicZSLAPI
func (*PublicZSLAPI) CreateShieldedTransfer ¶
func (api *PublicZSLAPI) CreateShieldedTransfer( rho_1 common.Hash, sk_1 common.Hash, value_1 float64, treeIndex_1 float64, authPath_1 []string, rho_2 common.Hash, sk_2 common.Hash, value_2 float64, treeIndex_2 float64, authPath_2 []string, out_rho_1 common.Hash, shieldedAddress string, out_value_1 float64, out_rho_2 common.Hash, out_pk_2 common.Hash, out_value_2 float64, ) (map[string]interface{}, error)
func (*PublicZSLAPI) CreateShielding ¶
func (*PublicZSLAPI) CreateUnshielding ¶
func (*PublicZSLAPI) DebugShieldedTransfer ¶
func (api *PublicZSLAPI) DebugShieldedTransfer() (bool, error)
Test copied from from snark_test.go
func (*PublicZSLAPI) DebugShielding ¶
func (api *PublicZSLAPI) DebugShielding() (bool, error)
Test copied from from snark_test.go
func (*PublicZSLAPI) DebugUnshielding ¶
func (api *PublicZSLAPI) DebugUnshielding() (bool, error)
Test copied from from snark_test.go
func (*PublicZSLAPI) GenerateZKeypair ¶
func (api *PublicZSLAPI) GenerateZKeypair() (map[string]interface{}, error)
func (*PublicZSLAPI) GetCommitment ¶
func (*PublicZSLAPI) GetNewAddress ¶
func (api *PublicZSLAPI) GetNewAddress() (map[string]interface{}, error)
Create a shielded address and return all components: a_sk, a_pk
func (*PublicZSLAPI) GetRandomness ¶
func (api *PublicZSLAPI) GetRandomness() (common.Hash, error)
Generate 32 bytes of randomness
func (*PublicZSLAPI) GetSendNullifier ¶
func (api *PublicZSLAPI) GetSendNullifier(rho common.Hash) common.Hash
func (*PublicZSLAPI) GetSpendNullifier ¶
func (*PublicZSLAPI) LoadTracker ¶
func (api *PublicZSLAPI) LoadTracker(filename string) (string, error)
Note: API function names should match those defined in web3ext.go, first character upper case as external function.
func (*PublicZSLAPI) NoteDecrypt ¶
func (api *PublicZSLAPI) NoteDecrypt(a_sk string, blob string) (map[string]interface{}, error)
func (*PublicZSLAPI) SaveTracker ¶
func (api *PublicZSLAPI) SaveTracker(filename string, data string) bool
TODO: Post-demo, sanitize filenames and check exiting files before over-writing.
func (*PublicZSLAPI) Test ¶
func (api *PublicZSLAPI) Test() (map[string]interface{}, error)
func (*PublicZSLAPI) TestZaddr ¶
func (api *PublicZSLAPI) TestZaddr(shieldedAddress string) (map[string]interface{}, error)
func (*PublicZSLAPI) VerifyShieldedTransfer ¶
func (*PublicZSLAPI) VerifyShielding ¶
func (api *PublicZSLAPI) VerifyShielding(proofHex string, send_nf common.Hash, cm common.Hash, value float64) (bool, error)
glyff: zsl.verifyShielding(proof, send_nf, cm, value); Javascript numbers are floats, there is no support for 64-bit integers.
func (*PublicZSLAPI) VerifyUnshielding ¶
func (api *PublicZSLAPI) VerifyUnshielding(proofHex string, spend_nf common.Hash, rt common.Hash, addr common.Address, value float64) (bool, error)
glyff: zsl.verifyUnshielding(proof, spend_nf, rt, addr, value); Javascript numbers are floats, there is no support for 64-bit integers.
Click to show internal directories.
Click to hide internal directories.