wecom-crypto

Crates.iowecom-crypto
lib.rswecom-crypto
version0.1.9
sourcesrc
created_at2024-02-10 14:32:14.606092
updated_at2024-04-06 08:50:49.813776
description企业微信API数据加解密库。
homepage
repositoryhttps://github.com/wandering-ai/wecom-crypto
max_upload_size
id1134989
size9,419
Yin Guobing (yinguobing)

documentation

README

wecom-crypto

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);
Commit count: 16

cargo fmt