pub struct PublicKey(/* private fields */);Expand description
A Schnorr public key over the ECgFp5 curve, stored as the canonical
Fp5 encoding w = (sk * G).encode().
The wire format used by Lighter’s L2 protocol is the 40-byte little-endian
representation of this Fp5 element.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn from_fp5(w: Fp5) -> Self
pub fn from_fp5(w: Fp5) -> Self
Wrap an existing Fp5 encoding as a public key. No curve check is
performed here; Self::verify will reject the key if it does not
decode to a valid group element.
Sourcepub fn try_from_le_bytes(bytes: [u8; 40]) -> Option<Self>
pub fn try_from_le_bytes(bytes: [u8; 40]) -> Option<Self>
Decode 40 little-endian bytes into a public key. Returns None if any
8-byte limb is non-canonical (>= p).
Matches the Go reference’s FromCanonicalLittleEndianBytes, which
rejects any limb whose u64 value is >= p. Phase E Layer 2 oracle
tests confirm the closed mainnet signer always emits canonical bytes
out of ToLittleEndianBytesF, so the strict policy round-trips
without exception. No reducing variant is needed; non-canonical input
would only ever come from a malformed or adversarial peer.
Sourcepub fn to_le_bytes(&self) -> [u8; 40]
pub fn to_le_bytes(&self) -> [u8; 40]
Canonical 40-byte little-endian encoding of the public key.
Trait Implementations§
impl Copy for PublicKey
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnsafeUnpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more