Trait chbs::component::traits::WordProvider [−][src]
pub trait WordProvider: HasEntropy + Debug + Iterator<Item = String> + Clone { fn word(&mut self) -> String; }
Something that provides random words.
A word provider is used to provide any number of words for passphrase generation. Whether random words are genrated, or whether they are sampled from a known wordlist is undefined and decided by the implementor. Providers must be infinite and should never deplete. It is possible that the same word may be obtained more than once.
When generating a passphrase a set of words is obtained from a word provider by subsequent
calls to word
.
This trait is not used as component kind on Scheme
, it may however be
useful to implement on types that support this functionallity. In addition to that, the
WordSetProvider
should be easy to implement on types that implement this
trait.
Required Methods
fn word(&mut self) -> String
Obtain a random word.
This method should obtain and return a random word from the provider. The randomization must be cryptographically secure as it's used for generating passphrases.
Implementors
impl WordProvider for WordSampler