This commit is contained in:
1 parent
6ceb52c5d2
commit
f9a5096aea
15 files changed
+2017
-14
No files matched your search
@@ -8,7 +8,7 @@ use std::time::Duration;
|
||||
|
||||
use iroh::endpoint::{Connection, RecvStream, SendStream, VarInt, presets};
|
||||
use iroh::protocol::{AcceptError, ProtocolHandler, Router};
|
||||
use iroh::{Endpoint, EndpointAddr, EndpointId, SecretKey};
|
||||
use iroh::{Endpoint, EndpointAddr, EndpointId, SecretKey, Signature};
|
||||
use serde::Serialize;
|
||||
use serde::de::DeserializeOwned;
|
||||
use tokio::sync::{Semaphore, mpsc, watch};
|
||||
@@ -1041,6 +1041,15 @@ impl<M: Message> NetworkEngine<M> {
|
||||
self.shared.endpoint.id()
|
||||
}
|
||||
|
||||
/// Signs application data with this peer's persistent transport identity.
|
||||
///
|
||||
/// The secret key never leaves the engine. Protocols can attach the
|
||||
/// returned signature to records that may be forwarded by other peers;
|
||||
/// recipients verify it against [`Self::endpoint_id`].
|
||||
pub fn sign_identity(&self, message: &[u8]) -> Signature {
|
||||
self.shared.endpoint.secret_key().sign(message)
|
||||
}
|
||||
|
||||
/// Returns the network this engine participates in.
|
||||
pub fn network_id(&self) -> NetworkId {
|
||||
self.shared.config.network_id
|
||||
|
||||
Reference in new issue
Block a user