Crates.io | jiguang-certification |
lib.rs | jiguang-certification |
version | 0.1.1 |
source | src |
created_at | 2021-04-24 17:09:18.288824 |
updated_at | 2021-04-24 17:25:07.319781 |
description | 极光认证登录SDK, JiGuang Certification SDK |
homepage | |
repository | https://github.com/EchoRust/JiGuangCertification |
max_upload_size | |
id | 389026 |
size | 20,534 |
极光认证整合了三大运营商的网关认证能力,为开发者提供了一键登录和号码认证功能,优化用户注册/登录、号码验证的体验,提高安全性。
本SDK非官方SDK。
[dependencies]
jiguang-certification = "0.1"
提交loginToken,验证后返回手机号码
use jiguang_certification::JiGuang;
use jiguang_certification::PrivateKey;
let jiguang = JiGuang::new("12345", "qwerty");
let s = r#"
-----BEGIN PRIVATE KEY-----
MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBALx3lux8fiSk8+2f
au7sdQtaAu7GGEIr5juBy6nXq4K+73rN8HPMxEpmg6SnGMFzDL+UlUH9JoRuW7D4
qi7mHmtiOhLXbTSNpPPM/It9gHXYDMV1bD4Z6l3gafttaoim1JGfCqlXQAjzVm1u
-----END PRIVATE KEY-----
"#;
let private_key = PrivateKey::from_str(s).unwrap();
let phone = jiguang.login_token_verify("login_token", &private_key).await.unwrap();
println!("{}", phone);
提交手机号码和token,验证是否一致
use jiguang_certification::JiGuang;
use jiguang_certification::VerifyType;
let jiguang = JiGuang::new("12345", "qwerty");
let result = jiguang.verify("token", "phone", VerifyType::APP).await.unwrap();
assert!(result);
Copyright (c) 2021-present, Yang (Echo) Li