cas-typescript-sdk 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +3 -20
- package/README.md +1 -1
- package/index.d.ts +22 -21
- package/index.node +0 -0
- package/lib/asymmetric/RSAWrapper.d.ts +3 -3
- package/lib/asymmetric/RSAWrapper.js +1 -1
- package/lib/asymmetric/index.d.ts +2 -2
- package/lib/asymmetric/index.js +1 -3
- package/lib/digital-signature/digital-siganture-sha-512.d.ts +5 -5
- package/lib/digital-signature/digital-siganture-sha-512.js +2 -2
- package/lib/digital-signature/digital-signature-base.d.ts +3 -3
- package/lib/digital-signature/digital-signaturte-sha-256.d.ts +3 -3
- package/lib/digital-signature/index.d.ts +2 -1
- package/lib/hybrid/types/aes-rsa-hybrid-initializer.d.ts +2 -2
- package/lib/index.d.ts +8 -9
- package/lib/index.js +22 -29
- package/lib/key_exchange/index.d.ts +2 -1
- package/lib/key_exchange/x25519.d.ts +2 -2
- package/lib/symmetric/aes-wrapper.d.ts +3 -3
- package/lib/symmetric/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/asymmetric/cas_rsa.rs +13 -59
- package/src/digital_signature/sha_256_ed25519.rs +6 -42
- package/src/digital_signature/sha_256_rsa.rs +7 -63
- package/src/digital_signature/sha_512_ed25519.rs +8 -48
- package/src/digital_signature/sha_512_rsa.rs +9 -62
- package/src/digital_signature/types.rs +34 -0
- package/src/hashers/sha.rs +1 -35
- package/src/key_exchange/types.rs +17 -0
- package/src/key_exchange/x25519.rs +4 -36
- package/src/lib.rs +3 -8
- package/src/password_hashers/argon2.rs +4 -44
- package/src/password_hashers/bcrypt.rs +4 -31
- package/src/password_hashers/scrypt.rs +3 -42
- package/src/sponges/ascon_aead.rs +9 -39
- package/src/symmetric/aes.rs +13 -95
- package/src/symmetric/types.rs +17 -0
- package/src-ts/asymmetric/RSAWrapper.ts +3 -3
- package/src-ts/asymmetric/index.ts +2 -2
- package/src-ts/digital-signature/digital-siganture-sha-512.ts +5 -5
- package/src-ts/digital-signature/digital-signature-base.ts +3 -3
- package/src-ts/digital-signature/digital-signaturte-sha-256.ts +3 -3
- package/src-ts/digital-signature/index.ts +4 -1
- package/src-ts/hybrid/types/aes-rsa-hybrid-initializer.ts +2 -2
- package/src-ts/index.ts +8 -46
- package/src-ts/key_exchange/index.ts +2 -1
- package/src-ts/key_exchange/x25519.ts +2 -2
- package/src-ts/symmetric/aes-wrapper.ts +3 -3
- package/src-ts/symmetric/index.ts +2 -1
- package/test-ts/asymmetric.test.spec.ts +3 -3
- package/test-ts/digital-signature.test.spec.ts +5 -5
- package/test-ts/insecure-channel.test.spec.ts +5 -5
- package/src/asymmetric/cas_asymmetric_encryption.rs +0 -15
- package/src/digital_signature/cas_digital_signature_rsa.rs +0 -27
- package/src/hashers/blake2.rs +0 -37
- package/src/hashers/cas_hasher.rs +0 -8
- package/src/key_exchange/cas_key_exchange.rs +0 -6
- package/src/password_hashers/cas_password_hasher.rs +0 -4
- package/src/sponges/cas_ascon_aead.rs +0 -6
- package/src/symmetric/cas_symmetric_encryption.rs +0 -14
package/src/hashers/blake2.rs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
use super::cas_hasher::CASHasher;
|
|
2
|
-
use blake2::{Blake2b512, Blake2s256, Digest};
|
|
3
|
-
|
|
4
|
-
pub struct CASBlake2;
|
|
5
|
-
|
|
6
|
-
impl CASHasher for CASBlake2 {
|
|
7
|
-
fn hash_512(data_to_hash: Vec<u8>) -> Vec<u8> {
|
|
8
|
-
let mut hasher = Blake2b512::new();
|
|
9
|
-
hasher.update(data_to_hash);
|
|
10
|
-
let result = hasher.finalize();
|
|
11
|
-
return result.to_vec();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
fn verify_512(hash_to_verify: Vec<u8>, data_to_verify: Vec<u8>) -> bool {
|
|
15
|
-
let mut hasher = Blake2b512::new();
|
|
16
|
-
hasher.update(data_to_verify);
|
|
17
|
-
let result = hasher.finalize();
|
|
18
|
-
return hash_to_verify.eq(&result.to_vec());
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
fn hash_256(data_to_hash: Vec<u8>) -> Vec<u8> {
|
|
22
|
-
let mut hasher = Blake2s256::new();
|
|
23
|
-
hasher.update(data_to_hash);
|
|
24
|
-
let result = hasher.finalize();
|
|
25
|
-
return result.to_vec();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
fn verify_256(hash_to_verify: Vec<u8>, data_to_verify: Vec<u8>) -> bool {
|
|
29
|
-
let mut hasher = Blake2s256::new();
|
|
30
|
-
hasher.update(data_to_verify);
|
|
31
|
-
let result = hasher.finalize();
|
|
32
|
-
return hash_to_verify.eq(&result.to_vec());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
#[test]
|
|
37
|
-
fn hash_512_test() {}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
use napi::bindgen_prelude::Array;
|
|
2
|
-
|
|
3
|
-
pub trait CASHasher {
|
|
4
|
-
fn hash_512(data_to_hash: Vec<u8>) -> Vec<u8>;
|
|
5
|
-
fn verify_512(hash_to_verify: Vec<u8>, data_to_verify: Vec<u8>) -> bool;
|
|
6
|
-
fn hash_256(data_to_hash: Vec<u8>) -> Vec<u8>;
|
|
7
|
-
fn verify_256(hash_to_verify: Vec<u8>, data_to_verify: Vec<u8>) -> bool;
|
|
8
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
use napi_derive::napi;
|
|
2
|
-
|
|
3
|
-
#[napi(constructor)]
|
|
4
|
-
pub struct AesKeyFromX25519SharedSecret {
|
|
5
|
-
pub aes_key: Vec<u8>,
|
|
6
|
-
pub aes_nonce: Vec<u8>,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
pub trait CASAESEncryption {
|
|
10
|
-
fn generate_key() -> Vec<u8>;
|
|
11
|
-
fn encrypt_plaintext(aes_key: Vec<u8>, nonce: Vec<u8>, plaintext: Vec<u8>) -> Vec<u8>;
|
|
12
|
-
fn decrypt_ciphertext(aes_key: Vec<u8>, nonce: Vec<u8>, ciphertext: Vec<u8>) -> Vec<u8>;
|
|
13
|
-
fn key_from_x25519_shared_secret(shared_secret: Vec<u8>) -> AesKeyFromX25519SharedSecret;
|
|
14
|
-
}
|