pub struct KeyStore { /* private fields */ }Expand description
The personal keys visdom holds, one per console, project and account.
Implementations§
Source§impl KeyStore
impl KeyStore
pub fn at(path: PathBuf) -> KeyStore
Sourcepub fn lock(&self) -> Result<KeyStoreLock>
pub fn lock(&self) -> Result<KeyStoreLock>
Wait for this store to be free of every other visdom process, and
take it. Issuing a key revokes the previous one, so two sessions
starting together must not both issue: the second waits here and then
finds the first one’s key.
Sourcepub fn usable(
&self,
console_url: &str,
project_id: &str,
account: &str,
billing: Billing,
now: i64,
) -> Option<IssuedKey>
pub fn usable( &self, console_url: &str, project_id: &str, account: &str, billing: Billing, now: i64, ) -> Option<IssuedKey>
The stored key of the kind billing of account for this console
and project, when it has enough left: MIN_KEY_SECONDS_LEFT, or for
a subscription key MIN_SUBSCRIPTION_KEY_SECONDS_LEFT. Of several,
the one that lasts longest.
Sourcepub fn unexpired(
&self,
console_url: &str,
project_id: &str,
account: &str,
billing: Billing,
now: i64,
) -> Option<IssuedKey>
pub fn unexpired( &self, console_url: &str, project_id: &str, account: &str, billing: Billing, now: i64, ) -> Option<IssuedKey>
The stored key of the kind billing of account for this console
and project that lasts longest, if any has not expired and was not
refused, however little it has left: what a check tries, changing
nothing. (A launch replaces one inside its renewal window; see
Self::usable.)
Sourcepub fn keep(
&self,
console_url: &str,
project_id: &str,
account: &str,
billing: Billing,
key: &IssuedKey,
now: i64,
) -> Result<(), String>
pub fn keep( &self, console_url: &str, project_id: &str, account: &str, billing: Billing, key: &IssuedKey, now: i64, ) -> Result<(), String>
Keep key of the kind billing, dropping keys that have expired. An
ordinary key replaces the one for the same console and project
(whoever’s it was: this machine’s user is now account), as issuing
it revoked that one. A subscription key revoked nothing: account’s
earlier ones stay until they expire, for logout to revoke; another
account’s go. The file is the user’s alone.
Sourcepub fn refuse(&self, secret: &str) -> Result<(), String>
pub fn refuse(&self, secret: &str) -> Result<(), String>
Mark the kept key secret as refused by the gateway: it is not handed
out again, but stays for logout to revoke. Call under Self::lock.
Sourcepub fn clear(&self) -> Result<()>
pub fn clear(&self) -> Result<()>
Forget every kept key (on logout, after revoke_kept).