[−][src]Struct tls_sig_api::TlsSigApiVer2
Methods
impl TlsSigApiVer2
[src]
pub fn new(sdkappid: u64, key: &str) -> Self
[src]
pub fn appid(&self) -> u64
[src]
pub fn update_key(&mut self, key: &str)
[src]
In case that the key is leaked, we want to update the key at runtime.
pub fn gen_sign(
&self,
identifier: &str,
expire: Duration,
userbuf: Option<&str>
) -> String
[src]
&self,
identifier: &str,
expire: Duration,
userbuf: Option<&str>
) -> String
generate user sign with timestamp. Note that the SDK only accept timestamps in seconds.
Examples
use tls_sig_api::TlsSigApiVer2; use chrono::Duration; let mock_key = "5bd2850fff3ecb11d7c805251c51ee463a25727bddc2385f3fa8bfee1bb93b5e"; let signer = TlsSigApiVer2::new(0, mock_key); let identifier = "10086"; let expire = Duration::hours(2); let userbuf = "This' really a good crate!"; let digest = signer.gen_sign(identifier, expire, Some(userbuf)); println!("{}", digest);
Auto Trait Implementations
impl Send for TlsSigApiVer2
impl Sync for TlsSigApiVer2
impl Unpin for TlsSigApiVer2
impl UnwindSafe for TlsSigApiVer2
impl RefUnwindSafe for TlsSigApiVer2
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self