Browse Source

move DecompressSig to bjj helpers

fix/bbjj-err
Ilya 1 year ago
parent
commit
f4e4eed9d5
2 changed files with 13 additions and 13 deletions
  1. +0
    -13
      babyjub/babyjub_wrapper_test.go
  2. +13
    -0
      babyjub/helpers.go

+ 0
- 13
babyjub/babyjub_wrapper_test.go

@ -63,16 +63,3 @@ func TestBjjWrappedPublicKeyEqual(t *testing.T) {
x2 := RandomBjjWrappedKey().Public()
require.False(t, x1.Equal(x2))
}
// DecompressSig decompresses a compressed signature.
func DecompressSig(commpresedSig []byte) (*Signature, error) {
poseidonComSig := &SignatureComp{}
if err := poseidonComSig.UnmarshalText(commpresedSig); err != nil {
return nil, err
}
poseidonDecSig, err := poseidonComSig.Decompress()
if err != nil {
return nil, err
}
return poseidonDecSig, nil
}

+ 13
- 0
babyjub/helpers.go

@ -18,3 +18,16 @@ func Blake512(m []byte) []byte {
}
return h.Sum(nil)
}
// DecompressSig decompresses a compressed signature.
func DecompressSig(commpresedSig []byte) (*Signature, error) {
poseidonComSig := &SignatureComp{}
if err := poseidonComSig.UnmarshalText(commpresedSig); err != nil {
return nil, err
}
poseidonDecSig, err := poseidonComSig.Decompress()
if err != nil {
return nil, err
}
return poseidonDecSig, nil
}

Loading…
Cancel
Save