pub struct NodeKeySignature {
pub sig_kind: SigKind,
pub pubkey: Vec<u8>,
pub key_id: Vec<u8>,
pub signature: Vec<u8>,
pub nested: Option<Box<NodeKeySignature>>,
pub wrapping_pubkey: Vec<u8>,
}Expand description
A node-key signature (Go tka.NodeKeySignature): proof that a node’s key is authorized under the
tailnet-lock authority. Decoded from the CBOR blob a peer presents.
Fields§
§sig_kind: SigKindSignature kind.
pubkey: Vec<u8>The node public key this signature authorizes (Go Pubkey).
key_id: Vec<u8>The id of the trusted Key that signed this (Go KeyID).
signature: Vec<u8>The Ed25519 signature bytes.
nested: Option<Box<NodeKeySignature>>For SigKind::Rotation, the nested (prior) signature.
wrapping_pubkey: Vec<u8>For rotation, the wrapping public key the nested signature authorized.
Implementations§
Source§impl NodeKeySignature
impl NodeKeySignature
Sourcepub fn serialize(&self) -> Vec<u8> ⓘ
pub fn serialize(&self) -> Vec<u8> ⓘ
The canonical CBOR serialization of this signature including its signature field (Go
NodeKeySignature.Serialize / tkatype.MarshaledSignature). This is the raw byte form a node
submits to control (base64’d on the wire by the /machine/tka/sign RPC) and the form
Authority::node_key_authorized decodes. The inverse of the crate’s NKS decoder.
Sourcepub fn sign_direct(
node_key: &[u8],
signing_key: &SigningKey,
) -> NodeKeySignature
pub fn sign_direct( node_key: &[u8], signing_key: &SigningKey, ) -> NodeKeySignature
Build a Direct NodeKeySignature that authorizes node_key, signed by the trusted
network-lock key signing_key (Go tka.signNodeKey for the direct case / NLPrivate.SignNKS
over a NodeKeySignature{SigKind: SigKindDirect}).
The signature is over NodeKeySignature::sig_hash (the CBOR with the Signature field
nil’d), and key_id is recorded as the signer’s 32-byte ed25519 public key verbatim (Go’s
Key25519/NLKey id is its public key). The signature is plain RFC 8032 ed25519
(ed25519.Sign); a Direct leaf is verified cofactored under ZIP-215 (ed25519consensus /
our [verify_ed25519_zip215]), which accepts a standard dalek signature — the same valid
sign-dalek / verify-zip215 relationship Authority::node_key_authorized’s tests rely on.
Takes a raw ed25519_dalek::SigningKey so this crate stays free of a key-wrapper dependency;
the caller holds the NetworkLockPrivateKey and passes its inner signing key.
The resulting signature authorizes exactly node_key: Authority::node_key_authorized
accepts it for that node key (when the signer is trusted) and rejects it for any other
(TkaError::NodeKeyMismatch). nested/wrapping_pubkey are empty — those are for
SigKind::Rotation, not a direct signature.
Sourcepub fn sign_rotation(
node_key: &[u8],
inner_signer: &SigningKey,
pivot_key: &SigningKey,
) -> NodeKeySignature
pub fn sign_rotation( node_key: &[u8], inner_signer: &SigningKey, pivot_key: &SigningKey, ) -> NodeKeySignature
Build a single-level Rotation chain authorizing node_key, rooted in a trusted key
(Go tka.signNodeKey for the rotation case). Constructs the inner Direct itself — the
trusted inner_signer signs over the rotation pivot (pivot_key’s public key), with the
pivot recorded as the inner’s wrapping_pubkey (set before signing, as Go’s rotation-pivot
inner does) — then the pivot key signs the outer rotation wrap over node_key. The outer wrap
verifies as standard ed25519 (not ZIP-215); the inner Direct as ZIP-215. The resulting
chain’s prev_node_keys names the pivot pubkey (the key being rotated away).
Symmetric companion to sign_direct for the rotation case,
so a caller (and the crate’s tests) can construct a genuinely-verifiable rotation chain
without hand-encoding CBOR. For deeper chains, feed the result back in as a further pivot.
Trait Implementations§
Source§impl Clone for NodeKeySignature
impl Clone for NodeKeySignature
Source§fn clone(&self) -> NodeKeySignature
fn clone(&self) -> NodeKeySignature
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NodeKeySignature
impl Debug for NodeKeySignature
impl Eq for NodeKeySignature
Source§impl PartialEq for NodeKeySignature
impl PartialEq for NodeKeySignature
Source§fn eq(&self, other: &NodeKeySignature) -> bool
fn eq(&self, other: &NodeKeySignature) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for NodeKeySignature
Auto Trait Implementations§
impl Freeze for NodeKeySignature
impl RefUnwindSafe for NodeKeySignature
impl Send for NodeKeySignature
impl Sync for NodeKeySignature
impl Unpin for NodeKeySignature
impl UnsafeUnpin for NodeKeySignature
impl UnwindSafe for NodeKeySignature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<A, T> DynMessage<A> for T
impl<A, T> DynMessage<A> for T
Source§fn handle_dyn<'a>(
self: Box<T>,
state: &'a mut A,
actor_ref: ActorRef<A>,
tx: Option<Sender<Result<Box<dyn Any + Send>, SendError<Box<dyn Any + Send>, Box<dyn Any + Send>>>>>,
stop: &'a mut bool,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn ReplyError>>> + Send + 'a>>
fn handle_dyn<'a>( self: Box<T>, state: &'a mut A, actor_ref: ActorRef<A>, tx: Option<Sender<Result<Box<dyn Any + Send>, SendError<Box<dyn Any + Send>, Box<dyn Any + Send>>>>>, stop: &'a mut bool, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn ReplyError>>> + Send + 'a>>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more