pub trait IdentityPluginV1 {
// Required methods
fn add_identity(
&mut self,
index: usize,
plugin_name: &str,
bytes: &[u8],
) -> Result<(), Error>;
fn unwrap_file_keys(
&mut self,
files: Vec<Vec<Stanza>>,
callbacks: impl Callbacks<Error>,
) -> Result<HashMap<usize, Result<FileKey, Vec<Error>>>>;
}Expand description
The interface that age implementations will use to interact with an age plugin.
Implementations of this trait will be used within the identity-v1 state machine.
Required Methods§
Sourcefn add_identity(
&mut self,
index: usize,
plugin_name: &str,
bytes: &[u8],
) -> Result<(), Error>
fn add_identity( &mut self, index: usize, plugin_name: &str, bytes: &[u8], ) -> Result<(), Error>
Stores an identity that the user would like to use for decrypting age files.
plugin_name is the name of the binary that resolved to this plugin.
Returns an error if the identity is unknown or invalid.
Sourcefn unwrap_file_keys(
&mut self,
files: Vec<Vec<Stanza>>,
callbacks: impl Callbacks<Error>,
) -> Result<HashMap<usize, Result<FileKey, Vec<Error>>>>
fn unwrap_file_keys( &mut self, files: Vec<Vec<Stanza>>, callbacks: impl Callbacks<Error>, ) -> Result<HashMap<usize, Result<FileKey, Vec<Error>>>>
Attempts to unwrap the file keys contained within the given age recipient stanzas,
using identities previously stored via add_identity.
Returns a HashMap containing the unwrapping results for each file:
-
A list of errors, if any stanzas for a file cannot be unwrapped that detectably should be unwrappable.
-
A
FileKey, if any stanza for a file can be successfully unwrapped.
Note that if all known and valid stanzas for a given file cannot be unwrapped, and
none are expected to be unwrappable, that file has no entry in the HashMap. That
is, file keys that cannot be unwrapped are implicit.
callbacks can be used to interact with the user, to have them take some physical
action or request a secret value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.