[−][src]Trait data_vault::DataVault
This is what a Data Vault can do It's fundamental purpose is to store and retrieve data in a secure encrypted manner
Required methods
fn new() -> Self
#[must_use]fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 String,
string: &'life2 String
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
&'life0 self,
token: &'life1 String,
string: &'life2 String
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
#[must_use]fn store_credit_card<'life0, 'life1, 'async_trait>(
&'life0 self,
credit_card: &'life1 CreditCard
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
credit_card: &'life1 CreditCard
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
#[must_use]fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
#[must_use]fn retrieve_credit_card<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = CreditCard> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = CreditCard> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Implementors
impl DataVault for RedisDataVault
[src]
fn new() -> Self
[src]
Create new RedisDataVault backend
examples
use data_vault::DataVault; use data_vault::RedisDataVault; let rdv = RedisDataVault::new();
fn store<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 String,
string: &'life2 String
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
token: &'life1 String,
string: &'life2 String
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Encrypt and Store a string with the given token as the redis key
Arguments:
* CreditCard
- the cc object that you wish to store
return:
the token as String
example
use data_vault::DataVault; use data_vault::RedisDataVault; let token = String::from("abc123"); let credit_card_string = String::from("{number: 123}"); let rdv = RedisDataVault::new(); rdv.store(&token, &credit_card_string);
fn store_credit_card<'life0, 'life1, 'async_trait>(
&'life0 self,
credit_card: &'life1 CreditCard
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
credit_card: &'life1 CreditCard
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Store the credit card in the data vault
Arguments:
* CreditCard
- the cc object that you wish to store
return:
A new token as String
example
use data_vault::DataVault; use data_vault::RedisDataVault; use credit_card::CreditCard; let cc = CreditCard { number: "4111111111111111".to_string(), cardholder_name: "Graydon Hoare".to_string(), expiration_month: "01".to_string(), expiration_year: "2023".to_string(), brand: None, security_code: None }; let rdv = RedisDataVault::new(); let token = rdv.store_credit_card(&cc);
fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get decrypted arbitrary data from the vault by token
Arguments:
* token
: the string form of the ID of the data
returns:
* the decrypted string of data
example
ⓘThis example is not tested
use data_vault::DataVault; use data_vault::RedisDataVault; let token = String::from("abc123"); let cc_string = String::from("{number: 123}"); let rdv = RedisDataVault::new(); rdv.store(&token, &cc_string).await; let credit_card_string = rdv.retrieve(&token)
fn retrieve_credit_card<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = CreditCard> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
token: &'life1 String
) -> Pin<Box<dyn Future<Output = CreditCard> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get the credit card from the data vault given a token
Arguments:
* token
: the string form of the ID of the data
returns:
* CreditCard
object
Example
ⓘThis example is not tested
use data_vault::DataVault; use data_vault::RedisDataVault; use credit_card::CreditCard; let cc = CreditCard { number: "4111111111111111".to_string(), cardholder_name: "Graydon Hoare".to_string(), expiration_month: "01".to_string(), expiration_year: "2023".to_string(), brand: None, security_code: None }; let rdv = RedisDataVault::new(); let token = rdv.store_credit_card(&cc).await; let credit_card = rdv.retrieve_credit_card(&token).await;