pub struct KeyId(String);
Expand description
A unique key identifier for a private key on a NetHSM.
A KeyId
s must be in the character set [a-z0-9]
.
It is used in key management on a NetHSM and is unique in its scope.
The same KeyId
may exist system-wide and in one or several namespaces, but no duplicate
KeyId
can exist system-wide or in the same namespace.
Tuple Fields§
§0: String
Implementations§
source§impl KeyId
impl KeyId
sourcepub fn new(key_id: String) -> Result<Self, Error>
pub fn new(key_id: String) -> Result<Self, Error>
Constructs a new Key ID from a String
.
Validates the input string and returns crate::Error::Key
if it is invalid.
§Errors
Returns an Error
if
- string contains characters outside of the allowed range (
[a-z0-9]
) - string is empty
§Examples
use nethsm::KeyId;
assert!(KeyId::new("key1".into()).is_ok());
assert!(KeyId::new("key".into()).is_ok());
// the input can not contain invalid chars
assert!(KeyId::new("key1#".into()).is_err());
assert!(KeyId::new("key~1".into()).is_err());
// the key must be non-empty
assert!(KeyId::new("".into()).is_err());
Trait Implementations§
source§impl<'de> Deserialize<'de> for KeyId
impl<'de> Deserialize<'de> for KeyId
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
impl Eq for KeyId
impl StructuralPartialEq for KeyId
Auto Trait Implementations§
impl Freeze for KeyId
impl RefUnwindSafe for KeyId
impl Send for KeyId
impl Sync for KeyId
impl Unpin for KeyId
impl UnwindSafe for KeyId
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)