@digitaldefiance/node-ecies-lib 1.0.0
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/LICENSE +21 -0
- package/dist/constants.d.ts +29 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +129 -0
- package/dist/constants.js.map +1 -0
- package/dist/enumerations/index.d.ts +2 -0
- package/dist/enumerations/index.d.ts.map +1 -0
- package/dist/enumerations/index.js +2 -0
- package/dist/enumerations/index.js.map +1 -0
- package/dist/enumerations/pbkdf2-profile.d.ts +8 -0
- package/dist/enumerations/pbkdf2-profile.d.ts.map +1 -0
- package/dist/enumerations/pbkdf2-profile.js +9 -0
- package/dist/enumerations/pbkdf2-profile.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/authenticated-cipher.d.ts +10 -0
- package/dist/interfaces/authenticated-cipher.d.ts.map +1 -0
- package/dist/interfaces/authenticated-cipher.js +2 -0
- package/dist/interfaces/authenticated-cipher.js.map +1 -0
- package/dist/interfaces/authenticated-decipher.d.ts +9 -0
- package/dist/interfaces/authenticated-decipher.d.ts.map +1 -0
- package/dist/interfaces/authenticated-decipher.js +2 -0
- package/dist/interfaces/authenticated-decipher.js.map +1 -0
- package/dist/interfaces/checksum-config.d.ts +5 -0
- package/dist/interfaces/checksum-config.d.ts.map +1 -0
- package/dist/interfaces/checksum-config.js +2 -0
- package/dist/interfaces/checksum-config.js.map +1 -0
- package/dist/interfaces/checksum-consts.d.ts +11 -0
- package/dist/interfaces/checksum-consts.d.ts.map +1 -0
- package/dist/interfaces/checksum-consts.js +2 -0
- package/dist/interfaces/checksum-consts.js.map +1 -0
- package/dist/interfaces/constants.d.ts +42 -0
- package/dist/interfaces/constants.d.ts.map +1 -0
- package/dist/interfaces/constants.js +2 -0
- package/dist/interfaces/constants.js.map +1 -0
- package/dist/interfaces/ecies-consts.d.ts +88 -0
- package/dist/interfaces/ecies-consts.d.ts.map +1 -0
- package/dist/interfaces/ecies-consts.js +2 -0
- package/dist/interfaces/ecies-consts.js.map +1 -0
- package/dist/interfaces/encryption-consts.d.ts +11 -0
- package/dist/interfaces/encryption-consts.d.ts.map +1 -0
- package/dist/interfaces/encryption-consts.js +2 -0
- package/dist/interfaces/encryption-consts.js.map +1 -0
- package/dist/interfaces/fec-consts.d.ts +5 -0
- package/dist/interfaces/fec-consts.d.ts.map +1 -0
- package/dist/interfaces/fec-consts.js +2 -0
- package/dist/interfaces/fec-consts.js.map +1 -0
- package/dist/interfaces/index.d.ts +18 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +18 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts +6 -0
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.d.ts.map +1 -0
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js +2 -0
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js.map +1 -0
- package/dist/interfaces/keyring-consts.d.ts +6 -0
- package/dist/interfaces/keyring-consts.d.ts.map +1 -0
- package/dist/interfaces/keyring-consts.js +2 -0
- package/dist/interfaces/keyring-consts.js.map +1 -0
- package/dist/interfaces/member-operational.d.ts +36 -0
- package/dist/interfaces/member-operational.d.ts.map +1 -0
- package/dist/interfaces/member-operational.js +2 -0
- package/dist/interfaces/member-operational.js.map +1 -0
- package/dist/interfaces/member-with-mnemonic.d.ts +7 -0
- package/dist/interfaces/member-with-mnemonic.d.ts.map +1 -0
- package/dist/interfaces/member-with-mnemonic.js +2 -0
- package/dist/interfaces/member-with-mnemonic.js.map +1 -0
- package/dist/interfaces/multi-encrypted-message.d.ts +8 -0
- package/dist/interfaces/multi-encrypted-message.d.ts.map +1 -0
- package/dist/interfaces/multi-encrypted-message.js +2 -0
- package/dist/interfaces/multi-encrypted-message.js.map +1 -0
- package/dist/interfaces/multi-encrypted-parsed-header.d.ts +24 -0
- package/dist/interfaces/multi-encrypted-parsed-header.d.ts.map +1 -0
- package/dist/interfaces/multi-encrypted-parsed-header.js +2 -0
- package/dist/interfaces/multi-encrypted-parsed-header.js.map +1 -0
- package/dist/interfaces/pbkdf-profiles.d.ts +6 -0
- package/dist/interfaces/pbkdf-profiles.d.ts.map +1 -0
- package/dist/interfaces/pbkdf-profiles.js +2 -0
- package/dist/interfaces/pbkdf-profiles.js.map +1 -0
- package/dist/interfaces/signing-key-private-key-info.d.ts +11 -0
- package/dist/interfaces/signing-key-private-key-info.d.ts.map +1 -0
- package/dist/interfaces/signing-key-private-key-info.js +2 -0
- package/dist/interfaces/signing-key-private-key-info.js.map +1 -0
- package/dist/interfaces/simple-keypair-buffer.d.ts +6 -0
- package/dist/interfaces/simple-keypair-buffer.d.ts.map +1 -0
- package/dist/interfaces/simple-keypair-buffer.js +2 -0
- package/dist/interfaces/simple-keypair-buffer.js.map +1 -0
- package/dist/interfaces/simple-keypair.d.ts +6 -0
- package/dist/interfaces/simple-keypair.d.ts.map +1 -0
- package/dist/interfaces/simple-keypair.js +2 -0
- package/dist/interfaces/simple-keypair.js.map +1 -0
- package/dist/interfaces/simple-public-key-only-buffer.d.ts +4 -0
- package/dist/interfaces/simple-public-key-only-buffer.d.ts.map +1 -0
- package/dist/interfaces/simple-public-key-only-buffer.js +2 -0
- package/dist/interfaces/simple-public-key-only-buffer.js.map +1 -0
- package/dist/interfaces/simple-public-key-only.d.ts +4 -0
- package/dist/interfaces/simple-public-key-only.d.ts.map +1 -0
- package/dist/interfaces/simple-public-key-only.js +2 -0
- package/dist/interfaces/simple-public-key-only.js.map +1 -0
- package/dist/interfaces/single-encrypted-parsed-header.d.ts +35 -0
- package/dist/interfaces/single-encrypted-parsed-header.d.ts.map +1 -0
- package/dist/interfaces/single-encrypted-parsed-header.js +2 -0
- package/dist/interfaces/single-encrypted-parsed-header.js.map +1 -0
- package/dist/interfaces/wallet-seed.d.ts +7 -0
- package/dist/interfaces/wallet-seed.d.ts.map +1 -0
- package/dist/interfaces/wallet-seed.js +2 -0
- package/dist/interfaces/wallet-seed.js.map +1 -0
- package/dist/interfaces/wrapped-key-consts.d.ts +7 -0
- package/dist/interfaces/wrapped-key-consts.d.ts.map +1 -0
- package/dist/interfaces/wrapped-key-consts.js +2 -0
- package/dist/interfaces/wrapped-key-consts.js.map +1 -0
- package/dist/member.d.ts +67 -0
- package/dist/member.d.ts.map +1 -0
- package/dist/member.js +256 -0
- package/dist/member.js.map +1 -0
- package/dist/services/ecies/crypto-core.d.ts +55 -0
- package/dist/services/ecies/crypto-core.d.ts.map +1 -0
- package/dist/services/ecies/crypto-core.debug.d.ts +13 -0
- package/dist/services/ecies/crypto-core.debug.d.ts.map +1 -0
- package/dist/services/ecies/crypto-core.debug.js +91 -0
- package/dist/services/ecies/crypto-core.debug.js.map +1 -0
- package/dist/services/ecies/crypto-core.js +115 -0
- package/dist/services/ecies/crypto-core.js.map +1 -0
- package/dist/services/ecies/debug-aes-gcm.d.ts +2 -0
- package/dist/services/ecies/debug-aes-gcm.d.ts.map +1 -0
- package/dist/services/ecies/debug-aes-gcm.js +106 -0
- package/dist/services/ecies/debug-aes-gcm.js.map +1 -0
- package/dist/services/ecies/debug-ecdh.d.ts +2 -0
- package/dist/services/ecies/debug-ecdh.d.ts.map +1 -0
- package/dist/services/ecies/debug-ecdh.js +123 -0
- package/dist/services/ecies/debug-ecdh.js.map +1 -0
- package/dist/services/ecies/debug-ecies-burnbag.d.ts +2 -0
- package/dist/services/ecies/debug-ecies-burnbag.d.ts.map +1 -0
- package/dist/services/ecies/debug-ecies-burnbag.js +134 -0
- package/dist/services/ecies/debug-ecies-burnbag.js.map +1 -0
- package/dist/services/ecies/debug-ecies.d.ts +2 -0
- package/dist/services/ecies/debug-ecies.d.ts.map +1 -0
- package/dist/services/ecies/debug-ecies.js +110 -0
- package/dist/services/ecies/debug-ecies.js.map +1 -0
- package/dist/services/ecies/debug-test.d.ts +2 -0
- package/dist/services/ecies/debug-test.d.ts.map +1 -0
- package/dist/services/ecies/debug-test.js +57 -0
- package/dist/services/ecies/debug-test.js.map +1 -0
- package/dist/services/ecies/file.d.ts +15 -0
- package/dist/services/ecies/file.d.ts.map +1 -0
- package/dist/services/ecies/file.js +104 -0
- package/dist/services/ecies/file.js.map +1 -0
- package/dist/services/ecies/index.d.ts +8 -0
- package/dist/services/ecies/index.d.ts.map +1 -0
- package/dist/services/ecies/index.js +8 -0
- package/dist/services/ecies/index.js.map +1 -0
- package/dist/services/ecies/multi-recipient.d.ts +83 -0
- package/dist/services/ecies/multi-recipient.d.ts.map +1 -0
- package/dist/services/ecies/multi-recipient.js +355 -0
- package/dist/services/ecies/multi-recipient.js.map +1 -0
- package/dist/services/ecies/service.d.ts +70 -0
- package/dist/services/ecies/service.d.ts.map +1 -0
- package/dist/services/ecies/service.js +145 -0
- package/dist/services/ecies/service.js.map +1 -0
- package/dist/services/ecies/signature.d.ts +38 -0
- package/dist/services/ecies/signature.d.ts.map +1 -0
- package/dist/services/ecies/signature.js +64 -0
- package/dist/services/ecies/signature.js.map +1 -0
- package/dist/services/ecies/single-recipient.d.ts +85 -0
- package/dist/services/ecies/single-recipient.d.ts.map +1 -0
- package/dist/services/ecies/single-recipient.js +390 -0
- package/dist/services/ecies/single-recipient.js.map +1 -0
- package/dist/services/ecies/utilities.d.ts +22 -0
- package/dist/services/ecies/utilities.d.ts.map +1 -0
- package/dist/services/ecies/utilities.js +65 -0
- package/dist/services/ecies/utilities.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring-consts.js","sourceRoot":"","sources":["../../src/interfaces/keyring-consts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EmailString, MemberType, SecureBuffer, SecureString } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
import { Wallet } from '@ethereumjs/wallet';
|
|
3
|
+
import { Types } from 'mongoose';
|
|
4
|
+
import { SignatureBuffer } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Operational interface for member - defines getters and methods
|
|
7
|
+
*/
|
|
8
|
+
export interface IMemberOperational<I extends string | Types.ObjectId> {
|
|
9
|
+
get id(): I;
|
|
10
|
+
get type(): MemberType;
|
|
11
|
+
get name(): string;
|
|
12
|
+
get email(): EmailString;
|
|
13
|
+
get publicKey(): Uint8Array;
|
|
14
|
+
get creatorId(): I;
|
|
15
|
+
get dateCreated(): Date;
|
|
16
|
+
get dateUpdated(): Date;
|
|
17
|
+
get privateKey(): SecureBuffer | undefined;
|
|
18
|
+
get wallet(): Wallet | undefined;
|
|
19
|
+
get hasPrivateKey(): boolean;
|
|
20
|
+
sign(data: Buffer): SignatureBuffer;
|
|
21
|
+
verify(signature: SignatureBuffer, data: Buffer): boolean;
|
|
22
|
+
encryptData(data: string | Buffer): Uint8Array;
|
|
23
|
+
decryptData(encryptedData: Buffer): Uint8Array;
|
|
24
|
+
toJson(): string;
|
|
25
|
+
loadWallet(mnemonic: SecureString): void;
|
|
26
|
+
unloadPrivateKey(): void;
|
|
27
|
+
unloadWallet(): void;
|
|
28
|
+
unloadWalletAndPrivateKey(): void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Extended operational interface for test members
|
|
32
|
+
*/
|
|
33
|
+
export interface ITestBrightChainMemberOperational extends IMemberOperational<Types.ObjectId> {
|
|
34
|
+
get mnemonic(): SecureString | undefined;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=member-operational.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-operational.d.ts","sourceRoot":"","sources":["../../src/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;AACH,MAAM,WAAW,iCACf,SAAQ,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC1C,IAAI,QAAQ,IAAI,YAAY,GAAG,SAAS,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-operational.js","sourceRoot":"","sources":["../../src/interfaces/member-operational.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-with-mnemonic.d.ts","sourceRoot":"","sources":["../../src/interfaces/member-with-mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-with-mnemonic.js","sourceRoot":"","sources":["../../src/interfaces/member-with-mnemonic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IMultiEncryptedParsedHeader } from './multi-encrypted-parsed-header';
|
|
2
|
+
export interface IMultiEncryptedMessage extends IMultiEncryptedParsedHeader {
|
|
3
|
+
/**
|
|
4
|
+
* The encrypted message.
|
|
5
|
+
*/
|
|
6
|
+
readonly encryptedMessage: Buffer;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=multi-encrypted-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-encrypted-message.d.ts","sourceRoot":"","sources":["../../src/interfaces/multi-encrypted-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,MAAM,WAAW,sBAAuB,SAAQ,2BAA2B;IACzE;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-encrypted-message.js","sourceRoot":"","sources":["../../src/interfaces/multi-encrypted-message.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Types } from 'mongoose';
|
|
2
|
+
export interface IMultiEncryptedParsedHeader {
|
|
3
|
+
/**
|
|
4
|
+
* The length of the data before encryption
|
|
5
|
+
*/
|
|
6
|
+
readonly dataLength: number;
|
|
7
|
+
/**
|
|
8
|
+
* The number of recipients
|
|
9
|
+
*/
|
|
10
|
+
readonly recipientCount: number;
|
|
11
|
+
/**
|
|
12
|
+
* The IDs of the recipients
|
|
13
|
+
*/
|
|
14
|
+
readonly recipientIds: Types.ObjectId[];
|
|
15
|
+
/**
|
|
16
|
+
* An encrypted version of the symmetric key for each recipient
|
|
17
|
+
*/
|
|
18
|
+
readonly recipientKeys: Buffer[];
|
|
19
|
+
/**
|
|
20
|
+
* The size of the header, up to the encrypted message start (excludes encrypted message IV+auth tag)
|
|
21
|
+
*/
|
|
22
|
+
readonly headerSize: number;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=multi-encrypted-parsed-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-encrypted-parsed-header.d.ts","sourceRoot":"","sources":["../../src/interfaces/multi-encrypted-parsed-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-encrypted-parsed-header.js","sourceRoot":"","sources":["../../src/interfaces/multi-encrypted-parsed-header.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf-profiles.d.ts","sourceRoot":"","sources":["../../src/interfaces/pbkdf-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG;KACzB,GAAG,IAAI,iBAAiB,GAAG,aAAa;CAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbkdf-profiles.js","sourceRoot":"","sources":["../../src/interfaces/pbkdf-profiles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ec } from 'elliptic';
|
|
2
|
+
import { 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":["../../src/interfaces/signing-key-private-key-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,uCAAuC,EAAE,MAAM,gDAAgD,CAAC;AAEzG,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":["../../src/interfaces/signing-key-private-key-info.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-keypair-buffer.d.ts","sourceRoot":"","sources":["../../src/interfaces/simple-keypair-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,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":["../../src/interfaces/simple-keypair-buffer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-keypair.d.ts","sourceRoot":"","sources":["../../src/interfaces/simple-keypair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,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":["../../src/interfaces/simple-keypair.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-public-key-only-buffer.d.ts","sourceRoot":"","sources":["../../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":["../../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":["../../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":["../../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":["../../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":["../../src/interfaces/single-encrypted-parsed-header.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-seed.d.ts","sourceRoot":"","sources":["../../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":["../../src/interfaces/wallet-seed.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapped-key-consts.d.ts","sourceRoot":"","sources":["../../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":["../../src/interfaces/wrapped-key-consts.ts"],"names":[],"mappings":""}
|
package/dist/member.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { EmailString, MemberType, SecureBuffer, SecureString } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
import { Wallet } from '@ethereumjs/wallet';
|
|
3
|
+
import { ECIESService } from './services/ecies/service';
|
|
4
|
+
import { Types } from 'mongoose';
|
|
5
|
+
import { IMemberOperational } from './interfaces/member-operational';
|
|
6
|
+
import { SignatureBuffer } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* A member of Brightchain.
|
|
9
|
+
* In the Owner Free Filesystem (OFF), members are used to:
|
|
10
|
+
* 1. Sign and verify data
|
|
11
|
+
* 2. Encrypt and decrypt data
|
|
12
|
+
* 3. Participate in voting
|
|
13
|
+
* 4. Establish ownership of data
|
|
14
|
+
*/
|
|
15
|
+
export declare class Member implements IMemberOperational<Types.ObjectId> {
|
|
16
|
+
private readonly _eciesService;
|
|
17
|
+
private readonly _id;
|
|
18
|
+
private readonly _type;
|
|
19
|
+
private readonly _name;
|
|
20
|
+
private readonly _email;
|
|
21
|
+
private readonly _publicKey;
|
|
22
|
+
private readonly _creatorId;
|
|
23
|
+
private readonly _dateCreated;
|
|
24
|
+
private readonly _dateUpdated;
|
|
25
|
+
private _privateKey?;
|
|
26
|
+
private _wallet?;
|
|
27
|
+
constructor(eciesService: ECIESService, type: MemberType, name: string, email: EmailString, publicKey: Buffer, privateKey?: SecureBuffer, wallet?: Wallet, id?: Types.ObjectId, dateCreated?: Date, dateUpdated?: Date, creatorId?: Types.ObjectId);
|
|
28
|
+
get id(): Types.ObjectId;
|
|
29
|
+
get type(): MemberType;
|
|
30
|
+
get name(): string;
|
|
31
|
+
get email(): EmailString;
|
|
32
|
+
get publicKey(): Buffer;
|
|
33
|
+
get creatorId(): Types.ObjectId;
|
|
34
|
+
get dateCreated(): Date;
|
|
35
|
+
get dateUpdated(): Date;
|
|
36
|
+
get privateKey(): SecureBuffer | undefined;
|
|
37
|
+
get wallet(): Wallet;
|
|
38
|
+
get hasPrivateKey(): boolean;
|
|
39
|
+
unloadPrivateKey(): void;
|
|
40
|
+
unloadWallet(): void;
|
|
41
|
+
unloadWalletAndPrivateKey(): void;
|
|
42
|
+
loadWallet(mnemonic: SecureString): void;
|
|
43
|
+
/**
|
|
44
|
+
* Loads the private key and optionally the voting private key.
|
|
45
|
+
*
|
|
46
|
+
* @param privateKey The private key to load.
|
|
47
|
+
* @param votingPrivateKey The voting private key to load.
|
|
48
|
+
*/
|
|
49
|
+
loadPrivateKey(privateKey: SecureBuffer): void;
|
|
50
|
+
sign(data: Buffer): SignatureBuffer;
|
|
51
|
+
signData(data: Buffer): SignatureBuffer;
|
|
52
|
+
verify(signature: SignatureBuffer, data: Buffer): boolean;
|
|
53
|
+
verifySignature(data: Buffer, signature: Buffer, publicKey: Buffer): boolean;
|
|
54
|
+
private static readonly MAX_ENCRYPTION_SIZE;
|
|
55
|
+
private static readonly VALID_STRING_REGEX;
|
|
56
|
+
encryptData(data: string | Buffer, recipientPublicKey?: Buffer): Buffer;
|
|
57
|
+
decryptData(encryptedData: Buffer): Buffer;
|
|
58
|
+
toJson(): string;
|
|
59
|
+
dispose(): void;
|
|
60
|
+
static fromJson(json: string, eciesService: ECIESService): Member;
|
|
61
|
+
static fromMnemonic(mnemonic: SecureString, eciesService: ECIESService): Member;
|
|
62
|
+
static newMember(eciesService: ECIESService, type: MemberType, name: string, email: EmailString, forceMnemonic?: SecureString, createdBy?: Types.ObjectId): {
|
|
63
|
+
member: Member;
|
|
64
|
+
mnemonic: SecureString;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=member.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../src/member.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAKX,UAAU,EACV,YAAY,EACZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;GAOG;AACH,qBAAa,MAAO,YAAW,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC/D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAC7C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAiB;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,QAAQ,CAAC,Y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