@digitaldefiance/node-ecies-lib 4.4.8 → 4.4.10
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/package.json +6 -5
- package/src/builders/ecies-builder.d.ts +11 -0
- package/src/builders/ecies-builder.d.ts.map +1 -0
- package/src/builders/ecies-builder.js +26 -0
- package/src/builders/ecies-builder.js.map +1 -0
- package/src/builders/{index.ts → index.d.ts} +1 -0
- package/src/builders/index.d.ts.map +1 -0
- package/src/builders/index.js +6 -0
- package/src/builders/index.js.map +1 -0
- package/src/builders/member-builder.d.ts +47 -0
- package/src/builders/member-builder.d.ts.map +1 -0
- package/src/builders/member-builder.js +99 -0
- package/src/builders/member-builder.js.map +1 -0
- package/src/constants.d.ts +38 -0
- package/src/constants.d.ts.map +1 -0
- package/src/constants.js +183 -0
- package/src/constants.js.map +1 -0
- package/src/core/errors/crypto-error.d.ts +6 -0
- package/src/core/errors/crypto-error.d.ts.map +1 -0
- package/src/core/errors/crypto-error.js +15 -0
- package/src/core/errors/crypto-error.js.map +1 -0
- package/src/core/{index.ts → index.d.ts} +1 -0
- package/src/core/index.d.ts.map +1 -0
- package/src/core/index.js +6 -0
- package/src/core/index.js.map +1 -0
- package/src/core/types/result.d.ts +8 -0
- package/src/core/types/result.d.ts.map +1 -0
- package/src/core/types/result.js +3 -0
- package/src/core/types/result.js.map +1 -0
- package/src/enumerations/index.d.ts +2 -0
- package/src/enumerations/index.d.ts.map +1 -0
- package/src/enumerations/index.js +5 -0
- package/src/enumerations/index.js.map +1 -0
- package/src/enumerations/pbkdf2-profile.d.ts +9 -0
- package/src/enumerations/pbkdf2-profile.d.ts.map +1 -0
- package/src/enumerations/pbkdf2-profile.js +13 -0
- package/src/enumerations/pbkdf2-profile.js.map +1 -0
- package/src/i18n/ecies-i18n-factory.d.ts +28 -0
- package/src/i18n/ecies-i18n-factory.d.ts.map +1 -0
- package/src/i18n/ecies-i18n-factory.js +89 -0
- package/src/i18n/ecies-i18n-factory.js.map +1 -0
- package/src/i18n/{index.ts → index.d.ts} +1 -3
- package/src/i18n/index.d.ts.map +1 -0
- package/src/i18n/index.js +8 -0
- package/src/i18n/index.js.map +1 -0
- package/src/i18n/node-ecies-i18n-setup.d.ts +5 -0
- package/src/i18n/node-ecies-i18n-setup.d.ts.map +1 -0
- package/src/i18n/node-ecies-i18n-setup.js +46 -0
- package/src/i18n/node-ecies-i18n-setup.js.map +1 -0
- package/src/i18n/node-keys.d.ts +57 -0
- package/src/i18n/node-keys.d.ts.map +1 -0
- package/src/i18n/node-keys.js +67 -0
- package/src/i18n/node-keys.js.map +1 -0
- package/src/i18n/translations/de.d.ts +3 -0
- package/src/i18n/translations/de.d.ts.map +1 -0
- package/src/i18n/translations/de.js +57 -0
- package/src/i18n/translations/de.js.map +1 -0
- package/src/i18n/translations/en-GB.d.ts +3 -0
- package/src/i18n/translations/en-GB.d.ts.map +1 -0
- package/src/i18n/translations/en-GB.js +61 -0
- package/src/i18n/translations/en-GB.js.map +1 -0
- package/src/i18n/translations/en-US.d.ts +6 -0
- package/src/i18n/translations/en-US.d.ts.map +1 -0
- package/src/i18n/translations/en-US.js +65 -0
- package/src/i18n/translations/en-US.js.map +1 -0
- package/src/i18n/translations/es.d.ts +3 -0
- package/src/i18n/translations/es.d.ts.map +1 -0
- package/src/i18n/translations/es.js +57 -0
- package/src/i18n/translations/es.js.map +1 -0
- package/src/i18n/translations/fr.d.ts +3 -0
- package/src/i18n/translations/fr.d.ts.map +1 -0
- package/src/i18n/translations/fr.js +57 -0
- package/src/i18n/translations/fr.js.map +1 -0
- package/src/i18n/translations/{index.ts → index.d.ts} +1 -0
- package/src/i18n/translations/index.d.ts.map +1 -0
- package/src/i18n/translations/index.js +20 -0
- package/src/i18n/translations/index.js.map +1 -0
- package/src/i18n/translations/ja.d.ts +3 -0
- package/src/i18n/translations/ja.d.ts.map +1 -0
- package/src/i18n/translations/ja.js +57 -0
- package/src/i18n/translations/ja.js.map +1 -0
- package/src/i18n/translations/uk.d.ts +3 -0
- package/src/i18n/translations/uk.d.ts.map +1 -0
- package/src/i18n/translations/uk.js +57 -0
- package/src/i18n/translations/uk.js.map +1 -0
- package/src/i18n/translations/zh-cn.d.ts +3 -0
- package/src/i18n/translations/zh-cn.d.ts.map +1 -0
- package/src/i18n/translations/zh-cn.js +57 -0
- package/src/i18n/translations/zh-cn.js.map +1 -0
- package/src/{index.ts → index.d.ts} +1 -5
- package/src/index.d.ts.map +1 -0
- package/src/index.js +31 -0
- package/src/index.js.map +1 -0
- package/src/interfaces/authenticated-cipher.d.ts +12 -0
- package/src/interfaces/authenticated-cipher.d.ts.map +1 -0
- package/src/interfaces/authenticated-cipher.js +3 -0
- package/src/interfaces/authenticated-cipher.js.map +1 -0
- package/src/interfaces/authenticated-decipher.d.ts +11 -0
- package/src/interfaces/authenticated-decipher.d.ts.map +1 -0
- package/src/interfaces/authenticated-decipher.js +3 -0
- package/src/interfaces/authenticated-decipher.js.map +1 -0
- package/src/interfaces/backend-member-operational.d.ts +48 -0
- package/src/interfaces/backend-member-operational.d.ts.map +1 -0
- package/src/interfaces/backend-member-operational.js +3 -0
- package/src/interfaces/backend-member-operational.js.map +1 -0
- package/src/interfaces/checksum-config.d.ts +5 -0
- package/src/interfaces/checksum-config.d.ts.map +1 -0
- package/src/interfaces/checksum-config.js +3 -0
- package/src/interfaces/checksum-config.js.map +1 -0
- package/src/interfaces/checksum-consts.d.ts +11 -0
- package/src/interfaces/checksum-consts.d.ts.map +1 -0
- package/src/interfaces/checksum-consts.js +3 -0
- package/src/interfaces/checksum-consts.js.map +1 -0
- package/src/interfaces/constants.d.ts +52 -0
- package/src/interfaces/constants.d.ts.map +1 -0
- package/src/interfaces/constants.js +3 -0
- package/src/interfaces/constants.js.map +1 -0
- package/src/interfaces/ecies-consts.d.ts +88 -0
- package/src/interfaces/ecies-consts.d.ts.map +1 -0
- package/src/interfaces/ecies-consts.js +3 -0
- package/src/interfaces/ecies-consts.js.map +1 -0
- package/src/interfaces/encrypted-chunk.d.ts +12 -0
- package/src/interfaces/encrypted-chunk.d.ts.map +1 -0
- package/src/interfaces/encrypted-chunk.js +3 -0
- package/src/interfaces/encrypted-chunk.js.map +1 -0
- package/src/interfaces/encryption-consts.d.ts +11 -0
- package/src/interfaces/encryption-consts.d.ts.map +1 -0
- package/src/interfaces/encryption-consts.js +3 -0
- package/src/interfaces/encryption-consts.js.map +1 -0
- package/src/interfaces/{index.ts → index.d.ts} +1 -0
- package/src/interfaces/index.d.ts.map +1 -0
- package/src/interfaces/index.js +30 -0
- package/src/interfaces/index.js.map +1 -0
- package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts +6 -0
- package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts.map +1 -0
- package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.js +3 -0
- package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.js.map +1 -0
- package/src/interfaces/keyring-consts.d.ts +6 -0
- package/src/interfaces/keyring-consts.d.ts.map +1 -0
- package/src/interfaces/keyring-consts.js +3 -0
- package/src/interfaces/keyring-consts.js.map +1 -0
- package/src/interfaces/{member-with-mnemonic.ts → member-with-mnemonic.d.ts} +3 -3
- package/src/interfaces/member-with-mnemonic.d.ts.map +1 -0
- package/src/interfaces/member-with-mnemonic.js +3 -0
- package/src/interfaces/member-with-mnemonic.js.map +1 -0
- package/src/interfaces/member.d.ts +47 -0
- package/src/interfaces/member.d.ts.map +1 -0
- package/src/interfaces/member.js +3 -0
- package/src/interfaces/member.js.map +1 -0
- package/src/interfaces/{multi-encrypted-message.ts → multi-encrypted-message.d.ts} +5 -5
- package/src/interfaces/multi-encrypted-message.d.ts.map +1 -0
- package/src/interfaces/multi-encrypted-message.js +3 -0
- package/src/interfaces/multi-encrypted-message.js.map +1 -0
- package/src/interfaces/multi-encrypted-parsed-header.d.ts +27 -0
- package/src/interfaces/multi-encrypted-parsed-header.d.ts.map +1 -0
- package/src/interfaces/multi-encrypted-parsed-header.js +3 -0
- package/src/interfaces/multi-encrypted-parsed-header.js.map +1 -0
- package/src/interfaces/multi-recipient-chunk.d.ts +26 -0
- package/src/interfaces/multi-recipient-chunk.d.ts.map +1 -0
- package/src/interfaces/multi-recipient-chunk.js +13 -0
- package/src/interfaces/multi-recipient-chunk.js.map +1 -0
- package/src/interfaces/{pbkdf-profiles.ts → pbkdf-profiles.d.ts} +2 -2
- package/src/interfaces/pbkdf-profiles.d.ts.map +1 -0
- package/src/interfaces/pbkdf-profiles.js +3 -0
- package/src/interfaces/pbkdf-profiles.js.map +1 -0
- package/src/interfaces/pbkdf2-result.d.ts +6 -0
- package/src/interfaces/pbkdf2-result.d.ts.map +1 -0
- package/src/interfaces/pbkdf2-result.js +3 -0
- package/src/interfaces/pbkdf2-result.js.map +1 -0
- package/src/interfaces/signing-key-private-key-info.d.ts +11 -0
- package/src/interfaces/signing-key-private-key-info.d.ts.map +1 -0
- package/src/interfaces/signing-key-private-key-info.js +3 -0
- package/src/interfaces/signing-key-private-key-info.js.map +1 -0
- package/src/interfaces/{simple-keypair-buffer.ts → simple-keypair-buffer.d.ts} +3 -3
- package/src/interfaces/simple-keypair-buffer.d.ts.map +1 -0
- package/src/interfaces/simple-keypair-buffer.js +3 -0
- package/src/interfaces/simple-keypair-buffer.js.map +1 -0
- package/src/interfaces/{simple-keypair.ts → simple-keypair.d.ts} +3 -3
- package/src/interfaces/simple-keypair.d.ts.map +1 -0
- package/src/interfaces/simple-keypair.js +3 -0
- package/src/interfaces/simple-keypair.js.map +1 -0
- package/src/interfaces/simple-public-key-only-buffer.d.ts +4 -0
- package/src/interfaces/simple-public-key-only-buffer.d.ts.map +1 -0
- package/src/interfaces/simple-public-key-only-buffer.js +3 -0
- package/src/interfaces/simple-public-key-only-buffer.js.map +1 -0
- package/src/interfaces/simple-public-key-only.d.ts +4 -0
- package/src/interfaces/simple-public-key-only.d.ts.map +1 -0
- package/src/interfaces/simple-public-key-only.js +3 -0
- package/src/interfaces/simple-public-key-only.js.map +1 -0
- package/src/interfaces/single-encrypted-parsed-header.d.ts +35 -0
- package/src/interfaces/single-encrypted-parsed-header.d.ts.map +1 -0
- package/src/interfaces/single-encrypted-parsed-header.js +3 -0
- package/src/interfaces/single-encrypted-parsed-header.js.map +1 -0
- package/src/interfaces/stream-config.d.ts +6 -0
- package/src/interfaces/stream-config.d.ts.map +1 -0
- package/src/interfaces/stream-config.js +8 -0
- package/src/interfaces/stream-config.js.map +1 -0
- package/src/interfaces/stream-progress.d.ts +8 -0
- package/src/interfaces/stream-progress.d.ts.map +1 -0
- package/src/interfaces/stream-progress.js +3 -0
- package/src/interfaces/stream-progress.js.map +1 -0
- package/src/interfaces/{wallet-seed.ts → wallet-seed.d.ts} +3 -3
- package/src/interfaces/wallet-seed.d.ts.map +1 -0
- package/src/interfaces/wallet-seed.js +3 -0
- package/src/interfaces/wallet-seed.js.map +1 -0
- package/src/interfaces/wrapped-key-consts.d.ts +7 -0
- package/src/interfaces/wrapped-key-consts.d.ts.map +1 -0
- package/src/interfaces/wrapped-key-consts.js +3 -0
- package/src/interfaces/wrapped-key-consts.js.map +1 -0
- package/src/lib/crypto-container.d.ts +13 -0
- package/src/lib/crypto-container.d.ts.map +1 -0
- package/src/lib/crypto-container.js +29 -0
- package/src/lib/crypto-container.js.map +1 -0
- package/src/lib/{index.ts → index.d.ts} +1 -0
- package/src/lib/index.d.ts.map +1 -0
- package/src/lib/index.js +7 -0
- package/src/lib/index.js.map +1 -0
- package/src/lib/invariant-validator.d.ts +62 -0
- package/src/lib/invariant-validator.d.ts.map +1 -0
- package/src/lib/invariant-validator.js +108 -0
- package/src/lib/invariant-validator.js.map +1 -0
- package/src/lib/invariants/{index.ts → index.d.ts} +2 -2
- package/src/lib/invariants/index.d.ts.map +1 -0
- package/src/lib/invariants/index.js +12 -0
- package/src/lib/invariants/index.js.map +1 -0
- package/src/lib/invariants/recipient-id-consistency.d.ts +22 -0
- package/src/lib/invariants/recipient-id-consistency.d.ts.map +1 -0
- package/src/lib/invariants/recipient-id-consistency.js +62 -0
- package/src/lib/invariants/recipient-id-consistency.js.map +1 -0
- package/src/member.d.ts +81 -0
- package/src/member.d.ts.map +1 -0
- package/src/member.js +285 -0
- package/src/member.js.map +1 -0
- package/src/services/aes-gcm.d.ts +66 -0
- package/src/services/aes-gcm.d.ts.map +1 -0
- package/src/services/aes-gcm.js +158 -0
- package/src/services/aes-gcm.js.map +1 -0
- package/src/services/chunk-processor.d.ts +15 -0
- package/src/services/chunk-processor.d.ts.map +1 -0
- package/src/services/chunk-processor.js +36 -0
- package/src/services/chunk-processor.js.map +1 -0
- package/src/services/ecies/crypto-core.d.ts +104 -0
- package/src/services/ecies/crypto-core.d.ts.map +1 -0
- package/src/services/ecies/crypto-core.js +237 -0
- package/src/services/ecies/crypto-core.js.map +1 -0
- package/src/services/ecies/file.d.ts +30 -0
- package/src/services/ecies/file.d.ts.map +1 -0
- package/src/services/ecies/file.js +112 -0
- package/src/services/ecies/file.js.map +1 -0
- package/src/services/ecies/{index.ts → index.d.ts} +1 -0
- package/src/services/ecies/index.d.ts.map +1 -0
- package/src/services/ecies/index.js +11 -0
- package/src/services/ecies/index.js.map +1 -0
- package/src/services/ecies/multi-recipient.d.ts +84 -0
- package/src/services/ecies/multi-recipient.d.ts.map +1 -0
- package/src/services/ecies/multi-recipient.js +496 -0
- package/src/services/ecies/multi-recipient.js.map +1 -0
- package/src/services/ecies/service.d.ts +69 -0
- package/src/services/ecies/service.d.ts.map +1 -0
- package/src/services/ecies/service.js +144 -0
- package/src/services/ecies/service.js.map +1 -0
- package/src/services/ecies/signature.d.ts +38 -0
- package/src/services/ecies/signature.d.ts.map +1 -0
- package/src/services/ecies/signature.js +69 -0
- package/src/services/ecies/signature.js.map +1 -0
- package/src/services/ecies/single-recipient.d.ts +83 -0
- package/src/services/ecies/single-recipient.d.ts.map +1 -0
- package/src/services/ecies/single-recipient.js +447 -0
- package/src/services/ecies/single-recipient.js.map +1 -0
- package/src/services/ecies/utilities.d.ts +33 -0
- package/src/services/ecies/utilities.d.ts.map +1 -0
- package/src/services/ecies/utilities.js +91 -0
- package/src/services/ecies/utilities.js.map +1 -0
- package/src/services/encryption-stream.d.ts +33 -0
- package/src/services/encryption-stream.d.ts.map +1 -0
- package/src/services/encryption-stream.js +207 -0
- package/src/services/encryption-stream.js.map +1 -0
- package/src/services/{index.ts → index.d.ts} +1 -0
- package/src/services/index.d.ts.map +1 -0
- package/src/services/index.js +11 -0
- package/src/services/index.js.map +1 -0
- package/src/services/multi-recipient-processor.d.ts +72 -0
- package/src/services/multi-recipient-processor.d.ts.map +1 -0
- package/src/services/multi-recipient-processor.js +322 -0
- package/src/services/multi-recipient-processor.js.map +1 -0
- package/src/services/pbkdf2.d.ts +105 -0
- package/src/services/pbkdf2.d.ts.map +1 -0
- package/src/services/pbkdf2.js +189 -0
- package/src/services/pbkdf2.js.map +1 -0
- package/src/services/progress-tracker.d.ts +9 -0
- package/src/services/progress-tracker.d.ts.map +1 -0
- package/src/services/progress-tracker.js +41 -0
- package/src/services/progress-tracker.js.map +1 -0
- package/src/test-mocks/index.d.ts +2 -0
- package/src/test-mocks/index.d.ts.map +1 -0
- package/src/test-mocks/index.js +5 -0
- package/src/test-mocks/index.js.map +1 -0
- package/src/test-mocks/mock-backend-member.d.ts +71 -0
- package/src/test-mocks/mock-backend-member.d.ts.map +1 -0
- package/src/test-mocks/mock-backend-member.js +133 -0
- package/src/test-mocks/mock-backend-member.js.map +1 -0
- package/src/testing.d.ts +2 -0
- package/src/testing.d.ts.map +1 -0
- package/src/testing.js +6 -0
- package/src/testing.js.map +1 -0
- package/src/types/id-guards.d.ts +39 -0
- package/src/types/id-guards.d.ts.map +1 -0
- package/src/types/id-guards.js +91 -0
- package/src/types/id-guards.js.map +1 -0
- package/src/types/index.d.ts +2 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.js +5 -0
- package/src/types/index.js.map +1 -0
- package/src/{types.ts → types.d.ts} +9 -28
- package/src/types.d.ts.map +1 -0
- package/src/types.js +6 -0
- package/src/types.js.map +1 -0
- package/src/utils.d.ts +11 -0
- package/src/utils.d.ts.map +1 -0
- package/src/utils.js +82 -0
- package/src/utils.js.map +1 -0
- package/LICENSE +0 -21
- package/src/builders/ecies-builder.ts +0 -27
- package/src/builders/member-builder.ts +0 -158
- package/src/constants.ts +0 -251
- package/src/core/errors/crypto-error.ts +0 -10
- package/src/core/types/result.ts +0 -3
- package/src/enumerations/index.ts +0 -2
- package/src/enumerations/pbkdf2-profile.ts +0 -8
- package/src/i18n/ecies-i18n-factory.ts +0 -111
- package/src/i18n/node-ecies-i18n-setup.ts +0 -56
- package/src/i18n/node-keys.ts +0 -69
- package/src/i18n/translations/de.ts +0 -54
- package/src/i18n/translations/en-GB.ts +0 -83
- package/src/i18n/translations/en-US.ts +0 -88
- package/src/i18n/translations/es.ts +0 -54
- package/src/i18n/translations/fr.ts +0 -54
- package/src/i18n/translations/ja.ts +0 -54
- package/src/i18n/translations/uk.ts +0 -54
- package/src/i18n/translations/zh-cn.ts +0 -54
- package/src/interfaces/authenticated-cipher.ts +0 -10
- package/src/interfaces/authenticated-decipher.ts +0 -9
- package/src/interfaces/backend-member-operational.ts +0 -75
- package/src/interfaces/checksum-config.ts +0 -4
- package/src/interfaces/checksum-consts.ts +0 -13
- package/src/interfaces/constants.ts +0 -54
- package/src/interfaces/ecies-consts.ts +0 -99
- package/src/interfaces/encrypted-chunk.ts +0 -12
- package/src/interfaces/encryption-consts.ts +0 -10
- package/src/interfaces/keypair-buffer-with-un-encrypted-private-key.ts +0 -7
- package/src/interfaces/keyring-consts.ts +0 -5
- package/src/interfaces/member.ts +0 -76
- package/src/interfaces/multi-encrypted-parsed-header.ts +0 -28
- package/src/interfaces/multi-recipient-chunk.ts +0 -35
- package/src/interfaces/pbkdf2-result.ts +0 -5
- package/src/interfaces/signing-key-private-key-info.ts +0 -12
- package/src/interfaces/simple-public-key-only-buffer.ts +0 -3
- package/src/interfaces/simple-public-key-only.ts +0 -3
- package/src/interfaces/single-encrypted-parsed-header.ts +0 -35
- package/src/interfaces/stream-config.ts +0 -9
- package/src/interfaces/stream-progress.ts +0 -7
- package/src/interfaces/wrapped-key-consts.ts +0 -6
- package/src/lib/crypto-container.ts +0 -32
- package/src/lib/invariant-validator.ts +0 -124
- package/src/lib/invariants/recipient-id-consistency.ts +0 -77
- package/src/member.ts +0 -511
- package/src/services/aes-gcm.ts +0 -260
- package/src/services/chunk-processor.ts +0 -47
- package/src/services/ecies/crypto-core.ts +0 -319
- package/src/services/ecies/file.ts +0 -171
- package/src/services/ecies/multi-recipient.ts +0 -782
- package/src/services/ecies/service.ts +0 -316
- package/src/services/ecies/signature.ts +0 -91
- package/src/services/ecies/single-recipient.ts +0 -743
- package/src/services/ecies/utilities.ts +0 -128
- package/src/services/encryption-stream.ts +0 -432
- package/src/services/multi-recipient-processor.ts +0 -505
- package/src/services/pbkdf2.ts +0 -304
- package/src/services/progress-tracker.ts +0 -43
- package/src/test-mocks/index.ts +0 -1
- package/src/test-mocks/mock-backend-member.ts +0 -195
- package/src/testing.ts +0 -2
- package/src/types/id-guards.ts +0 -91
- package/src/types/index.ts +0 -1
- package/src/utils.ts +0 -124
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-recipient-chunk.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/multi-recipient-chunk.ts"],"names":[],"mappings":";;;AA2BO,MAAM,0BAA0B,GAAG,CAAC,eAAuB,EAA4B,EAAE,CAAC,CAAC;IAChG,KAAK,EAAE,UAAU,EAAE,SAAS;IAC5B,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,EAAE,EAAE,0CAA0C;IAC3D,cAAc,EAAE,CAAC,EAAE,6BAA6B;IAChD,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,KAAK;CACtB,CAAC,CAAC;AAPU,QAAA,0BAA0B,8BAOpC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IPbkdf2Config } from '@digitaldefiance/ecies-lib';
|
|
2
2
|
import type { Pbkdf2ProfileEnum } from '../enumerations/pbkdf2-profile';
|
|
3
|
-
|
|
4
3
|
export type PbkdfProfiles = {
|
|
5
|
-
|
|
4
|
+
[key in Pbkdf2ProfileEnum]: IPbkdf2Config;
|
|
6
5
|
};
|
|
6
|
+
//# sourceMappingURL=pbkdf-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf-profiles.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG;KACzB,GAAG,IAAI,iBAAiB,GAAG,aAAa;CAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf-profiles.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf-profiles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf2-result.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf2-result.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf2-result.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/pbkdf2-result.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ec } from 'elliptic';
|
|
2
|
+
import type { IKeyPairBufferWithUnEncryptedPrivateKey } from './keypair-buffer-with-un-encrypted-private-key';
|
|
3
|
+
export interface ISigningKeyPrivateKeyInfo extends IKeyPairBufferWithUnEncryptedPrivateKey {
|
|
4
|
+
keyPair: ec.KeyPair;
|
|
5
|
+
publicKey: Buffer;
|
|
6
|
+
privateKey: Buffer;
|
|
7
|
+
seedHex: string;
|
|
8
|
+
entropy: string;
|
|
9
|
+
mnemonic: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=signing-key-private-key-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing-key-private-key-info.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/signing-key-private-key-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,gDAAgD,CAAC;AAE9G,MAAM,WAAW,yBACf,SAAQ,uCAAuC;IAC/C,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing-key-private-key-info.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/signing-key-private-key-info.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ISimplePublicKeyOnlyBuffer } from './simple-public-key-only-buffer';
|
|
2
|
-
|
|
3
2
|
export interface ISimpleKeyPairBuffer extends ISimplePublicKeyOnlyBuffer {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
publicKey: Buffer;
|
|
4
|
+
privateKey: Buffer;
|
|
6
5
|
}
|
|
6
|
+
//# sourceMappingURL=simple-keypair-buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-keypair-buffer.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,WAAW,oBAAqB,SAAQ,0BAA0B;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-keypair-buffer.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair-buffer.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ISimplePublicKeyOnly } from './simple-public-key-only';
|
|
2
|
-
|
|
3
2
|
export interface ISimpleKeyPair extends ISimplePublicKeyOnly {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
publicKey: string;
|
|
4
|
+
privateKey: Buffer;
|
|
6
5
|
}
|
|
6
|
+
//# sourceMappingURL=simple-keypair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-keypair.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-keypair.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-keypair.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-public-key-only-buffer.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only-buffer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-public-key-only-buffer.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only-buffer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-public-key-only.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-public-key-only.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/simple-public-key-only.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EciesEncryptionTypeEnum } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for encrypted messages
|
|
4
|
+
*/
|
|
5
|
+
export interface ISingleEncryptedParsedHeader {
|
|
6
|
+
/**
|
|
7
|
+
* The optional preamble, if specified/relevant
|
|
8
|
+
*/
|
|
9
|
+
readonly preamble?: Buffer;
|
|
10
|
+
/**
|
|
11
|
+
* The encryption type used to encrypt the data
|
|
12
|
+
*/
|
|
13
|
+
readonly encryptionType: EciesEncryptionTypeEnum;
|
|
14
|
+
/**
|
|
15
|
+
* The ephemeral public key used to encrypt the data
|
|
16
|
+
*/
|
|
17
|
+
readonly ephemeralPublicKey: Buffer;
|
|
18
|
+
/**
|
|
19
|
+
* The initialization vector used to encrypt the data
|
|
20
|
+
*/
|
|
21
|
+
readonly iv: Buffer;
|
|
22
|
+
/**
|
|
23
|
+
* The authentication tag used to encrypt the data
|
|
24
|
+
*/
|
|
25
|
+
readonly authTag: Buffer;
|
|
26
|
+
/**
|
|
27
|
+
* The length of the encrypted data
|
|
28
|
+
*/
|
|
29
|
+
readonly dataLength: number;
|
|
30
|
+
/**
|
|
31
|
+
* The size of the encrypted data header
|
|
32
|
+
*/
|
|
33
|
+
readonly headerSize: number;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=single-encrypted-parsed-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-encrypted-parsed-header.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/single-encrypted-parsed-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC;IACjD;;OAEG;IACH,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-encrypted-parsed-header.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/single-encrypted-parsed-header.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-config.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,qBAAqB,EAAE,aAGnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-config.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-config.ts"],"names":[],"mappings":";;;AAKa,QAAA,qBAAqB,GAAkB;IAClD,SAAS,EAAE,KAAK,EAAE,OAAO;IACzB,gBAAgB,EAAE,KAAK;CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-progress.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-progress.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wBAAwB,EAAE,MAAM,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-progress.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/stream-progress.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SecureBuffer } from '@digitaldefiance/ecies-lib';
|
|
2
2
|
import { Wallet } from '@ethereumjs/wallet';
|
|
3
|
-
|
|
4
3
|
export interface IWalletSeed {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
wallet: Wallet;
|
|
5
|
+
seed: SecureBuffer;
|
|
7
6
|
}
|
|
7
|
+
//# sourceMappingURL=wallet-seed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-seed.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wallet-seed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,YAAY,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-seed.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wallet-seed.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapped-key-consts.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wrapped-key-consts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapped-key-consts.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/interfaces/wrapped-key-consts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IConstants } from '../interfaces/constants';
|
|
2
|
+
export declare enum CryptoServiceKey {
|
|
3
|
+
ECIES = "ecies",
|
|
4
|
+
PBKDF2 = "pbkdf2",
|
|
5
|
+
AES_GCM = "aes-gcm"
|
|
6
|
+
}
|
|
7
|
+
export declare class CryptoContainer {
|
|
8
|
+
private services;
|
|
9
|
+
private constructor();
|
|
10
|
+
static create(config?: IConstants): CryptoContainer;
|
|
11
|
+
get<T>(key: CryptoServiceKey): T;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=crypto-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-container.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/crypto-container.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAwC;IAExD,OAAO;IASP,MAAM,CAAC,MAAM,CAAC,MAAM,GAAE,UAAsB,GAAG,eAAe;IAI9D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,GAAG,CAAC;CAGjC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoContainer = exports.CryptoServiceKey = void 0;
|
|
4
|
+
const ecies_1 = require("../services/ecies");
|
|
5
|
+
const pbkdf2_1 = require("../services/pbkdf2");
|
|
6
|
+
const aes_gcm_1 = require("../services/aes-gcm");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
var CryptoServiceKey;
|
|
9
|
+
(function (CryptoServiceKey) {
|
|
10
|
+
CryptoServiceKey["ECIES"] = "ecies";
|
|
11
|
+
CryptoServiceKey["PBKDF2"] = "pbkdf2";
|
|
12
|
+
CryptoServiceKey["AES_GCM"] = "aes-gcm";
|
|
13
|
+
})(CryptoServiceKey || (exports.CryptoServiceKey = CryptoServiceKey = {}));
|
|
14
|
+
class CryptoContainer {
|
|
15
|
+
services = new Map();
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.services.set(CryptoServiceKey.ECIES, new ecies_1.ECIESService(undefined, config.ECIES));
|
|
18
|
+
this.services.set(CryptoServiceKey.PBKDF2, new pbkdf2_1.Pbkdf2Service(config.PBKDF2_PROFILES, config.ECIES, config.PBKDF2));
|
|
19
|
+
this.services.set(CryptoServiceKey.AES_GCM, new aes_gcm_1.AESGCMService(config));
|
|
20
|
+
}
|
|
21
|
+
static create(config = constants_1.Constants) {
|
|
22
|
+
return new CryptoContainer(config);
|
|
23
|
+
}
|
|
24
|
+
get(key) {
|
|
25
|
+
return this.services.get(key);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.CryptoContainer = CryptoContainer;
|
|
29
|
+
//# sourceMappingURL=crypto-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-container.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/crypto-container.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AACjD,+CAAmD;AACnD,iDAAoD;AAEpD,4CAAyC;AAEzC,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B;AAED,MAAa,eAAe;IAClB,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IAExD,YAAoB,MAAkB;QACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,oBAAY,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,QAAQ,CAAC,GAAG,CACf,gBAAgB,CAAC,MAAM,EACvB,IAAI,sBAAa,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CACvE,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,uBAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,SAAqB,qBAAS;QAC1C,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,GAAG,CAAI,GAAqB;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAM,CAAC;IACrC,CAAC;CACF;AAnBD,0CAmBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
package/src/lib/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./crypto-container"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./invariant-validator"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./invariants"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,gEAAsC;AACtC,uDAA6B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { IInvariant } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
import { IConstants } from '../interfaces/constants';
|
|
3
|
+
/**
|
|
4
|
+
* Node.js-specific invariant validator.
|
|
5
|
+
*
|
|
6
|
+
* Extends the base ecies-lib validator with Node.js-specific invariants.
|
|
7
|
+
* Validates configuration consistency to prevent bugs like the 12 vs 32-byte
|
|
8
|
+
* recipient ID discrepancy.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { InvariantValidator } from '@digitaldefiance/node-ecies-lib';
|
|
13
|
+
* import { MyCustomInvariant } from './my-invariants';
|
|
14
|
+
*
|
|
15
|
+
* // Register a custom invariant
|
|
16
|
+
* InvariantValidator.registerInvariant(new MyCustomInvariant());
|
|
17
|
+
*
|
|
18
|
+
* // Validate configuration
|
|
19
|
+
* InvariantValidator.validateAll(config); // throws if any invariant fails
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class InvariantValidator {
|
|
23
|
+
/**
|
|
24
|
+
* Node-specific invariants registered by default.
|
|
25
|
+
*/
|
|
26
|
+
private static readonly NODE_DEFAULT_INVARIANTS;
|
|
27
|
+
private static customInvariants;
|
|
28
|
+
/**
|
|
29
|
+
* Register a custom invariant to be checked during validation.
|
|
30
|
+
*
|
|
31
|
+
* @param invariant - The invariant to register
|
|
32
|
+
*/
|
|
33
|
+
static registerInvariant(invariant: IInvariant): void;
|
|
34
|
+
/**
|
|
35
|
+
* Unregister a custom invariant by name.
|
|
36
|
+
*
|
|
37
|
+
* @param name - The name of the invariant to unregister
|
|
38
|
+
* @returns true if the invariant was found and removed, false otherwise
|
|
39
|
+
*/
|
|
40
|
+
static unregisterInvariant(name: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Get all registered invariants (default + custom).
|
|
43
|
+
*/
|
|
44
|
+
static getAllInvariants(): readonly IInvariant[];
|
|
45
|
+
/**
|
|
46
|
+
* Validate all registered invariants against a configuration.
|
|
47
|
+
*
|
|
48
|
+
* This checks both:
|
|
49
|
+
* - Base ecies-lib invariants (via BaseInvariantValidator)
|
|
50
|
+
* - Node-specific invariants
|
|
51
|
+
*
|
|
52
|
+
* @param config - The configuration to validate
|
|
53
|
+
* @throws Error if any invariant check fails
|
|
54
|
+
*/
|
|
55
|
+
static validateAll(config: IConstants): void;
|
|
56
|
+
/**
|
|
57
|
+
* Clear all custom invariants.
|
|
58
|
+
* Default invariants are not affected.
|
|
59
|
+
*/
|
|
60
|
+
static clearCustomInvariants(): void;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=invariant-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant-validator.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariant-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAE7C;IAEF,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAoB;IAEnD;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;IAMrD;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IASjD;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,SAAS,UAAU,EAAE;IAIhD;;;;;;;;;OASG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAkC5C;;;OAGG;IACH,MAAM,CAAC,qBAAqB,IAAI,IAAI;CAGrC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvariantValidator = void 0;
|
|
4
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
5
|
+
const i18n_lib_1 = require("@digitaldefiance/i18n-lib");
|
|
6
|
+
const recipient_id_consistency_1 = require("./invariants/recipient-id-consistency");
|
|
7
|
+
const node_keys_1 = require("../i18n/node-keys");
|
|
8
|
+
const node_ecies_i18n_setup_1 = require("../i18n/node-ecies-i18n-setup");
|
|
9
|
+
/**
|
|
10
|
+
* Node.js-specific invariant validator.
|
|
11
|
+
*
|
|
12
|
+
* Extends the base ecies-lib validator with Node.js-specific invariants.
|
|
13
|
+
* Validates configuration consistency to prevent bugs like the 12 vs 32-byte
|
|
14
|
+
* recipient ID discrepancy.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { InvariantValidator } from '@digitaldefiance/node-ecies-lib';
|
|
19
|
+
* import { MyCustomInvariant } from './my-invariants';
|
|
20
|
+
*
|
|
21
|
+
* // Register a custom invariant
|
|
22
|
+
* InvariantValidator.registerInvariant(new MyCustomInvariant());
|
|
23
|
+
*
|
|
24
|
+
* // Validate configuration
|
|
25
|
+
* InvariantValidator.validateAll(config); // throws if any invariant fails
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
class InvariantValidator {
|
|
29
|
+
/**
|
|
30
|
+
* Node-specific invariants registered by default.
|
|
31
|
+
*/
|
|
32
|
+
static NODE_DEFAULT_INVARIANTS = [
|
|
33
|
+
new recipient_id_consistency_1.RecipientIdConsistencyInvariant(),
|
|
34
|
+
];
|
|
35
|
+
static customInvariants = [];
|
|
36
|
+
/**
|
|
37
|
+
* Register a custom invariant to be checked during validation.
|
|
38
|
+
*
|
|
39
|
+
* @param invariant - The invariant to register
|
|
40
|
+
*/
|
|
41
|
+
static registerInvariant(invariant) {
|
|
42
|
+
this.customInvariants.push(invariant);
|
|
43
|
+
// Also register with base validator for consistency
|
|
44
|
+
ecies_lib_1.InvariantValidator.registerInvariant(invariant);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Unregister a custom invariant by name.
|
|
48
|
+
*
|
|
49
|
+
* @param name - The name of the invariant to unregister
|
|
50
|
+
* @returns true if the invariant was found and removed, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
static unregisterInvariant(name) {
|
|
53
|
+
const index = this.customInvariants.findIndex((inv) => inv.name === name);
|
|
54
|
+
if (index === -1) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
this.customInvariants.splice(index, 1);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get all registered invariants (default + custom).
|
|
62
|
+
*/
|
|
63
|
+
static getAllInvariants() {
|
|
64
|
+
return [...this.NODE_DEFAULT_INVARIANTS, ...this.customInvariants];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate all registered invariants against a configuration.
|
|
68
|
+
*
|
|
69
|
+
* This checks both:
|
|
70
|
+
* - Base ecies-lib invariants (via BaseInvariantValidator)
|
|
71
|
+
* - Node-specific invariants
|
|
72
|
+
*
|
|
73
|
+
* @param config - The configuration to validate
|
|
74
|
+
* @throws Error if any invariant check fails
|
|
75
|
+
*/
|
|
76
|
+
static validateAll(config) {
|
|
77
|
+
const failures = [];
|
|
78
|
+
// First, validate base ecies-lib invariants, excluding the one we are replacing
|
|
79
|
+
const baseInvariants = ecies_lib_1.InvariantValidator.getAllInvariants();
|
|
80
|
+
for (const invariant of baseInvariants) {
|
|
81
|
+
if (invariant.name === 'RecipientIdConsistency') {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (!invariant.check(config)) {
|
|
85
|
+
failures.push(invariant.errorMessage(config));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Then validate Node-specific invariants
|
|
89
|
+
for (const invariant of this.getAllInvariants()) {
|
|
90
|
+
if (!invariant.check(config)) {
|
|
91
|
+
failures.push(invariant.errorMessage(config));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (failures.length > 0) {
|
|
95
|
+
const engine = (0, node_ecies_i18n_setup_1.getNodeEciesI18nEngine)();
|
|
96
|
+
throw i18n_lib_1.TranslatableGenericError.withEngine(engine, node_keys_1.NodeEciesComponentId, node_keys_1.NodeEciesStringKey.Error_Invariant_ConfigurationValidationFailedTemplate, { failures: failures.join('\n\n') }, undefined, { invariantCount: failures.length });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Clear all custom invariants.
|
|
101
|
+
* Default invariants are not affected.
|
|
102
|
+
*/
|
|
103
|
+
static clearCustomInvariants() {
|
|
104
|
+
this.customInvariants = [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.InvariantValidator = InvariantValidator;
|
|
108
|
+
//# sourceMappingURL=invariant-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant-validator.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariant-validator.ts"],"names":[],"mappings":";;;AAAA,0DAGoC;AACpC,wDAAqE;AAErE,oFAAwF;AACxF,iDAA6E;AAC7E,yEAAuE;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,kBAAkB;IAC7B;;OAEG;IACK,MAAM,CAAU,uBAAuB,GAAiB;QAC9D,IAAI,0DAA+B,EAAE;KACtC,CAAC;IAEM,MAAM,CAAC,gBAAgB,GAAiB,EAAE,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAqB;QAC5C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,oDAAoD;QACpD,8BAAsB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAY;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAC1E,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACrB,OAAO,CAAC,GAAG,IAAI,CAAC,uBAAuB,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,WAAW,CAAC,MAAkB;QACnC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,gFAAgF;QAChF,MAAM,cAAc,GAAG,8BAAsB,CAAC,gBAAgB,EAAE,CAAC;QACjE,KAAK,MAAM,SAAS,IAAI,cAAc,EAAE,CAAC;YACvC,IAAI,SAAS,CAAC,IAAI,KAAK,wBAAwB,EAAE,CAAC;gBAChD,SAAS;YACX,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;QAED,yCAAyC;QACzC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;YAChD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,IAAA,8CAAsB,GAAE,CAAC;YACxC,MAAM,mCAAwB,CAAC,UAAU,CACvC,MAAM,EACN,gCAAoB,EACpB,8BAAkB,CAAC,qDAAqD,EACxE,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EACnC,SAAS,EACT,EAAE,cAAc,EAAE,QAAQ,CAAC,MAAM,EAAE,CACpC,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,qBAAqB;QAC1B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC7B,CAAC;;AA7FH,gDA8FC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node.js-specific invariants for configuration validation.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* These invariants extend and complement the base ecies-lib invariants
|
|
5
5
|
* with Node.js-specific validation rules.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
export { RecipientIdConsistencyInvariant } from './recipient-id-consistency';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariants/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Node.js-specific invariants for configuration validation.
|
|
4
|
+
*
|
|
5
|
+
* These invariants extend and complement the base ecies-lib invariants
|
|
6
|
+
* with Node.js-specific validation rules.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RecipientIdConsistencyInvariant = void 0;
|
|
10
|
+
var recipient_id_consistency_1 = require("./recipient-id-consistency");
|
|
11
|
+
Object.defineProperty(exports, "RecipientIdConsistencyInvariant", { enumerable: true, get: function () { return recipient_id_consistency_1.RecipientIdConsistencyInvariant; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/invariants/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uEAA6E;AAApE,2IAAA,+BAA+B,OAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseInvariant } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
import { IConstants } from '../../interfaces/constants';
|
|
3
|
+
/**
|
|
4
|
+
* Node.js-specific recipient ID consistency invariant.
|
|
5
|
+
*
|
|
6
|
+
* Extends the base ecies-lib invariant to also validate node-specific
|
|
7
|
+
* ENCRYPTION.RECIPIENT_ID_SIZE constant.
|
|
8
|
+
*
|
|
9
|
+
* This invariant would have caught the 12 vs 32 byte discrepancy.
|
|
10
|
+
*
|
|
11
|
+
* Checks:
|
|
12
|
+
* - MEMBER_ID_LENGTH === idProvider.byteLength
|
|
13
|
+
* - ECIES.MULTIPLE.RECIPIENT_ID_SIZE === idProvider.byteLength
|
|
14
|
+
* - ENCRYPTION.RECIPIENT_ID_SIZE === idProvider.byteLength (Node-specific)
|
|
15
|
+
* - All values must be in sync
|
|
16
|
+
*/
|
|
17
|
+
export declare class RecipientIdConsistencyInvariant extends BaseInvariant {
|
|
18
|
+
constructor();
|
|
19
|
+
check(config: IConstants): boolean;
|
|
20
|
+
errorMessage(config: IConstants): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=recipient-id-consistency.d.ts.map
|