1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # Authy
//!
//! Bindings for the Authy two factor web service
//!
//! ## Usage
//!
//! You will need your API key for your application on [authy.com](https://authy.com).
//!
//! Be sure to add the authy crate to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! authy = "*"
//! ```
//!
//! Usage example:
//!
//! ```rust
//! extern crate authy;
//! use authy::Client;
//! use authy::user::User;
//!
//! fn main() {
//!     let api_url = "https://sandbox-api.authy.com";
//!     let api_key = "bf12974d70818a08199d17d5e2bae630";
//!
//!     let c = Client::new(api_url, api_key);
//!
//!     let country_code = 1;
//!     let email = "user@domain.com";
//!     let phone = "949-555-1234";
//!
//!     let mut user = User::create(&c, email, country_code, phone, true).unwrap();
//!     
//!     println!("We have a user: {:#?}", user);
//!
//!     let code = "000000"; // Pretend user has provided a valid code
//!     if user.verify(&c, code).unwrap() {
//!         println!("Congrats on being validated!");
//!     }
//!
//!     // Lets send out a sms token just for fun
//!     // Must be using a real API key on the production authy server for this to
//!     // actually send out anything.
//!     user.sms(&c, true, Some("login"), Some("Authy documentation example login")).unwrap();
//! }
//! ```
#![feature(custom_attribute)]

extern crate reqwest;

#[macro_use]
extern crate serde_derive;
extern crate serde_json;

mod error;
pub use error::AuthyError;

mod client;
pub use client::{Client, Status};

pub mod api;

pub mod user;
pub mod phone;