mirror of
https://github.com/luxfi/mpc.git
synced 2026-09-24 00:26:24 +00:00
19 lines
382 B
Go
19 lines
382 B
Go
package encoding
|
|
|
|
import (
|
|
"github.com/decred/dcrd/dcrec/edwards/v2"
|
|
)
|
|
|
|
func EncodeEDDSAPubKey(pubKey *edwards.PublicKey) ([]byte, error) {
|
|
bytes := pubKey.SerializeCompressed()
|
|
return bytes, nil
|
|
}
|
|
|
|
func DecodeEDDSAPubKey(encodedKey []byte) (*edwards.PublicKey, error) {
|
|
pubKey, err := edwards.ParsePubKey(encodedKey)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return pubKey, nil
|
|
}
|