Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions crates/crypto-layer-node/src/keyhandle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ pub fn export_delete(mut cx: FunctionContext) -> JsResult<JsPromise> {
pub fn export_encrypt_data(mut cx: FunctionContext) -> JsResult<JsPromise> {
let handle_arc = (**cx.this::<JsKeyHandle>()?).clone();
let data_js = cx.argument::<JsUint8Array>(0)?;
let data = vec_from_uint_8_array(&mut cx, data_js);
let data = vec_from_uint_8_array(&mut cx, data_js);
let iv_js = cx.argument::<JsUint8Array>(1)?;
let iv = vec_from_uint_8_array(&mut cx, iv_js);

spawn_promise(&mut cx, move |channel, deferred| {
let handle = arc_or_poisoned_error_deferred!(&channel, deferred, handle_arc.read());

let result = handle.encrypt_data(&data);
let result = handle.encrypt_data(&data, &iv);

deferred.settle_with(&channel, |mut cx| {
let (encrypted_data, iv) = unwrap_or_throw!(cx, result);
Expand Down
4 changes: 3 additions & 1 deletion crates/crypto-layer-node/src/keypairhandle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ pub fn export_encrypt_data(mut cx: FunctionContext) -> JsResult<JsPromise> {
let handle_arc = (**cx.this::<JsKeyPairHandle>()?).clone();
let data_js = cx.argument::<JsUint8Array>(0)?;
let data = vec_from_uint_8_array(&mut cx, data_js);
let iv_js = cx.argument::<JsUint8Array>(1)?;
let iv = vec_from_uint_8_array(&mut cx, iv_js);

spawn_promise(&mut cx, move |channel, deferred| {
let handle = arc_or_poisoned_error_deferred!(&channel, deferred, handle_arc.read());

let encrypted_data = handle.encrypt_data(&data);
let encrypted_data = handle.encrypt_data(&data, &iv);

deferred.settle_with(&channel, |mut cx| {
let encrypted_data = unwrap_or_throw!(cx, encrypted_data);
Expand Down
72 changes: 10 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/rs-crypto-node",
"version": "0.9.0",
"version": "0.10.0",
"description": "crypto layer ts interface for nodejs",
"homepage": "https://enmeshed.eu",
"repository": "github:nmshd/crypto-layer-node",
Expand Down Expand Up @@ -62,12 +62,12 @@
},
"dependencies": {
"@neon-rs/load": "^0.1.73",
"@nmshd/rs-crypto-types": "^0.6.1"
"@nmshd/rs-crypto-types": "^0.7.0"
},
"optionalDependencies": {
"@nmshd/rs-crypto-node-darwin-arm64": "0.9.0",
"@nmshd/rs-crypto-node-darwin-x64": "0.9.0",
"@nmshd/rs-crypto-node-linux-x64-gnu": "0.9.0",
"@nmshd/rs-crypto-node-win32-x64-msvc": "0.9.0"
"@nmshd/rs-crypto-node-darwin-arm64": "0.10.0",
"@nmshd/rs-crypto-node-darwin-x64": "0.10.0",
"@nmshd/rs-crypto-node-linux-x64-gnu": "0.10.0",
"@nmshd/rs-crypto-node-win32-x64-msvc": "0.10.0"
}
}
}
2 changes: 1 addition & 1 deletion platforms/darwin-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nmshd/rs-crypto-node-darwin-arm64",
"description": "Prebuilt binary package for `rs-crypto-node` on `darwin-arm64`.",
"repository": "github:nmshd/crypto-layer-node",
"version": "0.9.0",
"version": "0.10.0",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion platforms/darwin-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nmshd/rs-crypto-node-darwin-x64",
"description": "Prebuilt binary package for `rs-layer-ts` on `darwin-x64`.",
"repository": "github:nmshd/crypto-layer-node",
"version": "0.9.0",
"version": "0.10.0",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion platforms/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nmshd/rs-crypto-node-linux-arm64-gnu",
"description": "Prebuilt binary package for `rs-layer-ts` on `linux-arm64-gnu`.",
"repository": "github:nmshd/crypto-layer-node",
"version": "0.9.0",
"version": "0.10.0",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion platforms/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nmshd/rs-crypto-node-linux-x64-gnu",
"description": "Prebuilt binary package for `rs-layer-ts` on `linux-x64-gnu`.",
"repository": "github:nmshd/crypto-layer-node",
"version": "0.9.0",
"version": "0.10.0",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nmshd/rs-crypto-node-win32-x64-msvc",
"description": "Prebuilt binary package for `rs-layer-ts` on `win32-x64-msvc`.",
"repository": "github:nmshd/crypto-layer-node",
"version": "0.9.0",
"version": "0.10.0",
"os": [
"win32"
],
Expand Down
Loading