pub struct Signer { /* private fields */ }
Expand description
Wraps low-level signing backends and adds caching, similar to Store
.
Implementations§
Source§impl Signer
impl Signer
Sourcepub fn from_settings(settings: &UserSettings) -> Result<Self, SignInitError>
pub fn from_settings(settings: &UserSettings) -> Result<Self, SignInitError>
Creates a signer based on user settings. Uses all known backends, and chooses one of them to be used for signing depending on the config.
Sourcepub fn new(
main_backend: Option<Box<dyn SigningBackend>>,
other_backends: Vec<Box<dyn SigningBackend>>,
) -> Self
pub fn new( main_backend: Option<Box<dyn SigningBackend>>, other_backends: Vec<Box<dyn SigningBackend>>, ) -> Self
Creates a signer with the given backends.
Sourcepub fn can_sign(&self) -> bool
pub fn can_sign(&self) -> bool
Checks if the signer can sign, i.e. if a main backend is configured.
Sourcepub fn sign(&self, data: &[u8], key: Option<&str>) -> SignResult<Vec<u8>>
pub fn sign(&self, data: &[u8], key: Option<&str>) -> SignResult<Vec<u8>>
This is just a pass-through to the main backend that unconditionally creates a signature.
Sourcepub fn verify(
&self,
commit_id: &CommitId,
data: &[u8],
signature: &[u8],
) -> SignResult<Verification>
pub fn verify( &self, commit_id: &CommitId, data: &[u8], signature: &[u8], ) -> SignResult<Verification>
Looks for backend that can verify the signature and returns the result of its verification.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Signer
impl !RefUnwindSafe for Signer
impl Send for Signer
impl Sync for Signer
impl Unpin for Signer
impl !UnwindSafe for Signer
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> 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>
Converts
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>
Converts
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