use crate::ffi;
use std::marker::PhantomData;
use std::ptr;
pub struct Key<'ctx> {
pub(crate) handle: ffi::rnp_key_handle_t,
_ctx: PhantomData<&'ctx crate::Context>,
}
impl<'ctx> Key<'ctx> {
pub(crate) fn from_handle(handle: ffi::rnp_key_handle_t) -> Self {
Key {
handle,
_ctx: PhantomData,
}
}
}
impl<'ctx> Drop for Key<'ctx> {
fn drop(&mut self) {
if !self.handle.is_null() {
unsafe {
let _ = ffi::rnp_key_handle_destroy(self.handle);
}
self.handle = ptr::null_mut();
}
}
}
mod identifier;
pub use identifier::KeyIdentifier;
mod flags;
pub use flags::{
ExportFlags, LoadSaveFlags, RemoveFlags, RemoveSignaturesFlags, UnloadFlags,
};
mod inspection;
mod mutation;
pub use mutation::{AddUidOptions, ProtectOptions, RevocationCode, RevocationReason};
pub(crate) use mutation::export_revocation_impl;
mod lookup;