vk-token-manager

Crates.iovk-token-manager
lib.rsvk-token-manager
version0.2.0
sourcesrc
created_at2020-05-11 12:51:14.028329
updated_at2020-05-15 13:26:42.520503
descriptionUseful abstractions for managing VK tokens
homepage
repository
max_upload_size
id240108
size7,062
prostomarkeloff (prostomarkeloff)

documentation

README

Token Manager

This crate provides useful abstractions for managing VK tokens.

Install

[dependencies]
vk-token-manager = "0.2.0"

Using

Checkout /examples directory for more examples.

use token_manager::{TokenManager, ManageTokens};
use token_manager::{GroupId, SimpleToken, Token};
let mut manager = TokenManager::new(); // create token manager
// put (boxed) token into.
manager.add_token(GroupId::new(123), Box::new(SimpleToken::new(Token::new("my-token".into()))));
let result = async {
    // get token by id
    let tok = manager.get_by_id(GroupId::new(123)).await;
    assert_eq!(tok, Some(&Token::new("my-token".into())));
};
Commit count: 0

cargo fmt