Struct crev_lib::local::Local [−][src]
pub struct Local { /* fields omitted */ }
Expand description
Local config stored in ~/.config/crev
This managed IDs, local proof repository, etc.
Implementations
Where the config is stored
Where temporary files are stored
Fails if it already exists. See auto_create_or_open()
Load the database from disk, or create one if needed.
Load config, and return Id configured as the current one
Load config, and return Id configured as the current one
Calculate for_id
that is used in a lot of operations
- if
id_str
is given and parses correctly - convert to Id. - otherwise return current id
Load config, update which Id is the current one, and save.
Same as get_root_path()
Directory where yaml files for user identities are stored
Directory where git checkouts for user’s own proof repos are stored
This is separate from cache of other people’s proofs
Like user_proofs_path
but checks if the dir exists
Returns public Ids which belong to the current user.
Path where git checkouts of other people’s proof repos are stored
Copy crate for review, neutralizing hidden or dangerous files
pub fn record_review_activity(
&self,
source: &str,
name: &str,
version: &Version,
activity: &ReviewActivity
) -> Result<(), Error>
pub fn record_review_activity(
&self,
source: &str,
name: &str,
version: &Version,
activity: &ReviewActivity
) -> Result<(), Error>
Save activity (in-progress review) to disk
pub fn read_review_activity(
&self,
source: &str,
name: &str,
version: &Version
) -> Result<Option<ReviewActivity>, Error>
pub fn read_review_activity(
&self,
source: &str,
name: &str,
version: &Version
) -> Result<Option<ReviewActivity>, Error>
Load activity (in-progress review) from disk
Just returns the config, doesn’t change anything
Writes the config to disk AND sets it as the current one
Id in the config
Just reads the yaml file, doesn’t change any state
Just reads the yaml file, doesn’t change any state
Just reads the yaml file, doesn’t change any state
pub fn read_current_unlocked_id_opt(
&self,
passphrase_callback: PassphraseFn<'_>
) -> Result<Option<UnlockedId>, Error>
pub fn read_current_unlocked_id_opt(
&self,
passphrase_callback: PassphraseFn<'_>
) -> Result<Option<UnlockedId>, Error>
Just reads the yaml file and unlocks it, doesn’t change any state
pub fn read_current_unlocked_id(
&self,
passphrase_callback: PassphraseFn<'_>
) -> Result<UnlockedId, Error>
pub fn read_current_unlocked_id(
&self,
passphrase_callback: PassphraseFn<'_>
) -> Result<UnlockedId, Error>
Just reads the yaml file and unlocks it, doesn’t change anything
pub fn read_unlocked_id(
&self,
id: &Id,
passphrase_callback: PassphraseFn<'_>
) -> Result<UnlockedId, Error>
pub fn read_unlocked_id(
&self,
id: &Id,
passphrase_callback: PassphraseFn<'_>
) -> Result<UnlockedId, Error>
Just reads the yaml file and unlocks it, doesn’t change anything
Asks for passphrase up to 5 times
Changes the repo URL for the ID. Adopts existing temporary/local repo if any. Previous remote URL is abandoned. For crev id set-url command.
Writes the Id to disk, doesn’t change any state
Git clone or init new remote Github crev-proof repo for the current user.
Saves to user_proofs_path
, so it’s trusted as user’s own proof repo.
Inits repo in get_proofs_dir_path()
Dir unique to this URL, inside user_proofs_path()
Path where the proofs
are stored under git
repository.
This function derives path from current user’s URL
This function derives path from current user’s URL
pub fn build_trust_proof(
&self,
from_id: &PublicId,
ids: Vec<Id>,
trust_level: TrustLevel
) -> Result<Trust, Error>
pub fn build_trust_proof(
&self,
from_id: &PublicId,
ids: Vec<Id>,
trust_level: TrustLevel
) -> Result<Trust, Error>
Creates new unsigned trust proof object, not edited
Ensures the proof contains valid URLs for Ids where possible.
Currently ignores previous proofs
See trust.sign_by(ownid)
Fetch other people’s proof repostiory from a git URL, into the current database on disk
Fetch other people’s proof repostiory from a git URL, directly into the given db (and disk too)
pub fn trust_set_for_id(
&self,
for_id: Option<&str>,
params: &TrustDistanceParams,
db: &ProofDB
) -> Result<TrustSet, Error>
pub fn fetch_new_trusted(
&self,
trust_params: TrustDistanceParams,
for_id: Option<&str>
) -> Result<(), Error>
pub fn fetch_new_trusted(
&self,
trust_params: TrustDistanceParams,
for_id: Option<&str>
) -> Result<(), Error>
Fetch only repos that weren’t fetched before
pub fn fetch_trusted(
&self,
trust_params: TrustDistanceParams,
for_id: Option<&str>
) -> Result<(), Error>
pub fn fetch_trusted(
&self,
trust_params: TrustDistanceParams,
for_id: Option<&str>
) -> Result<(), Error>
Fetch proof repo URLs of trusted Ids
Per-url directory in cache_remotes_path()
Fetch a git proof repository
Returns url where it was cloned/fetched
Adds the repo to the local proof repo cache.
Fetches and imports to the given db
Same as fetch_url_into
, but with more stats
dir - where the proofs were downloaded to url - url from which it was fetched
Fetch and discover proof repos. Like fetch_all_ids_recursively
,
but adds https://github.com/dpc/crev-proofs
and repos in cache that didn’t belong to any Ids.
Run arbitrary git command in get_proofs_dir_path()
set open_cmd
in the config
Create a new proofdb, and populate it with local repo and cache content.
The path must be inside get_proofs_dir_path()
Add a commit to user’s proof repo
Prints read_current_locked_id
Generate a new identity in the local config.
It’s OK if the URL contains other identities. A new one will be added.
The callback should provide a passphrase
See read_locked_id
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Local
impl UnwindSafe for Local