cas-typescript-sdk 1.0.47 → 1.0.48
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/index.d.ts +141 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.linux-x64-musl.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/lib/asymmetric/index.d.ts +3 -0
- package/lib/asymmetric/index.js +5 -0
- package/lib/digital-signature/index.d.ts +6 -0
- package/lib/digital-signature/index.js +11 -0
- package/lib/hashers/index.d.ts +5 -0
- package/lib/hashers/index.js +11 -0
- package/lib/hybrid/index.d.ts +2 -0
- package/lib/hybrid/index.js +5 -0
- package/lib/index.d.ts +10 -0
- package/lib/key_exchange/index.d.ts +3 -0
- package/lib/key_exchange/index.js +5 -0
- package/lib/message/index.d.ts +2 -0
- package/lib/message/index.js +5 -0
- package/lib/password-hashers/index.d.ts +6 -0
- package/lib/password-hashers/index.js +13 -0
- package/lib/signature/index.d.ts +2 -0
- package/lib/signature/index.js +5 -0
- package/lib/sponges/index.d.ts +2 -0
- package/lib/sponges/index.js +5 -0
- package/lib/symmetric/index.d.ts +2 -0
- package/lib/symmetric/index.js +5 -0
- package/package.json +8 -1
- package/.github/workflows/main-pr-linux.yml +0 -28
- package/.github/workflows/main-pr-windows.yml +0 -28
- package/.github/workflows/main-publish.yml +0 -109
- package/Cargo.toml +0 -19
- package/build.rs +0 -5
- package/docs/EXAMPLES.md +0 -138
- package/src/asymmetric/cas_ed25519.rs +0 -35
- package/src/asymmetric/cas_rsa.rs +0 -32
- package/src/digital_signature/sha_256_rsa.rs +0 -40
- package/src/digital_signature/sha_512_rsa.rs +0 -40
- package/src/digital_signature/types.rs +0 -34
- package/src/hashers/blake2.rs +0 -60
- package/src/hashers/sha.rs +0 -68
- package/src/hybrid/hpke.rs +0 -63
- package/src/hybrid/types.rs +0 -15
- package/src/key_exchange/types.rs +0 -17
- package/src/key_exchange/x25519.rs +0 -25
- package/src/lib.rs +0 -47
- package/src/message/hmac.rs +0 -21
- package/src/password_hashers/argon2.rs +0 -37
- package/src/password_hashers/bcrypt.rs +0 -37
- package/src/password_hashers/scrypt.rs +0 -36
- package/src/sponges/ascon_aead.rs +0 -66
- package/src/symmetric/aes.rs +0 -71
- package/src-ts/asymmetric/RSAWrapper.ts +0 -59
- package/src-ts/digital-signature/digital-siganture-sha-512.ts +0 -40
- package/src-ts/digital-signature/digital-signature-base.ts +0 -6
- package/src-ts/digital-signature/digital-signature-factory.ts +0 -25
- package/src-ts/digital-signature/digital-signaturte-sha-256.ts +0 -41
- package/src-ts/hashers/blake2-wrapper.ts +0 -43
- package/src-ts/hashers/hasher-base.ts +0 -6
- package/src-ts/hashers/hasher-factory.ts +0 -19
- package/src-ts/hashers/hasher-type.ts +0 -4
- package/src-ts/hashers/sha-wrapper.ts +0 -60
- package/src-ts/hybrid/hpke.ts +0 -44
- package/src-ts/key_exchange/x25519.ts +0 -23
- package/src-ts/message/hmac.ts +0 -26
- package/src-ts/password-hashers/argon2-wrapper.ts +0 -31
- package/src-ts/password-hashers/bcrypt-wrapper.ts +0 -35
- package/src-ts/password-hashers/password-hasher-base.ts +0 -4
- package/src-ts/password-hashers/password-hasher-factory.ts +0 -25
- package/src-ts/password-hashers/password-hasher-type.ts +0 -5
- package/src-ts/password-hashers/scrypt-wrapper.ts +0 -32
- package/src-ts/signature/ed25519-wrapper.ts +0 -36
- package/src-ts/sponges/ascon-wrapper.ts +0 -72
- package/src-ts/symmetric/aes-wrapper.ts +0 -101
- package/test-ts/asymmetric.test.spec.ts +0 -15
- package/test-ts/digital-signature.test.spec.ts +0 -70
- package/test-ts/hasher.test.spec.ts +0 -139
- package/test-ts/helpers/array.ts +0 -10
- package/test-ts/hmac.test.spec.ts +0 -16
- package/test-ts/hybrid.test.spec.ts +0 -23
- package/test-ts/insecure-channel.test.spec.ts +0 -55
- package/test-ts/key-exchange.test.spec.ts +0 -23
- package/test-ts/password-hasher.test.spec.ts +0 -104
- package/test-ts/sponges.test.spec.ts +0 -28
- package/test-ts/symmetric.test.spec.ts +0 -82
- package/tsconfig.json +0 -22
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { assert } from "chai";
|
|
2
|
-
import { AESWrapper } from "../src-ts/symmetric/aes-wrapper";
|
|
3
|
-
import { X25519Wrapper } from '../src-ts/key_exchange/x25519';
|
|
4
|
-
import { areEqual } from "./helpers/array";
|
|
5
|
-
|
|
6
|
-
describe("Symmetric Tests", () => {
|
|
7
|
-
it("aes 128 encrypt and decrypt equals", () => {
|
|
8
|
-
const aesWrapper: AESWrapper = new AESWrapper();
|
|
9
|
-
const aesKey = aesWrapper.aes128Key();
|
|
10
|
-
const aesNonce = aesWrapper.generateAESNonce();
|
|
11
|
-
const tohashed: string = "This is my array to encrypt";
|
|
12
|
-
const encoder = new TextEncoder();
|
|
13
|
-
const tohashBytes: Array<number> = Array.from(encoder.encode(tohashed));
|
|
14
|
-
const ciphertext = aesWrapper.aes128Encrypt(aesKey, aesNonce, tohashBytes);
|
|
15
|
-
const plaintxt = aesWrapper.aes128Decrypt(aesKey, aesNonce, ciphertext);
|
|
16
|
-
var result = areEqual(plaintxt, tohashBytes);
|
|
17
|
-
assert.isTrue(result);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("aes 256 encrypt and decrypt equals", () => {
|
|
21
|
-
const aesWrapper: AESWrapper = new AESWrapper();
|
|
22
|
-
const aesKey = aesWrapper.aes256Key();
|
|
23
|
-
const aesNonce = aesWrapper.generateAESNonce();
|
|
24
|
-
const tohashed: string = "This is my array to encrypt";
|
|
25
|
-
const encoder = new TextEncoder();
|
|
26
|
-
const tohashBytes: Array<number> = Array.from(encoder.encode(tohashed));
|
|
27
|
-
const ciphertext = aesWrapper.aes256Encrypt(aesKey, aesNonce, tohashBytes);
|
|
28
|
-
const plaintxt = aesWrapper.aes256Decrypt(aesKey, aesNonce, ciphertext);
|
|
29
|
-
var result = areEqual(plaintxt, tohashBytes);
|
|
30
|
-
assert.isTrue(result);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("ase 256 X25519 Diffie-Hellman encrypt and decrypt", () => {
|
|
34
|
-
const x25519 = new X25519Wrapper();
|
|
35
|
-
const alice= x25519.generateSecretAndPublicKey();
|
|
36
|
-
const bob = x25519.generateSecretAndPublicKey();
|
|
37
|
-
|
|
38
|
-
const aliceSharedSecret = x25519.generateSharedSecret(alice.secretKey, bob.publicKey);
|
|
39
|
-
const bobSharedSecret = x25519.generateSharedSecret(bob.secretKey, alice.publicKey);
|
|
40
|
-
|
|
41
|
-
const aesWrapper: AESWrapper = new AESWrapper();
|
|
42
|
-
const aliceAesKey = aesWrapper.aes256KeyNonceX25519DiffieHellman(aliceSharedSecret);
|
|
43
|
-
const bobAesKey = aesWrapper.aes256KeyNonceX25519DiffieHellman(bobSharedSecret);
|
|
44
|
-
|
|
45
|
-
const nonce = aesWrapper.generateAESNonce();
|
|
46
|
-
|
|
47
|
-
const tohashed: string = "This is my array to encrypt";
|
|
48
|
-
const encoder = new TextEncoder();
|
|
49
|
-
const tohashBytes: Array<number> = Array.from(encoder.encode(tohashed));
|
|
50
|
-
|
|
51
|
-
const aliceCiphertext = aesWrapper.aes256Encrypt(aliceAesKey, nonce, tohashBytes);
|
|
52
|
-
const bobPlaintext = aesWrapper.aes256Decrypt(bobAesKey, nonce, aliceCiphertext);
|
|
53
|
-
|
|
54
|
-
var result = areEqual(bobPlaintext, tohashBytes);
|
|
55
|
-
assert.isTrue(result);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("ase 128 X25519 Diffie-Hellman encrypt and decrypt", () => {
|
|
59
|
-
const x25519 = new X25519Wrapper();
|
|
60
|
-
const alice= x25519.generateSecretAndPublicKey();
|
|
61
|
-
const bob = x25519.generateSecretAndPublicKey();
|
|
62
|
-
|
|
63
|
-
const aliceSharedSecret = x25519.generateSharedSecret(alice.secretKey, bob.publicKey);
|
|
64
|
-
const bobSharedSecret = x25519.generateSharedSecret(bob.secretKey, alice.publicKey);
|
|
65
|
-
|
|
66
|
-
const aesWrapper: AESWrapper = new AESWrapper();
|
|
67
|
-
const aliceAesKey = aesWrapper.aes128KeyNonceX25519DiffieHellman(aliceSharedSecret);
|
|
68
|
-
const bobAesKey = aesWrapper.aes128KeyNonceX25519DiffieHellman(bobSharedSecret);
|
|
69
|
-
|
|
70
|
-
const tohashed: string = "This is my array to encrypt";
|
|
71
|
-
const encoder = new TextEncoder();
|
|
72
|
-
const tohashBytes: Array<number> = Array.from(encoder.encode(tohashed));
|
|
73
|
-
|
|
74
|
-
const nonce = aesWrapper.generateAESNonce();
|
|
75
|
-
|
|
76
|
-
const aliceCiphertext = aesWrapper.aes128Encrypt(aliceAesKey, nonce, tohashBytes);
|
|
77
|
-
const bobPlaintext = aesWrapper.aes128Decrypt(bobAesKey, nonce, aliceCiphertext);
|
|
78
|
-
|
|
79
|
-
var result = areEqual(bobPlaintext, tohashBytes);
|
|
80
|
-
assert.isTrue(result);
|
|
81
|
-
});
|
|
82
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"display": "Node 18",
|
|
4
|
-
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"lib": ["es2022"],
|
|
7
|
-
"module": "commonjs",
|
|
8
|
-
"target": "es2022",
|
|
9
|
-
|
|
10
|
-
"strict": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
|
|
15
|
-
"outDir": "lib",
|
|
16
|
-
"declaration": true
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
"include": [
|
|
20
|
-
"src-ts/**/*"
|
|
21
|
-
]
|
|
22
|
-
}
|