pub struct DummyIdentity { /* private fields */ }Expand description
Minimal NodeIdentity implementation used by tests and simulations.
This type is not suitable for production use.
Implementations§
Source§impl DummyIdentity
impl DummyIdentity
Sourcepub fn new(bytes: [u8; 32]) -> Self
pub fn new(bytes: [u8; 32]) -> Self
Construct a dummy identity from fixed public-key bytes.
When the software-crypto feature is enabled the supplied bytes
are treated as a seed and run through Ed25519 key derivation so
that the resulting public key is always a valid point on the
curve. This keeps test code source-compatible (callers still pass
distinguishable byte patterns like [0xAB; 32]) while letting
the MAC layer enforce real curve validation in add_peer.
Without software-crypto the bytes are used verbatim — useful
for no_std test scenarios where Ed25519 derivation is not
available, and where the validator is also compiled out.
Sourcepub fn from_public_key(public_key: PublicKey) -> Self
pub fn from_public_key(public_key: PublicKey) -> Self
Construct a dummy identity from a raw PublicKey without
running it through Ed25519 derivation. Intended for callers that
need exact control over the test public-key bytes (e.g. to
construct a key that the validator should reject).
Trait Implementations§
Source§impl Clone for DummyIdentity
impl Clone for DummyIdentity
Source§fn clone(&self) -> DummyIdentity
fn clone(&self) -> DummyIdentity
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl NodeIdentity for DummyIdentity
impl NodeIdentity for DummyIdentity
type Error = ()
Source§fn public_key(&self) -> &PublicKey
fn public_key(&self) -> &PublicKey
Source§async fn sign(&self, _message: &[u8]) -> Result<[u8; 64], Self::Error>
async fn sign(&self, _message: &[u8]) -> Result<[u8; 64], Self::Error>
Source§async fn agree(&self, peer: &PublicKey) -> Result<SharedSecret, Self::Error>
async fn agree(&self, peer: &PublicKey) -> Result<SharedSecret, Self::Error>
§fn hint(&self) -> NodeHint
fn hint(&self) -> NodeHint
public_key.Auto Trait Implementations§
impl Freeze for DummyIdentity
impl RefUnwindSafe for DummyIdentity
impl Send for DummyIdentity
impl Sync for DummyIdentity
impl Unpin for DummyIdentity
impl UnwindSafe for DummyIdentity
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)