[][src]Struct tls_sig_api::TlsSigApiVer2

pub struct TlsSigApiVer2 { /* fields omitted */ }

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]

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

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self