pub struct CTorClientKeystore(CTorKeystore);
keymgr
and ctor-keystore
only.Expand description
A read-only C Tor client keystore.
This keystore provides read-only access to the client restricted discovery keys
rooted at a given ClientOnionAuthDir
directory (see ClientOnionAuthDir
in tor(1)
).
The key files must be in the
<hsid>:descriptor:x25519:<base32-encoded-x25519-public-key>
format
and have the .auth_private
extension.
Invalid keys, and keys that don’t have the expected extension, will be ignored.
The only supported Keystore
operations are contains
,
get
, and list
. All other keystore operations
will return an error.
This keystore implementation uses the CTorPath
of the requested KeySpecifier
and the [KeystoreItemType
] to identify the appropriate restricted discovery keypair.
If the requested CTorPath
is not ClientHsDescEncKey
,
the keystore will declare the key not found.
If the requested CTorPath
is ClientHsDescEncKey
,
but the KeystoreItemType
is not X25519StaticKeypair
,
an error is returned.
Tuple Fields§
§0: CTorKeystore
Implementations§
Source§impl CTorClientKeystore
impl CTorClientKeystore
Sourcepub fn from_path_and_mistrust(
keystore_dir: impl AsRef<Path>,
mistrust: &Mistrust,
id: KeystoreId,
) -> Result<Self>
pub fn from_path_and_mistrust( keystore_dir: impl AsRef<Path>, mistrust: &Mistrust, id: KeystoreId, ) -> Result<Self>
Create a new CTorKeystore
rooted at the specified keystore_dir
directory.
This function returns an error if keystore_dir
is not a directory,
or if it does not conform to the requirements of the specified Mistrust
.
Source§impl CTorClientKeystore
impl CTorClientKeystore
Sourcefn list_entries(&self, dir: &RelKeyPath<'_>) -> Result<ReadDir>
fn list_entries(&self, dir: &RelKeyPath<'_>) -> Result<ReadDir>
List all the key entries in the keystore_dir.
Source§impl CTorClientKeystore
impl CTorClientKeystore
Sourcefn read_key(
&self,
key_path: &Path,
) -> StdResult<Option<String>, CTorKeystoreError>
fn read_key( &self, key_path: &Path, ) -> StdResult<Option<String>, CTorKeystoreError>
Read the contents of the specified key.
Returns Ok(None)
if the file doesn’t exist.
Sourcefn list_keys(
&self,
) -> Result<impl Iterator<Item = StdResult<(HsId, HsClientDescEncKeypair), CTorKeystoreError>> + '_>
fn list_keys( &self, ) -> Result<impl Iterator<Item = StdResult<(HsId, HsClientDescEncKeypair), CTorKeystoreError>> + '_>
List all entries in this store
Returns a list of results, where Ok
signifies a recognized entry,
and Err(CTorKeystoreError)
an unrecognized one.
A key is said to be recognized if its file name ends with .auth_private
,
and it presents this format:
<hsid>:descriptor:x25519:<base32-encoded-x25519-public-key>
Trait Implementations§
Source§impl Keystore for CTorClientKeystore
impl Keystore for CTorClientKeystore
Source§fn id(&self) -> &KeystoreId
fn id(&self) -> &KeystoreId
Source§fn contains(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<bool>
fn contains( &self, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<bool>
key_spec
exists in this key store.Source§fn get(
&self,
key_spec: &dyn KeySpecifier,
item_type: &KeystoreItemType,
) -> Result<Option<ErasedKey>>
fn get( &self, key_spec: &dyn KeySpecifier, item_type: &KeystoreItemType, ) -> Result<Option<ErasedKey>>
key_spec
. Read moreSource§fn raw_entry_id(&self, raw_id: &str) -> Result<RawEntryId>
fn raw_entry_id(&self, raw_id: &str) -> Result<RawEntryId>
onion-service-cli-extra
only.RawEntryId
that
represents the raw unique identifier of an entry in this keystore. Read moreSource§fn insert(
&self,
_key: &dyn EncodableItem,
_key_spec: &dyn KeySpecifier,
) -> Result<()>
fn insert( &self, _key: &dyn EncodableItem, _key_spec: &dyn KeySpecifier, ) -> Result<()>
key
to the key store.Source§fn remove(
&self,
_key_spec: &dyn KeySpecifier,
_item_type: &KeystoreItemType,
) -> Result<Option<()>>
fn remove( &self, _key_spec: &dyn KeySpecifier, _item_type: &KeystoreItemType, ) -> Result<Option<()>>
Source§fn remove_unchecked(&self, _entry_id: &RawEntryId) -> Result<()>
fn remove_unchecked(&self, _entry_id: &RawEntryId) -> Result<()>
onion-service-cli-extra
only.Source§fn list(&self) -> Result<Vec<KeystoreEntryResult<KeystoreEntry<'_>>>>
fn list(&self) -> Result<Vec<KeystoreEntryResult<KeystoreEntry<'_>>>>
Auto Trait Implementations§
impl Freeze for CTorClientKeystore
impl RefUnwindSafe for CTorClientKeystore
impl Send for CTorClientKeystore
impl Sync for CTorClientKeystore
impl Unpin for CTorClientKeystore
impl UnwindSafe for CTorClientKeystore
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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