core: Introduce NodeId
A type for node IDs, which are Ed25519 public keys, is added to the `radicle-core` crate.
This commit is contained in:
parent
d5fea6324c
commit
7c016f9219
|
|
@ -2935,6 +2935,7 @@ dependencies = [
|
|||
"multibase",
|
||||
"proptest",
|
||||
"qcheck",
|
||||
"radicle-crypto",
|
||||
"radicle-git-ref-format",
|
||||
"radicle-oid",
|
||||
"schemars",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ gix-hash = { workspace = true, optional = true }
|
|||
multibase = { workspace = true }
|
||||
proptest = { workspace = true, optional = true }
|
||||
qcheck = { workspace = true, optional = true }
|
||||
radicle-crypto = { workspace = true }
|
||||
radicle-git-ref-format = { workspace = true, optional = true }
|
||||
radicle-oid = { workspace = true, default-features = false, features = ["sha1"] }
|
||||
schemars = { workspace = true, optional = true, default-features = false, features = ["derive"] }
|
||||
|
|
|
|||
|
|
@ -71,5 +71,8 @@ extern crate std as doc_std;
|
|||
|
||||
extern crate alloc;
|
||||
|
||||
pub mod node;
|
||||
pub use node::NodeId;
|
||||
|
||||
pub mod repo;
|
||||
pub use repo::RepoId;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
//! A Radicle node on the network is identified by its [`NodeId`], which in turn
|
||||
//! is a Ed25519 public key.
|
||||
//!
|
||||
//! The human-readable format is a multibase-encoded format of the underlying Ed25519 public key, i.e.
|
||||
//! ```
|
||||
//! MULTIBASE(base58-btc, MULTICODEC(public-key-type, raw-public-key-bytes))
|
||||
//! ```
|
||||
//! which results in strings that look like:
|
||||
//! ```
|
||||
//! z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
//! ```
|
||||
|
||||
use radicle_crypto::PublicKey;
|
||||
|
||||
/// Public identifier of a node device in the network.
|
||||
///
|
||||
/// # Legacy
|
||||
///
|
||||
/// This is a type alias, providing little protection around evolving a [`NodeId`]
|
||||
/// and having it very tightly coupled with a [`PublicKey`].
|
||||
///
|
||||
/// Future iterations will change this to provide a better API for working with
|
||||
/// [`NodeId`]'s and their usage in the protocol.
|
||||
pub type NodeId = PublicKey;
|
||||
Loading…
Reference in New Issue