mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
mv of babyjub.PublicKey to babyjub.PublicKeyComp
Update usage of `*babyjub.PublicKey` to `babyjub.PublicKeyComp` - when the key is not defined, internally is used `babyjub.EmptyBJJComp`, which is a `[32]byte` of zeroes of type `babyjub.PublicKeyComp` - the API continues returning `nil` when the key is not defined
This commit is contained in:
@@ -9,11 +9,14 @@ import (
|
||||
|
||||
func TestBJJFromStringWithChecksum(t *testing.T) {
|
||||
s := "21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d7"
|
||||
pk, err := BJJFromStringWithChecksum(s)
|
||||
assert.Nil(t, err)
|
||||
pkComp, err := BJJFromStringWithChecksum(s)
|
||||
assert.NoError(t, err)
|
||||
sBytes, err := hex.DecodeString(s)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, hex.EncodeToString(SwapEndianness(sBytes)), pk.Compress().String())
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, hex.EncodeToString(SwapEndianness(sBytes)), pkComp.String())
|
||||
|
||||
pk, err := pkComp.Decompress()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// expected values computed with js implementation
|
||||
assert.Equal(t, "2492816973395423007340226948038371729989170225696553239457870892535792679622", pk.X.String())
|
||||
|
||||
Reference in New Issue
Block a user