pub struct Identity { /* private fields */ }Expand description
A public cryptographic identity.
Contains the COSE-encoded public key that identifies a client. This can be shared freely and is used by the proxy to verify challenge-response signatures.
§Examples
use ap_proxy_protocol::IdentityKeyPair;
let keypair = IdentityKeyPair::generate();
let identity = keypair.identity();
// Get a compact fingerprint for identification
let fingerprint = identity.fingerprint();
println!("Identity fingerprint: {:?}", fingerprint);Implementations§
Source§impl Identity
impl Identity
Sourcepub fn algorithm(&self) -> Option<SignatureAlgorithm>
pub fn algorithm(&self) -> Option<SignatureAlgorithm>
Get the signature algorithm for this identity.
Returns the algorithm detected from the COSE key header.
Sourcepub fn public_key_bytes(&self) -> Option<Vec<u8>>
pub fn public_key_bytes(&self) -> Option<Vec<u8>>
Extract the raw public key bytes from the COSE key.
Sourcepub fn fingerprint(&self) -> IdentityFingerprint
pub fn fingerprint(&self) -> IdentityFingerprint
Compute the SHA256 fingerprint of this identity.
The fingerprint is a 32-byte hash of the public key, providing a compact and uniform-length identifier. Fingerprints are used for:
- Identifying clients in message routing
- Displaying identities to users
- Indexing connections in the proxy server
The fingerprint is deterministic - the same identity always produces the same fingerprint.
§Examples
use ap_proxy_protocol::IdentityKeyPair;
let keypair = IdentityKeyPair::generate();
let identity = keypair.identity();
let fingerprint = identity.fingerprint();
// Fingerprints can be compared for equality
assert_eq!(identity.fingerprint(), fingerprint);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Identity
impl<'de> Deserialize<'de> for Identity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&IdentityKeyPair> for Identity
impl From<&IdentityKeyPair> for Identity
Source§fn from(keypair: &IdentityKeyPair) -> Self
fn from(keypair: &IdentityKeyPair) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnsafeUnpin for Identity
impl UnwindSafe for Identity
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
Mutably borrows from an owned value. Read more