This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "federation-net"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
description = "Generic peer-to-peer networking engine built on Iroh"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/federation-net"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -78,6 +78,6 @@ pub use ticket::{PeerTicket, TICKET_VERSION};
|
||||
|
||||
// Re-exported Iroh types that appear in the public API.
|
||||
pub use iroh::endpoint::{RecvStream, SendStream};
|
||||
pub use iroh::{EndpointAddr, EndpointId, SecretKey};
|
||||
pub use iroh::{EndpointAddr, EndpointId, SecretKey, Signature};
|
||||
// Re-exported so applications can use the generic ticket helpers.
|
||||
pub use iroh_tickets::Ticket;
|
||||
|
||||
Reference in New Issue
Block a user