summaryrefslogtreecommitdiff
path: root/ext/crypto/encrypt.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-09-13 17:54:19 +0200
committerGitHub <noreply@github.com>2023-09-13 17:54:19 +0200
commit109a42ab0728d4e3e2429fd090eb2f432a6fc9f5 (patch)
tree5a777a0eb166b7eeda32e635e5651751670a6c08 /ext/crypto/encrypt.rs
parent8f0270c0cf7ed28943686325b8d329bcd2f497b2 (diff)
refactor: rewrite ext/crypto to op2 (#20477)
Diffstat (limited to 'ext/crypto/encrypt.rs')
-rw-r--r--ext/crypto/encrypt.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/crypto/encrypt.rs b/ext/crypto/encrypt.rs
index b4a38edde..b263873e4 100644
--- a/ext/crypto/encrypt.rs
+++ b/ext/crypto/encrypt.rs
@@ -18,7 +18,7 @@ use ctr::Ctr32BE;
use ctr::Ctr64BE;
use deno_core::error::type_error;
use deno_core::error::AnyError;
-use deno_core::op;
+use deno_core::op2;
use deno_core::unsync::spawn_blocking;
use deno_core::JsBuffer;
use deno_core::ToJsBuffer;
@@ -76,10 +76,11 @@ pub enum EncryptAlgorithm {
},
}
-#[op]
+#[op2(async)]
+#[serde]
pub async fn op_crypto_encrypt(
- opts: EncryptOptions,
- data: JsBuffer,
+ #[serde] opts: EncryptOptions,
+ #[buffer] data: JsBuffer,
) -> Result<ToJsBuffer, AnyError> {
let key = opts.key;
let fun = move || match opts.algorithm {