Skip to content

Commit

Permalink
Merge pull request #35 from Cryptographic-API-Services/pre-release
Browse files Browse the repository at this point in the history
Pre release
  • Loading branch information
WingZer0o authored Jun 2, 2024
2 parents fe3f1ac + 8bcd5ce commit 230ac43
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ crate-type = ["cdylib"]
[dependencies]
napi = "2"
napi-derive = "2"
rand = "0.8.5"
rand_chacha = "0.3.1"
rayon = "1.10.0"
csbindgen = "1.9.1"
cas-lib = "0.1.3"
cas-lib = "0.1.6"

[build-dependencies]
napi-build = "1"
Binary file modified index.node
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{
"name": "cas-typescript-sdk",
"version": "1.0.24",
"version": "1.0.25",
"description": "",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/asymmetric/cas_rsa.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cas_lib::asymmetric::{cas_asymmetric_encryption::{CASRSAEncryption, RSAKeyPairResult}, cas_rsa::CASRSA};
use cas_lib::asymmetric::{cas_asymmetric_encryption::CASRSAEncryption, cas_rsa::CASRSA, types::RSAKeyPairResult};
use napi_derive::napi;

#[napi(constructor)]
Expand All @@ -18,7 +18,7 @@ impl From<RSAKeyPairResult> for CASRSAKeyPairResult {

#[napi]
pub fn generate_rsa_keys(key_size: u32) -> CASRSAKeyPairResult {
return CASRSA::generate_rsa_keys(key_size).into();
return CASRSA::generate_rsa_keys(key_size as usize).into();
}

#[napi]
Expand Down
8 changes: 1 addition & 7 deletions src/symmetric/aes.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
use cas_lib::symmetric::{aes::{CASAES128, CASAES256}, cas_symmetric_encryption::CASAESEncryption};
use napi_derive::napi;
use rand::{RngCore, SeedableRng};
use rand_chacha::ChaCha20Rng;

use super::types::CASAesKeyFromX25519SharedSecret;

#[napi]
pub fn aes_nonce() -> Vec<u8> {
let mut rng = ChaCha20Rng::from_entropy();
let mut random_bytes = Vec::with_capacity(12);
random_bytes.resize(12, 0);
rng.fill_bytes(&mut random_bytes);
random_bytes
return <CASAES256 as CASAESEncryption>::generate_nonce();
}

#[napi]
Expand Down

0 comments on commit 230ac43

Please sign in to comment.