refactor(commands): directly use native encryption function

This commit is contained in:
2025-04-29 08:08:29 -04:00
parent ca8c9d4d1c
commit 2cf4265732
2 changed files with 17 additions and 12 deletions

View File

@@ -3,9 +3,8 @@ macro_rules! crypt {
($op:ident, $options:expr, $text:expr) => {{
macro_rules! crypt_with {
($algo:ident) => {{
let encoding = $options.get("encoding").unwrap_or_default();
let key = &$options.get::<UserDataRef<AesKey>>("key")?.0;
match encoding {
match $options.get("encoding").unwrap_or_default() {
1 => $algo::<Base64Encoding>::$op($text, &key),
2 => $algo::<Base64rEncoding>::$op($text, &key),
_ => $algo::<NewBase64rEncoding>::$op($text, &key),