MCPcopy Create free account
hub / github.com/ceramicnetwork/rust-ceramic / peer_id

Method peer_id

core/src/node_id.rs:80–91  ·  view source on GitHub ↗

public_ed25519_key_bytes as a PeerID

(&self)

Source from the content-addressed store, hash-verified

78 }
79 /// public_ed25519_key_bytes as a PeerID
80 pub fn peer_id(&self) -> PeerId {
81 let libp2p_key = [
82 ED25519_LIBP2P_PEER_ID_PREFIX,
83 self.public_ed25519_key_bytes.as_slice(),
84 ]
85 .concat();
86 // Identity multihash code = 0x00
87 let libp2p_key_multihash = Multihash::<64>::wrap(0x00, &libp2p_key)
88 .expect("self.public_ed25519_key_bytes to be well formed");
89 PeerId::from_multihash(libp2p_key_multihash)
90 .expect("self.public_ed25519_key_bytes to be well formed")
91 }
92 /// json web key from this id.
93 pub fn jwk(&self) -> JWK {
94 let mut jwk = JWK::from(Params::OKP(OctetParams {

Callers 13

newMethod · 0.45
from_jwsMethod · 0.45
test_peer_id_from_didFunction · 0.45
pollMethod · 0.45
buildMethod · 0.45
get_interestsMethod · 0.45
post_interestsMethod · 0.45
get_peersMethod · 0.45
newMethod · 0.45

Calls 2

expectMethod · 0.80
as_sliceMethod · 0.45