Crates.io | wecom-crypto |
lib.rs | wecom-crypto |
version | 0.1.9 |
source | src |
created_at | 2024-02-10 14:32:14.606092 |
updated_at | 2024-04-06 08:50:49.813776 |
description | 企业微信API数据加解密库。 |
homepage | |
repository | https://github.com/wandering-ai/wecom-crypto |
max_upload_size | |
id | 1134989 |
size | 9,419 |
wecom-crypto
提供了企业微信API数据的加解密功能。其实现完全遵循官方文档中的规定。
use wecom_crypto::{CryptoAgent, CryptoSource};
let key = "cGCVnNJRgRu6wDgo7gxG2diBovGnRQq1Tqy4Rm4V4qF";
let agent = CryptoAgent::new(key);
let source = CryptoSource {
text: "hello world!".to_string(),
receive_id: "wandering-ai".to_string(),
};
let enc = agent.encrypt(&source);
let dec = agent.decrypt(enc.as_str()).unwrap();
assert_eq!(source, dec);