cas-typescript-sdk 1.0.21 → 1.0.23
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 +1 -0
- package/README.md +7 -5
- package/index.d.ts +6 -0
- package/index.node +0 -0
- package/lib/asymmetric/RSAWrapper.d.ts +31 -1
- package/lib/asymmetric/RSAWrapper.js +33 -3
- package/lib/digital-signature/digital-siganture-sha-512.d.ts +25 -0
- package/lib/digital-signature/digital-siganture-sha-512.js +25 -0
- package/lib/digital-signature/digital-signature-factory.d.ts +5 -0
- package/lib/digital-signature/digital-signature-factory.js +5 -0
- package/lib/digital-signature/digital-signaturte-sha-256.d.ts +25 -0
- package/lib/digital-signature/digital-signaturte-sha-256.js +25 -0
- package/lib/hashers/hasher-factory.d.ts +5 -0
- package/lib/hashers/hasher-factory.js +5 -0
- package/lib/hashers/sha-wrapper.d.ts +22 -0
- package/lib/hashers/sha-wrapper.js +22 -0
- package/lib/hybrid/hybrid-encryption-wrapper.d.ts +12 -0
- package/lib/hybrid/hybrid-encryption-wrapper.js +12 -0
- package/lib/hybrid/types/aes-rsa-hybrid-initializer.d.ts +5 -0
- package/lib/hybrid/types/aes-rsa-hybrid-initializer.js +5 -0
- package/lib/key_exchange/x25519.d.ts +13 -1
- package/lib/key_exchange/x25519.js +12 -0
- package/lib/password-hashers/argon2-wrapper.d.ts +24 -0
- package/lib/password-hashers/argon2-wrapper.js +37 -0
- package/lib/password-hashers/bcrypt-wrapper.d.ts +24 -0
- package/lib/password-hashers/bcrypt-wrapper.js +34 -0
- package/lib/password-hashers/password-hasher-base.d.ts +2 -0
- package/lib/password-hashers/password-hasher-factory.d.ts +5 -0
- package/lib/password-hashers/password-hasher-factory.js +5 -0
- package/lib/password-hashers/scrypt-wrapper.d.ts +24 -0
- package/lib/password-hashers/scrypt-wrapper.js +34 -0
- package/lib/sponges/ascon-wrapper.d.ts +22 -0
- package/lib/sponges/ascon-wrapper.js +22 -0
- package/lib/symmetric/aes-wrapper.d.ts +42 -12
- package/lib/symmetric/aes-wrapper.js +42 -12
- package/package.json +1 -1
- package/src/password_hashers/argon2.rs +40 -1
- package/src/password_hashers/bcrypt.rs +39 -0
- package/src/password_hashers/scrypt.rs +39 -0
- package/src-ts/asymmetric/RSAWrapper.ts +36 -3
- package/src-ts/digital-signature/digital-siganture-sha-512.ts +26 -1
- package/src-ts/digital-signature/digital-signature-factory.ts +6 -0
- package/src-ts/digital-signature/digital-signaturte-sha-256.ts +25 -0
- package/src-ts/hashers/hasher-factory.ts +5 -0
- package/src-ts/hashers/sha-wrapper.ts +22 -0
- package/src-ts/hybrid/hybrid-encryption-wrapper.ts +12 -0
- package/src-ts/hybrid/types/aes-rsa-hybrid-initializer.ts +5 -0
- package/src-ts/key_exchange/x25519.ts +13 -1
- package/src-ts/password-hashers/argon2-wrapper.ts +46 -4
- package/src-ts/password-hashers/bcrypt-wrapper.ts +40 -1
- package/src-ts/password-hashers/password-hasher-base.ts +2 -0
- package/src-ts/password-hashers/password-hasher-factory.ts +5 -0
- package/src-ts/password-hashers/scrypt-wrapper.ts +54 -15
- package/src-ts/sponges/ascon-wrapper.ts +22 -0
- package/src-ts/symmetric/aes-wrapper.ts +43 -12
- package/test-ts/password-hasher.test.spec.ts +53 -3
- package/lib/helpers/nonce-generator.d.ts +0 -3
- package/lib/helpers/nonce-generator.js +0 -34
- package/src-ts/helpers/nonce-generator.ts +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert, expect } from "chai";
|
|
2
|
-
import { BCryptWrapper } from "../src-ts/password-hashers/index";
|
|
2
|
+
import { Argon2Wrapper, BCryptWrapper } from "../src-ts/password-hashers/index";
|
|
3
3
|
import { ScryptWrapper } from "../src-ts/password-hashers/index";
|
|
4
4
|
import {
|
|
5
5
|
PasswordHasherFactory,
|
|
@@ -7,6 +7,22 @@ import {
|
|
|
7
7
|
} from "../src-ts/password-hashers";
|
|
8
8
|
|
|
9
9
|
describe("Bcrypt Tests", () => {
|
|
10
|
+
|
|
11
|
+
it("hash threadpool", () => {
|
|
12
|
+
const hasher: BCryptWrapper = new BCryptWrapper();
|
|
13
|
+
const password: string = "ThisOneBadPassword!@";
|
|
14
|
+
const hashedPassword: string = hasher.hashPasswordThreadPool(password);
|
|
15
|
+
assert.notEqual(hashedPassword, password);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("verify threadpool", () => {
|
|
19
|
+
const hasher: BCryptWrapper = new BCryptWrapper();
|
|
20
|
+
const password: string = "NotThisPassword!@";
|
|
21
|
+
const hashedPassword: string = hasher.hashPassword(password);
|
|
22
|
+
const isValid: boolean = hasher.verifyThreadPool(hashedPassword, password);
|
|
23
|
+
expect(isValid).to.equal(true);
|
|
24
|
+
});
|
|
25
|
+
|
|
10
26
|
it("hash", () => {
|
|
11
27
|
const hasher: BCryptWrapper = new BCryptWrapper();
|
|
12
28
|
const password: string = "ThisOneBadPassword!@";
|
|
@@ -35,6 +51,25 @@ describe("Bcrypt Tests", () => {
|
|
|
35
51
|
});
|
|
36
52
|
|
|
37
53
|
describe("Scrypt Tests", () => {
|
|
54
|
+
it("hash with threadpool", () => {
|
|
55
|
+
const hasher: ScryptWrapper = PasswordHasherFactory.getHasher(
|
|
56
|
+
PasswordHasherType.Scrypt,
|
|
57
|
+
);
|
|
58
|
+
const password: string = "ScryptRocks";
|
|
59
|
+
const hashed: string = hasher.hashPasswordThreadPool(password);
|
|
60
|
+
assert.notEqual(password, hashed);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("verify pass with threadpool", () => {
|
|
64
|
+
const hasher: ScryptWrapper = PasswordHasherFactory.getHasher(
|
|
65
|
+
PasswordHasherType.Scrypt,
|
|
66
|
+
);
|
|
67
|
+
const password: string = "ScryptRocks1231231";
|
|
68
|
+
const hashed: string = hasher.hashPasswordThreadPool(password);
|
|
69
|
+
const verified: boolean = hasher.verifyThreadPool(hashed, password);
|
|
70
|
+
assert.isTrue(verified);
|
|
71
|
+
});
|
|
72
|
+
|
|
38
73
|
it("hash with factory", () => {
|
|
39
74
|
const hasher: ScryptWrapper = PasswordHasherFactory.getHasher(
|
|
40
75
|
PasswordHasherType.Scrypt,
|
|
@@ -69,8 +104,23 @@ describe("Scrypt Tests", () => {
|
|
|
69
104
|
});
|
|
70
105
|
|
|
71
106
|
describe("Argon2 Tests", () => {
|
|
107
|
+
it("hash with threadpool", () => {
|
|
108
|
+
const argon2: Argon2Wrapper = PasswordHasherFactory.getHasher(PasswordHasherType.Argon2);
|
|
109
|
+
const password = "Argon2OverBCrypt";
|
|
110
|
+
const hashed = argon2.hashPasswordThreadPool(password);
|
|
111
|
+
assert.notEqual(password, hashed);
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it("verify with threadpool", () => {
|
|
115
|
+
const argon2: Argon2Wrapper = PasswordHasherFactory.getHasher(PasswordHasherType.Argon2);
|
|
116
|
+
const password = "Argon2OverBCrypt";
|
|
117
|
+
const hashed = argon2.hashPasswordThreadPool(password);
|
|
118
|
+
const result = argon2.verifyThreadPool(hashed, password);
|
|
119
|
+
assert.equal(result, true);
|
|
120
|
+
});
|
|
121
|
+
|
|
72
122
|
it("hash with factory", () => {
|
|
73
|
-
const hasher:
|
|
123
|
+
const hasher: Argon2Wrapper = PasswordHasherFactory.getHasher(
|
|
74
124
|
PasswordHasherType.Argon2,
|
|
75
125
|
);
|
|
76
126
|
const password: string = "ScryptRocks";
|
|
@@ -79,7 +129,7 @@ describe("Argon2 Tests", () => {
|
|
|
79
129
|
});
|
|
80
130
|
|
|
81
131
|
it("verify pass with factory", () => {
|
|
82
|
-
const hasher:
|
|
132
|
+
const hasher: Argon2Wrapper = PasswordHasherFactory.getHasher(
|
|
83
133
|
PasswordHasherType.Argon2,
|
|
84
134
|
);
|
|
85
135
|
const password: string = "ScryptRocks1231231";
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.NonceGenerator = void 0;
|
|
27
|
-
const crypto = __importStar(require("crypto"));
|
|
28
|
-
class NonceGenerator {
|
|
29
|
-
generateNonce() {
|
|
30
|
-
const nonceBytes = crypto.randomBytes(12);
|
|
31
|
-
return nonceBytes.toString('hex').substring(0, 12);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.NonceGenerator = NonceGenerator;
|