@digitaldefiance/node-ecies-lib 1.1.20 → 1.1.22
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/README.md +8 -0
- package/package.json +14 -35
- package/src/constants.ts +182 -0
- package/src/enumerations/index.ts +1 -0
- package/src/enumerations/pbkdf2-profile.ts +8 -0
- package/src/i18n/ecies-i18n-factory.ts +435 -0
- package/{dist/i18n/index.d.ts → src/i18n/index.ts} +0 -1
- package/{dist/index.d.ts → src/index.ts} +0 -1
- package/src/interfaces/authenticated-cipher.ts +9 -0
- package/src/interfaces/authenticated-decipher.ts +8 -0
- package/src/interfaces/checksum-config.ts +4 -0
- package/src/interfaces/checksum-consts.ts +13 -0
- package/src/interfaces/constants.ts +43 -0
- package/src/interfaces/ecies-consts.ts +99 -0
- package/src/interfaces/encryption-consts.ts +10 -0
- package/{dist/interfaces/index.d.ts → src/interfaces/index.ts} +0 -1
- package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.ts +7 -0
- package/src/interfaces/keyring-consts.ts +5 -0
- package/src/interfaces/member-operational.ts +52 -0
- package/{dist/interfaces/member-with-mnemonic.d.ts → src/interfaces/member-with-mnemonic.ts} +3 -3
- package/{dist/interfaces/multi-encrypted-message.d.ts → src/interfaces/multi-encrypted-message.ts} +5 -5
- package/src/interfaces/multi-encrypted-parsed-header.ts +24 -0
- package/{dist/interfaces/pbkdf-profiles.d.ts → src/interfaces/pbkdf-profiles.ts} +2 -2
- package/src/interfaces/pbkdf2-result.ts +5 -0
- package/src/interfaces/signing-key-private-key-info.ts +12 -0
- package/{dist/interfaces/simple-keypair-buffer.d.ts → src/interfaces/simple-keypair-buffer.ts} +3 -3
- package/{dist/interfaces/simple-keypair.d.ts → src/interfaces/simple-keypair.ts} +3 -3
- package/src/interfaces/simple-public-key-only-buffer.ts +3 -0
- package/src/interfaces/simple-public-key-only.ts +3 -0
- package/src/interfaces/single-encrypted-parsed-header.ts +35 -0
- package/{dist/interfaces/wallet-seed.d.ts → src/interfaces/wallet-seed.ts} +3 -3
- package/src/interfaces/wrapped-key-consts.ts +6 -0
- package/src/member.ts +463 -0
- package/src/services/aes-gcm.ts +160 -0
- package/src/services/ecies/crypto-core.ts +213 -0
- package/src/services/ecies/file.ts +174 -0
- package/{dist/services/ecies/index.d.ts → src/services/ecies/index.ts} +0 -1
- package/src/services/ecies/multi-recipient.ts +583 -0
- package/src/services/ecies/service.ts +351 -0
- package/src/services/ecies/signature.ts +91 -0
- package/src/services/ecies/single-recipient.ts +676 -0
- package/src/services/ecies/utilities.ts +111 -0
- package/src/services/index.ts +3 -0
- package/src/services/pbkdf2.ts +307 -0
- package/{dist/types.d.ts → src/types.ts} +26 -9
- package/src/utils.ts +104 -0
- package/dist/constants.d.ts +0 -32
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -137
- package/dist/constants.js.map +0 -1
- package/dist/enumerations/index.d.ts +0 -2
- package/dist/enumerations/index.d.ts.map +0 -1
- package/dist/enumerations/index.js +0 -18
- package/dist/enumerations/index.js.map +0 -1
- package/dist/enumerations/pbkdf2-profile.d.ts +0 -9
- package/dist/enumerations/pbkdf2-profile.d.ts.map +0 -1
- package/dist/enumerations/pbkdf2-profile.js +0 -13
- package/dist/enumerations/pbkdf2-profile.js.map +0 -1
- package/dist/i18n/ecies-i18n-factory.d.ts +0 -54
- package/dist/i18n/ecies-i18n-factory.d.ts.map +0 -1
- package/dist/i18n/ecies-i18n-factory.js +0 -332
- package/dist/i18n/ecies-i18n-factory.js.map +0 -1
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/index.js +0 -18
- package/dist/i18n/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -24
- package/dist/index.js.map +0 -1
- package/dist/interfaces/authenticated-cipher.d.ts +0 -10
- package/dist/interfaces/authenticated-cipher.d.ts.map +0 -1
- package/dist/interfaces/authenticated-cipher.js +0 -3
- package/dist/interfaces/authenticated-cipher.js.map +0 -1
- package/dist/interfaces/authenticated-decipher.d.ts +0 -9
- package/dist/interfaces/authenticated-decipher.d.ts.map +0 -1
- package/dist/interfaces/authenticated-decipher.js +0 -3
- package/dist/interfaces/authenticated-decipher.js.map +0 -1
- package/dist/interfaces/checksum-config.d.ts +0 -5
- package/dist/interfaces/checksum-config.d.ts.map +0 -1
- package/dist/interfaces/checksum-config.js +0 -3
- package/dist/interfaces/checksum-config.js.map +0 -1
- package/dist/interfaces/checksum-consts.d.ts +0 -11
- package/dist/interfaces/checksum-consts.d.ts.map +0 -1
- package/dist/interfaces/checksum-consts.js +0 -3
- package/dist/interfaces/checksum-consts.js.map +0 -1
- package/dist/interfaces/constants.d.ts +0 -43
- package/dist/interfaces/constants.d.ts.map +0 -1
- package/dist/interfaces/constants.js +0 -3
- package/dist/interfaces/constants.js.map +0 -1
- package/dist/interfaces/ecies-consts.d.ts +0 -88
- package/dist/interfaces/ecies-consts.d.ts.map +0 -1
- package/dist/interfaces/ecies-consts.js +0 -3
- package/dist/interfaces/ecies-consts.js.map +0 -1
- package/dist/interfaces/encryption-consts.d.ts +0 -11
- package/dist/interfaces/encryption-consts.d.ts.map +0 -1
- package/dist/interfaces/encryption-consts.js +0 -3
- package/dist/interfaces/encryption-consts.js.map +0 -1
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/index.js +0 -34
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts +0 -6
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts.map +0 -1
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js +0 -3
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js.map +0 -1
- package/dist/interfaces/keyring-consts.d.ts +0 -6
- package/dist/interfaces/keyring-consts.d.ts.map +0 -1
- package/dist/interfaces/keyring-consts.js +0 -3
- package/dist/interfaces/keyring-consts.js.map +0 -1
- package/dist/interfaces/member-operational.d.ts +0 -36
- package/dist/interfaces/member-operational.d.ts.map +0 -1
- package/dist/interfaces/member-operational.js +0 -3
- package/dist/interfaces/member-operational.js.map +0 -1
- package/dist/interfaces/member-with-mnemonic.d.ts.map +0 -1
- package/dist/interfaces/member-with-mnemonic.js +0 -3
- package/dist/interfaces/member-with-mnemonic.js.map +0 -1
- package/dist/interfaces/multi-encrypted-message.d.ts.map +0 -1
- package/dist/interfaces/multi-encrypted-message.js +0 -3
- package/dist/interfaces/multi-encrypted-message.js.map +0 -1
- package/dist/interfaces/multi-encrypted-parsed-header.d.ts +0 -24
- package/dist/interfaces/multi-encrypted-parsed-header.d.ts.map +0 -1
- package/dist/interfaces/multi-encrypted-parsed-header.js +0 -3
- package/dist/interfaces/multi-encrypted-parsed-header.js.map +0 -1
- package/dist/interfaces/pbkdf-profiles.d.ts.map +0 -1
- package/dist/interfaces/pbkdf-profiles.js +0 -3
- package/dist/interfaces/pbkdf-profiles.js.map +0 -1
- package/dist/interfaces/pbkdf2-result.d.ts +0 -6
- package/dist/interfaces/pbkdf2-result.d.ts.map +0 -1
- package/dist/interfaces/pbkdf2-result.js +0 -3
- package/dist/interfaces/pbkdf2-result.js.map +0 -1
- package/dist/interfaces/signing-key-private-key-info.d.ts +0 -11
- package/dist/interfaces/signing-key-private-key-info.d.ts.map +0 -1
- package/dist/interfaces/signing-key-private-key-info.js +0 -3
- package/dist/interfaces/signing-key-private-key-info.js.map +0 -1
- package/dist/interfaces/simple-keypair-buffer.d.ts.map +0 -1
- package/dist/interfaces/simple-keypair-buffer.js +0 -3
- package/dist/interfaces/simple-keypair-buffer.js.map +0 -1
- package/dist/interfaces/simple-keypair.d.ts.map +0 -1
- package/dist/interfaces/simple-keypair.js +0 -3
- package/dist/interfaces/simple-keypair.js.map +0 -1
- package/dist/interfaces/simple-public-key-only-buffer.d.ts +0 -4
- package/dist/interfaces/simple-public-key-only-buffer.d.ts.map +0 -1
- package/dist/interfaces/simple-public-key-only-buffer.js +0 -3
- package/dist/interfaces/simple-public-key-only-buffer.js.map +0 -1
- package/dist/interfaces/simple-public-key-only.d.ts +0 -4
- package/dist/interfaces/simple-public-key-only.d.ts.map +0 -1
- package/dist/interfaces/simple-public-key-only.js +0 -3
- package/dist/interfaces/simple-public-key-only.js.map +0 -1
- package/dist/interfaces/single-encrypted-parsed-header.d.ts +0 -35
- package/dist/interfaces/single-encrypted-parsed-header.d.ts.map +0 -1
- package/dist/interfaces/single-encrypted-parsed-header.js +0 -3
- package/dist/interfaces/single-encrypted-parsed-header.js.map +0 -1
- package/dist/interfaces/wallet-seed.d.ts.map +0 -1
- package/dist/interfaces/wallet-seed.js +0 -3
- package/dist/interfaces/wallet-seed.js.map +0 -1
- package/dist/interfaces/wrapped-key-consts.d.ts +0 -7
- package/dist/interfaces/wrapped-key-consts.d.ts.map +0 -1
- package/dist/interfaces/wrapped-key-consts.js +0 -3
- package/dist/interfaces/wrapped-key-consts.js.map +0 -1
- package/dist/member.d.ts +0 -74
- package/dist/member.d.ts.map +0 -1
- package/dist/member.js +0 -273
- package/dist/member.js.map +0 -1
- package/dist/services/aes-gcm.d.ts +0 -66
- package/dist/services/aes-gcm.d.ts.map +0 -1
- package/dist/services/aes-gcm.js +0 -115
- package/dist/services/aes-gcm.js.map +0 -1
- package/dist/services/ecies/crypto-core.d.ts +0 -83
- package/dist/services/ecies/crypto-core.d.ts.map +0 -1
- package/dist/services/ecies/crypto-core.js +0 -166
- package/dist/services/ecies/crypto-core.js.map +0 -1
- package/dist/services/ecies/file.d.ts +0 -30
- package/dist/services/ecies/file.d.ts.map +0 -1
- package/dist/services/ecies/file.js +0 -144
- package/dist/services/ecies/file.js.map +0 -1
- package/dist/services/ecies/index.d.ts.map +0 -1
- package/dist/services/ecies/index.js +0 -24
- package/dist/services/ecies/index.js.map +0 -1
- package/dist/services/ecies/multi-recipient.d.ts +0 -83
- package/dist/services/ecies/multi-recipient.d.ts.map +0 -1
- package/dist/services/ecies/multi-recipient.js +0 -360
- package/dist/services/ecies/multi-recipient.js.map +0 -1
- package/dist/services/ecies/service.d.ts +0 -71
- package/dist/services/ecies/service.d.ts.map +0 -1
- package/dist/services/ecies/service.js +0 -167
- package/dist/services/ecies/service.js.map +0 -1
- package/dist/services/ecies/signature.d.ts +0 -38
- package/dist/services/ecies/signature.d.ts.map +0 -1
- package/dist/services/ecies/signature.js +0 -69
- package/dist/services/ecies/signature.js.map +0 -1
- package/dist/services/ecies/single-recipient.d.ts +0 -86
- package/dist/services/ecies/single-recipient.d.ts.map +0 -1
- package/dist/services/ecies/single-recipient.js +0 -399
- package/dist/services/ecies/single-recipient.js.map +0 -1
- package/dist/services/ecies/utilities.d.ts +0 -22
- package/dist/services/ecies/utilities.d.ts.map +0 -1
- package/dist/services/ecies/utilities.js +0 -75
- package/dist/services/ecies/utilities.js.map +0 -1
- package/dist/services/index.d.ts +0 -4
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/index.js +0 -20
- package/dist/services/index.js.map +0 -1
- package/dist/services/pbkdf2.d.ts +0 -107
- package/dist/services/pbkdf2.d.ts.map +0 -1
- package/dist/services/pbkdf2.js +0 -195
- package/dist/services/pbkdf2.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -11
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -82
- package/dist/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -265,6 +265,14 @@ Please read the contributing guidelines in the main repository.
|
|
|
265
265
|
|
|
266
266
|
## ChangeLog
|
|
267
267
|
|
|
268
|
+
### Version 1.1.22
|
|
269
|
+
|
|
270
|
+
- Upgrade to es2022/nx monorepo
|
|
271
|
+
|
|
272
|
+
### Version 1.1.21
|
|
273
|
+
|
|
274
|
+
- Upgrade pbkdf2service to plugini18n
|
|
275
|
+
|
|
268
276
|
### Version 1.1.20
|
|
269
277
|
|
|
270
278
|
- Update i18n/ecies
|
package/package.json
CHANGED
|
@@ -1,45 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/node-ecies-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "Digital Defiance Node ECIES Library",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "
|
|
9
|
-
"test": "
|
|
10
|
-
"test:stream": "
|
|
11
|
-
"lint": "
|
|
12
|
-
"lint:fix": "
|
|
8
|
+
"build": "npx nx build digitaldefiance-node-ecies-lib",
|
|
9
|
+
"test": "npx nx test digitaldefiance-node-ecies-lib",
|
|
10
|
+
"test:stream": "npx nx test digitaldefiance-node-ecies-lib --output-style=stream",
|
|
11
|
+
"lint": "npx nx lint digitaldefiance-node-ecies-lib",
|
|
12
|
+
"lint:fix": "npx nx lint digitaldefiance-node-ecies-lib --fix",
|
|
13
13
|
"prettier:check": "prettier --check 'src/**/*.{ts,tsx}'",
|
|
14
14
|
"prettier:fix": "prettier --write 'src/**/*.{ts,tsx}'",
|
|
15
|
-
"format": "
|
|
16
|
-
"
|
|
15
|
+
"format": "npx nx format:write --projects=digitaldefiance-node-ecies-lib",
|
|
16
|
+
"format:check": "npx nx format:check --projects=digitaldefiance-node-ecies-lib",
|
|
17
|
+
"prepublishOnly": "npx nx build digitaldefiance-node-ecies-lib",
|
|
17
18
|
"publish:public": "npm publish --access public"
|
|
18
19
|
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@babel/core": "^7.28.4",
|
|
21
|
-
"@babel/preset-env": "^7.28.3",
|
|
22
|
-
"@babel/preset-typescript": "^7.27.1",
|
|
23
|
-
"@types/babel__core": "^7",
|
|
24
|
-
"@types/babel__preset-env": "^7",
|
|
25
|
-
"@types/jest": "^29.0.0",
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.31.1",
|
|
27
|
-
"@typescript-eslint/parser": "^8.31.1",
|
|
28
|
-
"babel-jest": "^30.1.2",
|
|
29
|
-
"eslint": "^9.8.0",
|
|
30
|
-
"eslint-config-prettier": "^10.1.2",
|
|
31
|
-
"eslint-plugin-import": "^2.32.0",
|
|
32
|
-
"eslint-plugin-prettier": "^5.3.1",
|
|
33
|
-
"jest": "^29.0.0",
|
|
34
|
-
"jest-resolver-enhanced": "^1.1.0",
|
|
35
|
-
"jest-util": "^30.0.5",
|
|
36
|
-
"prettier": "^2.6.2",
|
|
37
|
-
"prettier-plugin-organize-imports": "^4.1.0",
|
|
38
|
-
"ts-jest": "^29.0.0",
|
|
39
|
-
"typescript": "^5.9.2"
|
|
40
|
-
},
|
|
41
20
|
"files": [
|
|
42
|
-
"
|
|
21
|
+
"src",
|
|
43
22
|
"README.md"
|
|
44
23
|
],
|
|
45
24
|
"keywords": [
|
|
@@ -52,8 +31,8 @@
|
|
|
52
31
|
"license": "MIT",
|
|
53
32
|
"packageManager": "yarn@4.10.3",
|
|
54
33
|
"dependencies": {
|
|
55
|
-
"@digitaldefiance/ecies-lib": "1.1.
|
|
56
|
-
"@digitaldefiance/i18n-lib": "1.3.
|
|
34
|
+
"@digitaldefiance/ecies-lib": "1.1.24",
|
|
35
|
+
"@digitaldefiance/i18n-lib": "1.3.13",
|
|
57
36
|
"@ethereumjs/wallet": "^10.0.0",
|
|
58
37
|
"@noble/curves": "^2.0.1",
|
|
59
38
|
"@noble/hashes": "^2.0.1",
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Constants as BaseConstants,
|
|
3
|
+
GUID_SIZE,
|
|
4
|
+
IPBkdf2Consts,
|
|
5
|
+
getRuntimeConfiguration,
|
|
6
|
+
registerRuntimeConfiguration,
|
|
7
|
+
} from '@digitaldefiance/ecies-lib';
|
|
8
|
+
import { CipherGCMTypes } from 'crypto';
|
|
9
|
+
import { ObjectId } from 'mongodb';
|
|
10
|
+
import { IChecksumConsts } from './interfaces/checksum-consts';
|
|
11
|
+
import { IConstants } from './interfaces/constants';
|
|
12
|
+
import { IEncryptionConsts } from './interfaces/encryption-consts';
|
|
13
|
+
import { IKeyringConsts } from './interfaces/keyring-consts';
|
|
14
|
+
import { PbkdfProfiles } from './interfaces/pbkdf-profiles';
|
|
15
|
+
import { IWrappedKeyConsts } from './interfaces/wrapped-key-consts';
|
|
16
|
+
import { Pbkdf2ProfileEnum as NodePbkdf2ProfileEnum } from './enumerations/pbkdf2-profile';
|
|
17
|
+
import { getEciesPluginI18nEngine, NodeEciesComponentId, NodeEciesStringKey } from './i18n';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Constants for checksum operations
|
|
21
|
+
* These values are critical for data integrity and MUST NOT be changed
|
|
22
|
+
* in an already established system as it will break all existing checksums.
|
|
23
|
+
*/
|
|
24
|
+
export const NODE_RUNTIME_CONFIGURATION_KEY = Symbol.for(
|
|
25
|
+
'digitaldefiance.node.ecies.defaults',
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
type NodeRuntimeConfiguration = ReturnType<typeof getRuntimeConfiguration>;
|
|
29
|
+
type NodeRuntimeOverrides = Parameters<
|
|
30
|
+
typeof registerRuntimeConfiguration
|
|
31
|
+
>[1];
|
|
32
|
+
|
|
33
|
+
export const NODE_DEFAULTS_OVERRIDES: NodeRuntimeOverrides = Object.freeze({
|
|
34
|
+
PBKDF2: {
|
|
35
|
+
ALGORITHM: 'sha256',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
let runtimeDefaults: NodeRuntimeConfiguration = registerRuntimeConfiguration(
|
|
40
|
+
NODE_RUNTIME_CONFIGURATION_KEY,
|
|
41
|
+
NODE_DEFAULTS_OVERRIDES,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export function getNodeRuntimeConfiguration(): NodeRuntimeConfiguration {
|
|
45
|
+
return runtimeDefaults;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function registerNodeRuntimeConfiguration(
|
|
49
|
+
configOrOverrides?: NodeRuntimeOverrides | NodeRuntimeConfiguration,
|
|
50
|
+
options?: Parameters<typeof registerRuntimeConfiguration>[2],
|
|
51
|
+
): NodeRuntimeConfiguration {
|
|
52
|
+
runtimeDefaults = registerRuntimeConfiguration(
|
|
53
|
+
NODE_RUNTIME_CONFIGURATION_KEY,
|
|
54
|
+
configOrOverrides,
|
|
55
|
+
options,
|
|
56
|
+
);
|
|
57
|
+
return runtimeDefaults;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const CHECKSUM: IChecksumConsts = runtimeDefaults.CHECKSUM;
|
|
61
|
+
|
|
62
|
+
export const KEYRING: IKeyringConsts = Object.freeze({
|
|
63
|
+
ALGORITHM: 'aes' as const,
|
|
64
|
+
KEY_BITS: 256 as const,
|
|
65
|
+
MODE: 'gcm' as const,
|
|
66
|
+
} as const);
|
|
67
|
+
|
|
68
|
+
export const PBKDF2: IPBkdf2Consts = runtimeDefaults.PBKDF2;
|
|
69
|
+
|
|
70
|
+
export const PBKDF2_PROFILES: PbkdfProfiles = Object.freeze({
|
|
71
|
+
// Align browser password profile with high security expectations (sha512, 64-byte salt/hash, 2M iterations)
|
|
72
|
+
[NodePbkdf2ProfileEnum.BROWSER_PASSWORD]: Object.freeze({
|
|
73
|
+
saltBytes: 64,
|
|
74
|
+
iterations: 2000000,
|
|
75
|
+
algorithm: 'sha512',
|
|
76
|
+
hashBytes: 64,
|
|
77
|
+
}),
|
|
78
|
+
// High security profile (sha512, 64-byte salt/hash, 2M iterations)
|
|
79
|
+
[NodePbkdf2ProfileEnum.HIGH_SECURITY]: Object.freeze({
|
|
80
|
+
saltBytes: 64,
|
|
81
|
+
iterations: 2000000,
|
|
82
|
+
algorithm: 'sha512',
|
|
83
|
+
hashBytes: 64,
|
|
84
|
+
}),
|
|
85
|
+
// Fast test profile (small salt and iterations for speed)
|
|
86
|
+
[NodePbkdf2ProfileEnum.TEST_FAST]: Object.freeze({
|
|
87
|
+
saltBytes: 16,
|
|
88
|
+
iterations: 500,
|
|
89
|
+
algorithm: 'sha256',
|
|
90
|
+
hashBytes: 32,
|
|
91
|
+
}),
|
|
92
|
+
[NodePbkdf2ProfileEnum.USER_LOGIN]: Object.freeze({
|
|
93
|
+
saltBytes: 32,
|
|
94
|
+
iterations: 1304000,
|
|
95
|
+
algorithm: 'sha256',
|
|
96
|
+
hashBytes: 32,
|
|
97
|
+
}),
|
|
98
|
+
[NodePbkdf2ProfileEnum.KEY_WRAPPING]: Object.freeze({
|
|
99
|
+
saltBytes: 32,
|
|
100
|
+
iterations: 100000,
|
|
101
|
+
algorithm: 'sha256',
|
|
102
|
+
hashBytes: 32,
|
|
103
|
+
}),
|
|
104
|
+
[NodePbkdf2ProfileEnum.BACKUP_CODES]: Object.freeze({
|
|
105
|
+
saltBytes: 32,
|
|
106
|
+
iterations: 1304000,
|
|
107
|
+
algorithm: 'sha256',
|
|
108
|
+
hashBytes: 32,
|
|
109
|
+
}),
|
|
110
|
+
} as const);
|
|
111
|
+
|
|
112
|
+
export const WRAPPED_KEY: IWrappedKeyConsts = Object.freeze({
|
|
113
|
+
SALT_SIZE: PBKDF2.SALT_BYTES, // Use PBKDF2 standard salt size
|
|
114
|
+
IV_SIZE: 16 as const,
|
|
115
|
+
MASTER_KEY_SIZE: 32 as const,
|
|
116
|
+
MIN_ITERATIONS: 100000 as const, // Keep lower for key-wrapping operations
|
|
117
|
+
} as const);
|
|
118
|
+
|
|
119
|
+
export const KEYRING_ALGORITHM_CONFIGURATION =
|
|
120
|
+
`${KEYRING.ALGORITHM}-${KEYRING.KEY_BITS}-${KEYRING.MODE}` as CipherGCMTypes;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Constants for encrypted data
|
|
124
|
+
*/
|
|
125
|
+
export const ENCRYPTION: IEncryptionConsts = Object.freeze({
|
|
126
|
+
ENCRYPTION_TYPE_SIZE: 1 as const,
|
|
127
|
+
RECIPIENT_ID_SIZE: GUID_SIZE,
|
|
128
|
+
} as const);
|
|
129
|
+
|
|
130
|
+
const objectIdLength = Buffer.from(new ObjectId().toHexString(), 'hex').length;
|
|
131
|
+
export const Constants: IConstants = Object.freeze({
|
|
132
|
+
...BaseConstants,
|
|
133
|
+
/**
|
|
134
|
+
* The length of a raw object ID (not the hex string representation)
|
|
135
|
+
*/
|
|
136
|
+
OBJECT_ID_LENGTH: objectIdLength,
|
|
137
|
+
/**
|
|
138
|
+
* PBKDF2 constants
|
|
139
|
+
*/
|
|
140
|
+
PBKDF2: PBKDF2,
|
|
141
|
+
/**
|
|
142
|
+
* PBKDF2 configuration profiles
|
|
143
|
+
*/
|
|
144
|
+
PBKDF2_PROFILES: PBKDF2_PROFILES,
|
|
145
|
+
/**
|
|
146
|
+
* Key Wrapping Service constants
|
|
147
|
+
*/
|
|
148
|
+
WRAPPED_KEY: WRAPPED_KEY,
|
|
149
|
+
/**
|
|
150
|
+
* Checksum constants used for data integrity
|
|
151
|
+
*/
|
|
152
|
+
CHECKSUM: CHECKSUM,
|
|
153
|
+
/**
|
|
154
|
+
* Keyring constants used for key management
|
|
155
|
+
*/
|
|
156
|
+
KEYRING: KEYRING,
|
|
157
|
+
/**
|
|
158
|
+
* Encryption constants used for encrypted data
|
|
159
|
+
*/
|
|
160
|
+
ENCRYPTION: ENCRYPTION,
|
|
161
|
+
/**
|
|
162
|
+
* Algorithm configuration string for keyring operations
|
|
163
|
+
*/
|
|
164
|
+
KEYRING_ALGORITHM_CONFIGURATION: KEYRING_ALGORITHM_CONFIGURATION,
|
|
165
|
+
PasswordRegex: runtimeDefaults.PasswordRegex,
|
|
166
|
+
MnemonicRegex: runtimeDefaults.MnemonicRegex,
|
|
167
|
+
} as const);
|
|
168
|
+
|
|
169
|
+
if (
|
|
170
|
+
CHECKSUM.SHA3_BUFFER_LENGTH !== CHECKSUM.SHA3_DEFAULT_HASH_BITS / 8 ||
|
|
171
|
+
CHECKSUM.SHA3_BUFFER_LENGTH !== CHECKSUM.SHA3_DEFAULT_HASH_BITS / 8
|
|
172
|
+
) {
|
|
173
|
+
const pluginEngine = getEciesPluginI18nEngine();
|
|
174
|
+
throw new Error(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_InvalidChecksumConstants));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (objectIdLength !== 12) {
|
|
178
|
+
console.warn(
|
|
179
|
+
'ObjectID length may have changed, breaking encryption',
|
|
180
|
+
objectIdLength,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pbkdf2-profile';
|