mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
crypto/keypair: Add methods to get x and y from PublicKey.
This commit is contained in:
@@ -2,9 +2,10 @@ use std::{convert::TryFrom, io, str::FromStr};
|
||||
|
||||
use halo2_gadgets::ecc::chip::FixedPoint;
|
||||
use pasta_curves::{
|
||||
arithmetic::CurveAffine,
|
||||
group::{
|
||||
ff::{Field, PrimeField},
|
||||
Group, GroupEncoding,
|
||||
Curve, Group, GroupEncoding,
|
||||
},
|
||||
pallas,
|
||||
};
|
||||
@@ -82,6 +83,14 @@ impl PublicKey {
|
||||
None => Err(Error::PublicKeyFromBytes),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn x(&self) -> pallas::Base {
|
||||
*self.0.to_affine().coordinates().unwrap().x()
|
||||
}
|
||||
|
||||
pub fn y(&self) -> pallas::Base {
|
||||
*self.0.to_affine().coordinates().unwrap().y()
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for PublicKey {
|
||||
|
||||
Reference in New Issue
Block a user