feat: update dependencies

This commit is contained in:
2023-09-23 14:04:47 +08:00
parent 9636eba5f7
commit d36335a885
4 changed files with 855 additions and 1643 deletions

2470
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "acme-client" name = "acme-client"
version = "1.3.3" version = "1.3.4"
authors = ["Hatter Jiang <jht5945@gmail.com>"] authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018" edition = "2018"
description = "Acme auto challenge client, acme-client can issue certificates from Let's encrypt" description = "Acme auto challenge client, acme-client can issue certificates from Let's encrypt"
@@ -15,18 +15,18 @@ acme-lib = "0.8"
tide = "0.16" tide = "0.16"
async-std = { version = "1.8", features = ["attributes"] } async-std = { version = "1.8", features = ["attributes"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
deser-hjson = "0.1" deser-hjson = "2.2"
x509-parser = "0.9" x509-parser = "0.9"
reqwest = { version = "0.11", features = ["blocking"] } reqwest = { version = "0.11", features = ["blocking"] }
#reqwest = { version = "0.11", default-features = false, features = ["blocking", "rustls-tls"] } #reqwest = { version = "0.11", default-features = false, features = ["blocking", "rustls-tls"] }
trust-dns-resolver = "0.20" trust-dns-resolver = "0.23"
simpledateformat = "0.1.3" simpledateformat = "0.1.3"
serde_json = "1.0" serde_json = "1.0"
urlencoding = "1.0.0" urlencoding = "2.1"
base64 = "0.11.0" base64 = "0.21"
hmac = "0.7.1" hmac = "0.12"
sha2 = "0.8.1" sha2 = "0.10"
aliyun-openapi-core-rust-sdk = "0.3.0" aliyun-openapi-core-rust-sdk = "1.1.0"
[profile.release] [profile.release]
codegen-units = 1 codegen-units = 1

View File

@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rust_util::XResult; use rust_util::XResult;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use aliyun_openapi_core_rust_sdk::RPClient; use aliyun_openapi_core_rust_sdk::RPClient;

View File

@@ -1,8 +1,11 @@
use std::io::{Error, ErrorKind}; use std::io::{Error, ErrorKind};
use std::time::SystemTime; use std::time::SystemTime;
use base64::Engine;
use base64::engine::general_purpose::STANDARD;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
use rust_util::XResult; use rust_util::XResult;
use hmac::{Hmac, Mac}; use hmac::{Hmac, Mac};
use hmac::digest::FixedOutput;
use sha2::Sha256; use sha2::Sha256;
use crate::config::CertConfig; use crate::config::CertConfig;
@@ -39,7 +42,7 @@ fn inner_send_dingtalk_message(access_token: &str, sec_token: &str, message: &st
if !sec_token.is_empty() { if !sec_token.is_empty() {
let timestamp = &format!("{}", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis()); let timestamp = &format!("{}", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis());
let timestamp_and_secret = &format!("{}\n{}", timestamp, sec_token); let timestamp_and_secret = &format!("{}\n{}", timestamp, sec_token);
let hmac_sha256 = base64::encode(&calc_hmac_sha256(sec_token.as_bytes(), timestamp_and_secret.as_bytes())?[..]); let hmac_sha256 = STANDARD.encode(&calc_hmac_sha256(sec_token.as_bytes(), timestamp_and_secret.as_bytes())?[..]);
webhook_url.push_str("&timestamp="); webhook_url.push_str("&timestamp=");
webhook_url.push_str(timestamp); webhook_url.push_str(timestamp);
webhook_url.push_str("&sign="); webhook_url.push_str("&sign=");
@@ -77,12 +80,12 @@ fn get_dingtalk_notify_token(cert_config: &CertConfig) -> Option<(String, String
/// calc hma_sha256 digest /// calc hma_sha256 digest
fn calc_hmac_sha256(key: &[u8], message: &[u8]) -> XResult<Vec<u8>> { fn calc_hmac_sha256(key: &[u8], message: &[u8]) -> XResult<Vec<u8>> {
let mut mac = match Hmac::<Sha256>::new_varkey(key) { let mut mac = match Hmac::<Sha256>::new_from_slice(key) {
Ok(m) => m, Ok(m) => m,
Err(e) => { Err(e) => {
return Err(Box::new(Error::new(ErrorKind::Other, format!("Hmac error: {}", e)))); return Err(Box::new(Error::new(ErrorKind::Other, format!("Hmac error: {}", e))));
} }
}; };
mac.input(message); mac.update(message);
Ok(mac.result().code().to_vec()) Ok(mac.finalize_fixed().to_vec())
} }