jiguang-certification

Crates.iojiguang-certification
lib.rsjiguang-certification
version0.1.1
sourcesrc
created_at2021-04-24 17:09:18.288824
updated_at2021-04-24 17:25:07.319781
description极光认证登录SDK, JiGuang Certification SDK
homepage
repositoryhttps://github.com/EchoRust/JiGuangCertification
max_upload_size
id389026
size20,534
Leon (LyonRust)

documentation

README

极光认证Rust SDK

Crates.io MIT licensed

极光认证整合了三大运营商的网关认证能力,为开发者提供了一键登录和号码认证功能,优化用户注册/登录、号码验证的体验,提高安全性。

本SDK非官方SDK。

应用场景

  • 注册
  • 登录
  • 二次验证

添加依赖

[dependencies]
jiguang-certification = "0.1"

Example

提交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);

版权声明

MIT

Copyright (c) 2021-present, Yang (Echo) Li

Commit count: 6

cargo fmt