Skip to content

Commit

Permalink
Merge pull request #19 from wslongchen/develop
Browse files Browse the repository at this point in the history
0.2.0版本更新
  • Loading branch information
wslongchen authored Sep 28, 2022
2 parents 7dd1652 + d0d3dd1 commit 8c116e4
Show file tree
Hide file tree
Showing 54 changed files with 1,888 additions and 469 deletions.
14 changes: 11 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "labrador"
version = "0.1.12"
version = "0.2.0"
authors = ["mrpan <1049058427@qq.com>"]
edition = "2018"
description = "Labrador - Mini thirdpart client for rust."
Expand Down Expand Up @@ -32,11 +32,17 @@ serde-xml-rs = "0.6.0"
rustc-serialize = "^0.3"
serde_urlencoded = "0.7.1"
urlencoding = "2.1.0"
openssl = { version = "0.10.41" }
tracing = "0.1"
openssl = { version = "0.10.41", features=["vendored"],optional= true }
log = {version = "0.4"}
tracing = { version = "0.1.35"}
dashmap = "5.3.4"
json = {version = "0.12.4", optional= true }
once_cell = "1.8"

rust-crypto = {version = "^0.2", optional= true}
rsa = {version = "0.6.1", optional= true}
x509-parser = {version = "0.14.0", features=["verify"], optional= true}

[dev-dependencies]
tokio = { version = "1", features=["full"] }

Expand All @@ -49,6 +55,8 @@ rustdoc-args = [
### FEATURES #################################################################

[features]
default = ["rust-crypto", "rsa", "x509-parser"]
openssl-crypto = ["openssl"]

# Provide wechat
wechat = [ "sxd-document", "sxd-xpath"]
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ Features:
* ```jd``` - Jingdong related services
* ```wechat``` - Wechat related services

### Crypto Features

+ openssl-crypto
If you enable `openssl-crypto` feature.
All encryption in this project is done with openssl. Later, other encryption databases will be supported for selection. Therefore, openssl needs to be introduced. See [openssl] for details.

[openssl]: https://docs.rs/openssl/0.10.41/openssl/

+ default crpto

the default encryption in this project is [rust-crypto] & [x509_parser] & [rsa]
[rust-crypto]: https://docs.rs/rust-crypto/0.2.36/crypto/
[x509_parser]: https://docs.rs/x509-parser/0.14.0/x509_parser/
[rsa]: https://docs.rs/rsa/0.6.1/rsa/

### Supported Platform

| Platform | is supported |
Expand Down
15 changes: 15 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ Features:
* ```jd``` - 京东
* ```wechat``` - 微信

### Crypto Features

+ openssl-crypto
如果你开起来了 `openssl-crypto` feature,
则本项目所有加密都是用openssl进行,后续会支持其他加密库以供挑选,所以需要引入openssl相关,详情见[openssl]相关说明。

[openssl]: https://docs.rs/openssl/0.10.41/openssl/

+ 默认加密

默认加密主要采用 [rust-crypto] & [x509_parser] & [rsa],感兴趣的可以去相关文档查看。
[rust-crypto]: https://docs.rs/rust-crypto/0.2.36/crypto/
[x509_parser]: https://docs.rs/x509-parser/0.14.0/x509_parser/
[rsa]: https://docs.rs/rsa/0.6.1/rsa/

### Supported Platform

| 平台 | 是否支持 |
Expand Down
4 changes: 4 additions & 0 deletions src/alipay/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub enum AlipayMethod {
SystemOauthToken,
/// 换取应用授权令牌
OpenAuthTokenApp,
/// 应用支付宝公钥证书下载
DownloadAlipayCert,
/// 自定义方法
Custom { method: String, response_key: String }
}
Expand All @@ -49,6 +51,7 @@ impl RequestMethod for AlipayMethod {
AlipayMethod::QueryRefund => String::from("alipay.trade.fastpay.refund.query"),
AlipayMethod::CancelOrder => String::from("alipay.trade.cancel"),
AlipayMethod::SystemOauthToken => String::from("alipay.system.oauth.token"),
AlipayMethod::DownloadAlipayCert => String::from("alipay.open.app.alipaycert.download"),
AlipayMethod::OpenAuthTokenApp => String::from("alipay.open.auth.token.app"),
AlipayMethod::Custom{ ref method, .. } => method.to_string()
}
Expand All @@ -69,6 +72,7 @@ impl RequestMethod for AlipayMethod {
AlipayMethod::CancelOrder => String::from("alipay_trade_cancel_response"),
AlipayMethod::SystemOauthToken => String::from("alipay_system_oauth_token_response"),
AlipayMethod::OpenAuthTokenApp => String::from("alipay_open_auth_token_app_response"),
AlipayMethod::DownloadAlipayCert => String::from("alipay_open_app_alipaycert_download_response"),
AlipayMethod::Custom{ ref response_key, .. } => response_key.to_string()
}
}
Expand Down
Loading

0 comments on commit 8c116e4

Please sign in to comment.