[−][src]Trait rfc_4226::Secret
Shared secret.
As per RFC 4226, "each HOTP generator has a different and unique secret."
This trait enables abstraction over different types of secret. All secrets must be coerced to a
byte string for hashing, so secrets must implement AsRef<[u8]>
. This trait is implemented for
[u8; n]
for 16 ≤ n ≤ 32, drawing inspiration from libcore
. It is also implemented for
&str
and String
. Thus, any of these types may be used as secrets with no additional
configuration.
Requirements
As per RFC 4226, the secret MUST be at least 128 bits (with a recommended length of 160 bits). If the secret is not at least this long, the functions in this crate will return errors.