@sebastienrousseau/crypto-lib 0.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © Sebastien Rousseau 2022. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # Crypto Lib
2
+
3
+ ![Banner representing Crypto Lib](https://raw.githubusercontent.com/sebastienrousseau/crypto-service/master/assets/crypto-lib-logo.svg)
4
+
5
+ [![Maintained with Lerna](https://img.shields.io/badge/maintained%20with-lerna-blue?style=for-the-badge)](https://lerna.js.org/)
6
+ [![License](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge&logo=)](https://opensource.org/licenses/MIT)
7
+ ![Made with Love](https://raw.githubusercontent.com/sebastienrousseau/crypto-service/master/assets/made-with-love.svg)
8
+
9
+ ***
10
+
11
+ ## Welcome to Crypto Lib
12
+
13
+ Crypto Lib is a powerful intuitive cryptographic JavaScript library that
14
+ encapsulates common algorithms, functions and provides an interface for
15
+ low-level cryptographic operations.
16
+
17
+ The cryptographic operations include:
18
+
19
+ - Digital Signing,
20
+ - Encryption and Decryption,
21
+ - Key Generation,
22
+ - Key Management,
23
+ - Pseudorandom Number Generation,
24
+ - Signature Verification.
25
+
26
+ This library is based on [OpenPGP.js][1] - a JavaScript implementation of the
27
+ OpenPGP protocol. It implements [RFC4880][2] and parts of [RFC4880bis][3].
28
+
29
+ Development of this library is hosted by [GitHub][4] at the [following page][5].
30
+ Source code is available to everyone under the standard [MIT license][6].
31
+
32
+ ## Getting Started
33
+
34
+ Crypto Lib is a [Node.js][7] module available through the
35
+ [npm registry][8]. Before installing, [download and install Node.js][7].
36
+ Node.js 12.20.0 or higher is required.
37
+
38
+ Installation is done using either [`npm`][8], [`yarn`][9] or [`pnpm`][10]
39
+ package managers to use Crypto Lib with Node.js or the Command Line Interface:
40
+
41
+ - `npm i @sebastienrousseau/crypto-lib`
42
+ - `yarn add @sebastienrousseau/crypto-lib`
43
+ - `pnpm add @sebastienrousseau/crypto-lib`
44
+
45
+ ## What's included
46
+
47
+ Within the download you'll find all the crypto lib source files grouped into
48
+ the *dist* folder.
49
+
50
+ You'll see something like this:
51
+
52
+ ```shell
53
+ .
54
+ ├── bin
55
+ │   ├── crypto-lib.d.ts
56
+ │   ├── crypto-lib.d.ts.map
57
+ │   ├── crypto-lib.js
58
+ │   └── crypto-lib.js.map
59
+ ├── index.d.ts
60
+ ├── index.d.ts.map
61
+ ├── index.js
62
+ ├── index.js.map
63
+ └── lib
64
+ ├── decrypt.d.ts
65
+ ├── decrypt.d.ts.map
66
+ ├── decrypt.js
67
+ ├── decrypt.js.map
68
+ ├── encrypt.d.ts
69
+ ├── encrypt.d.ts.map
70
+ ├── encrypt.js
71
+ ├── encrypt.js.map
72
+ ├── generate.d.ts
73
+ ├── generate.d.ts.map
74
+ ├── generate.js
75
+ ├── generate.js.map
76
+ ├── revoke-key.d.ts
77
+ ├── revoke-key.d.ts.map
78
+ ├── revoke-key.js
79
+ └── revoke-key.js.map
80
+
81
+ 2 directories, 24 files
82
+
83
+ ```
84
+
85
+ ## Quick Start
86
+
87
+ ### Generating a new RSA key pair
88
+
89
+ [RSA][11] is a public-key algorithm for encrypting and signing messages. To
90
+ generate a Rivest-Shamir-Adelman (RSA) public key pair:
91
+
92
+ - Open Terminal for Mac or Command Prompt for Windows,
93
+
94
+ - Enter the following example command that will start the generation process in
95
+ the `dist/` directory.
96
+
97
+ ```js
98
+ yarn start \
99
+ --name "Jane Doe" \
100
+ --email "jane@doe.com" \
101
+ --passphrase "123456789abcdef" \
102
+ --type "rsa" \
103
+ --curve "" \
104
+ --bits 2048 \
105
+ --expiration 0 \
106
+ --format armored \
107
+ --sign true
108
+ ```
109
+
110
+ This starts generating a 2048-bit RSA key pair, encrypts them with the password
111
+ provided and writes them to a file in the [key](src/key/) directory with a pgp
112
+ extension.
113
+
114
+ ***
115
+
116
+ ### Generating a new Elliptic-curve cryptography (ECC) key pair
117
+
118
+ [Elliptic-curve cryptography (ECC)][12] is an alternative technique to RSA. It
119
+ generates security between key pairs for public key encryption by using the
120
+ mathematics of elliptic curves. Elliptic curve cryptography provides stronger
121
+ security per bits of key, which allows for much faster operations.
122
+
123
+ Currently the following curves are supported:
124
+
125
+ | Curve | Encryption | Signature | NodeCrypto | WebCrypto |
126
+ |:---------------:|:----------:|:---------:|:----------:|:---------:|
127
+ | curve25519 | ECDH | N/A | No | No |
128
+ | ed25519 | N/A | EdDSA | No | No |
129
+ | p256 | ECDH | ECDSA | Yes | Yes |
130
+ | p384 | ECDH | ECDSA | Yes | Yes |
131
+ | p521 | ECDH | ECDSA | Yes | Yes |
132
+ | brainpoolP256r1 | ECDH | ECDSA | Yes | No |
133
+ | brainpoolP384r1 | ECDH | ECDSA | Yes | No |
134
+ | brainpoolP512r1 | ECDH | ECDSA | Yes | No |
135
+ | secp256k1 | ECDH | ECDSA | Yes | No |
136
+
137
+ To generate an Elliptic Curve Cryptography (ECC) key pair:
138
+
139
+ - Open Terminal for Mac or Command Prompt for Windows,
140
+ - Enter the following example command that will start the generation process in
141
+ the `dist/` directory.
142
+
143
+ ```js
144
+ yarn start \
145
+ --name "Jane Doe" \
146
+ --email "jane@doe.com" \
147
+ --passphrase "123456789abcdef" \
148
+ --type "ecc" \
149
+ --curve curve25519 \
150
+ --bits null \
151
+ --expiration 0 \
152
+ --format armored \
153
+ --sign true
154
+ ```
155
+
156
+ This starts generating an Elliptic Curve Cryptography (ECC) key pair, encrypts
157
+ them with the password provided and writes them to a file in the [key](src/key/)
158
+ directory with a pgp extension.
159
+
160
+ ***
161
+
162
+ ### Encrypting and Signing Data
163
+
164
+ Encryption is the transformation of data into a form in which it cannot be made
165
+ sense of without the use of some key. Such transformed data is referred to as
166
+ `ciphertext`.
167
+
168
+ Crypto Lib makes it easy and painless to encrypt and sign data.
169
+
170
+ To encrypt a message:
171
+
172
+ - Open Terminal for Mac or Command Prompt for Windows,
173
+ - Run the yarn start
174
+ - Enter the following example command that will start the encryption process in
175
+ the `dist/` directory.
176
+
177
+ ```js
178
+ node dist/lib/encrypt.js \
179
+ --passphrase '123456789abcdef' \
180
+ --message 'Hello Crypto Service APIs!'
181
+ ```
182
+
183
+ ***
184
+
185
+ ### Decrypting and Verifying Signatures
186
+
187
+ Decryption restores encrypted data to to its original (cleartext or plaintext)
188
+ form. Decrypting data and verifying signatures is being done similarly in Crypto
189
+ Lib.
190
+
191
+ To decrypt a message:
192
+
193
+ - Open Terminal for Mac or Command Prompt for Windows,
194
+ - Enter the following example command that will start the decryption process in
195
+ the `dist/` directory.
196
+
197
+ ```js
198
+ node dist/lib/decrypt.js \
199
+ --passphrase '123456789abcdef' \
200
+ --message 'LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgp3Y0ZNQXpMNWFTdVU0RWM4QVEvL1RlZzN6bzFiMSszN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QR1AgTUVTU0FHRS0tLS0tCg=='
201
+ ```
202
+
203
+ [1]: https://openpgpjs.org/
204
+ [2]: https://tools.ietf.org/html/rfc4880
205
+ [3]: https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-10
206
+ [4]: https://github.com
207
+ [5]: https://github.com/sebastienrousseau/crypto-service
208
+ [6]: https://github.com/sebastienrousseau/crypto-service/blob/main/LICENSE
209
+ [7]: https://nodejs.org/en/
210
+ [8]: https://www.npmjs.com/
211
+ [9]: https://yarnpkg.com/getting-started
212
+ [10]: https://pnpm.io/motivation
213
+ [11]: https://en.wikipedia.org/wiki/RSA_(cryptosystem)
214
+ [12]: https://en.wikipedia.org/wiki/Elliptic-curve_cryptography
package/dist/COPYRIGHT ADDED
@@ -0,0 +1,15 @@
1
+ /*
2
+ * ____ _ _ _ _
3
+ * / ___|_ __ _ _ _ __ | |_ ___ | | (_) |__
4
+ * | | | '__| | | | '_ \| __/ _ \ | | | | '_ \
5
+ * | |___| | | |_| | |_) | || (_) | | |___| | |_) |
6
+ * \____|_| \__, | .__/ \__\___/ |_____|_|_.__/
7
+ * |___/|_|
8
+ *
9
+ * Crypto Lib
10
+ * https://cryptolib.io
11
+ *
12
+ * Copyright (c) Sebastien Rousseau 2022. All rights reserved
13
+ * Licensed under the MIT license
14
+ *
15
+ */
@@ -0,0 +1,72 @@
1
+ ┌─────────────────────────┬───────────┬────────────────┐
2
+ │ File │ Size │ Size (gzipped) │
3
+ ├─────────────────────────┼───────────┼────────────────┤
4
+ │ COPYRIGHT │ 416 B │ 239 B │
5
+ ├─────────────────────────┼───────────┼────────────────┤
6
+ │ Makefile │ 2.73 kB │ 994 B │
7
+ ├─────────────────────────┼───────────┼────────────────┤
8
+ │ Report.txt │ 0 B │ 20 B │
9
+ ├─────────────────────────┼───────────┼────────────────┤
10
+ │ index.d.ts │ 103 B │ 107 B │
11
+ ├─────────────────────────┼───────────┼────────────────┤
12
+ │ index.d.ts.map │ 156 B │ 140 B │
13
+ ├─────────────────────────┼───────────┼────────────────┤
14
+ │ index.js │ 356 B │ 251 B │
15
+ ├─────────────────────────┼───────────┼────────────────┤
16
+ │ index.js.map │ 141 B │ 134 B │
17
+ ├─────────────────────────┼───────────┼────────────────┤
18
+ │ package.json │ 4.55 kB │ 1.48 kB │
19
+ ├─────────────────────────┼───────────┼────────────────┤
20
+ │ bin/crypto-lib.d.ts │ 308 B │ 183 B │
21
+ ├─────────────────────────┼───────────┼────────────────┤
22
+ │ bin/crypto-lib.d.ts.map │ 457 B │ 206 B │
23
+ ├─────────────────────────┼───────────┼────────────────┤
24
+ │ bin/crypto-lib.js │ 1.83 kB │ 769 B │
25
+ ├─────────────────────────┼───────────┼────────────────┤
26
+ │ bin/crypto-lib.js.map │ 918 B │ 348 B │
27
+ ├─────────────────────────┼───────────┼────────────────┤
28
+ │ lib/decrypt.d.ts │ 252 B │ 188 B │
29
+ ├─────────────────────────┼───────────┼────────────────┤
30
+ │ lib/decrypt.d.ts.map │ 265 B │ 190 B │
31
+ ├─────────────────────────┼───────────┼────────────────┤
32
+ │ lib/decrypt.js │ 2.44 kB │ 922 B │
33
+ ├─────────────────────────┼───────────┼────────────────┤
34
+ │ lib/decrypt.js.map │ 1.42 kB │ 503 B │
35
+ ├─────────────────────────┼───────────┼────────────────┤
36
+ │ lib/encrypt.d.ts │ 216 B │ 173 B │
37
+ ├─────────────────────────┼───────────┼────────────────┤
38
+ │ lib/encrypt.d.ts.map │ 265 B │ 189 B │
39
+ ├─────────────────────────┼───────────┼────────────────┤
40
+ │ lib/encrypt.js │ 2.35 kB │ 891 B │
41
+ ├─────────────────────────┼───────────┼────────────────┤
42
+ │ lib/encrypt.js.map │ 1.31 kB │ 474 B │
43
+ ├─────────────────────────┼───────────┼────────────────┤
44
+ │ lib/generate.d.ts │ 289 B │ 196 B │
45
+ ├─────────────────────────┼───────────┼────────────────┤
46
+ │ lib/generate.d.ts.map │ 424 B │ 220 B │
47
+ ├─────────────────────────┼───────────┼────────────────┤
48
+ │ lib/generate.js │ 2.11 kB │ 867 B │
49
+ ├─────────────────────────┼───────────┼────────────────┤
50
+ │ lib/generate.js.map │ 1.32 kB │ 427 B │
51
+ ├─────────────────────────┼───────────┼────────────────┤
52
+ │ lib/revoke.d.ts │ 137 B │ 135 B │
53
+ ├─────────────────────────┼───────────┼────────────────┤
54
+ │ lib/revoke.d.ts.map │ 201 B │ 166 B │
55
+ ├─────────────────────────┼───────────┼────────────────┤
56
+ │ lib/revoke.js │ 1.99 kB │ 815 B │
57
+ ├─────────────────────────┼───────────┼────────────────┤
58
+ │ lib/revoke.js.map │ 935 B │ 390 B │
59
+ ├─────────────────────────┼───────────┼────────────────┤
60
+ │ types/types.d.ts │ 35 B │ 55 B │
61
+ ├─────────────────────────┼───────────┼────────────────┤
62
+ │ types/types.d.ts.map │ 113 B │ 107 B │
63
+ ├─────────────────────────┼───────────┼────────────────┤
64
+ │ types/types.js │ 47 B │ 67 B │
65
+ ├─────────────────────────┼───────────┼────────────────┤
66
+ │ types/types.js.map │ 111 B │ 107 B │
67
+ ├─────────────────────────┼───────────┼────────────────┤
68
+ ├─────────────────────────┼───────────┼────────────────┤
69
+ │ Total files: 32 │ 28.2 kB │ 12 kB │
70
+ └─────────────────────────┴───────────┴────────────────┘
71
+
72
+
@@ -0,0 +1,13 @@
1
+ declare const cryptoLib: (data: {
2
+ bits?: string;
3
+ curve?: string;
4
+ email?: string;
5
+ expiration?: string;
6
+ format?: string;
7
+ name?: string;
8
+ passphrase?: string;
9
+ sign?: string;
10
+ type?: string;
11
+ }) => Promise<void>;
12
+ export default cryptoLib;
13
+ //# sourceMappingURL=crypto-lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-lib.d.ts","sourceRoot":"","sources":["../../src/bin/crypto-lib.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,SAAS,SAAgB;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,kBASA,CAAC;AAmBF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const args = process.argv.slice(2);
27
+ const cryptoLib = async (data) => {
28
+ if (data.type) {
29
+ let cryptoFunction = "../lib/generate";
30
+ const run = async () => {
31
+ cryptoFunction = await Promise.resolve().then(() => __importStar(require(cryptoFunction)));
32
+ cryptoFunction;
33
+ };
34
+ run();
35
+ }
36
+ };
37
+ if (args instanceof Array && args.length) {
38
+ const data = {
39
+ bits: args[11],
40
+ curve: args[9],
41
+ email: args[3],
42
+ expiration: args[13],
43
+ format: args[15],
44
+ name: args[1],
45
+ passphrase: args[5],
46
+ sign: args[15],
47
+ type: args[7],
48
+ };
49
+ cryptoLib(data);
50
+ }
51
+ exports.default = cryptoLib;
52
+ //# sourceMappingURL=crypto-lib.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-lib.js","sourceRoot":"","sources":["../../src/bin/crypto-lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAQnC,MAAM,SAAS,GAAG,KAAK,EAAE,IAUxB,EAAE,EAAE;IACH,IAAI,IAAI,CAAC,IAAI,EAAE;QACb,IAAI,cAAc,GAAG,iBAAiB,CAAC;QACvC,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE;YACrB,cAAc,GAAG,wDAAa,cAAc,GAAC,CAAC;YAC9C,cAAc,CAAC;QACjB,CAAC,CAAC;QACF,GAAG,EAAE,CAAC;KACP;AACH,CAAC,CAAC;AAIF,IAAI,IAAI,YAAY,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;IACxC,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACd,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACd,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QACd,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAChB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACb,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QACnB,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACd,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;KACd,CAAC;IACF,SAAS,CAAC,IAAI,CAAC,CAAC;CACjB;AAED,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import cryptoLib from "./bin/crypto-lib";
2
+ export default cryptoLib;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,eAAe,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const crypto_lib_1 = __importDefault(require("./bin/crypto-lib"));
7
+ exports.default = crypto_lib_1.default;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AACA,kEAAyC;AAEzC,kBAAe,oBAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as openpgp from "openpgp";
2
+ declare const decrypt: (data: {
3
+ passphrase: string;
4
+ message: string;
5
+ }) => Promise<openpgp.MaybeStream<openpgp.Data> & openpgp.WebStream<string>>;
6
+ export default decrypt;
7
+ //# sourceMappingURL=decrypt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../src/lib/decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAanC,QAAA,MAAM,OAAO,SAAgB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,2EAyCnE,CAAC;AAiBF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const openpgp = __importStar(require("openpgp"));
27
+ const promises_1 = require("fs/promises");
28
+ const args = process.argv.slice(2);
29
+ console.log(args);
30
+ const decrypt = async (data) => {
31
+ const passphrase = data.passphrase;
32
+ const privateKeyArmored = await (0, promises_1.readFile)("./src/key/rsa.priv.pgp");
33
+ const publicKeyArmored = await (0, promises_1.readFile)("./src/key/rsa.pub.pgp");
34
+ let message = data.message;
35
+ message = Buffer.from(message, "base64").toString("utf-8");
36
+ const publicKeyRead = await openpgp.readKey({
37
+ armoredKey: publicKeyArmored.toString(),
38
+ });
39
+ const privateKeyRead = await openpgp.decryptKey({
40
+ privateKey: await openpgp.readPrivateKey({
41
+ armoredKey: privateKeyArmored.toString(),
42
+ }),
43
+ passphrase,
44
+ });
45
+ const { data: decrypted } = await openpgp.decrypt({
46
+ message: await openpgp.readMessage({ armoredMessage: message }),
47
+ verificationKeys: publicKeyRead,
48
+ decryptionKeys: privateKeyRead,
49
+ });
50
+ console.log(decrypted);
51
+ return decrypted;
52
+ };
53
+ if (args instanceof Array && args.length) {
54
+ const data = {
55
+ message: args[3],
56
+ passphrase: args[1],
57
+ privateKey: args[7],
58
+ publicKey: args[5],
59
+ };
60
+ decrypt(data);
61
+ }
62
+ exports.default = decrypt;
63
+ //# sourceMappingURL=decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decrypt.js","sourceRoot":"","sources":["../../src/lib/decrypt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,0CAAuC;AAGvC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAQlB,MAAM,OAAO,GAAG,KAAK,EAAE,IAA6C,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,MAAM,iBAAiB,GAAG,MAAM,IAAA,mBAAQ,EAAC,wBAAwB,CAAC,CAAC;IACnE,MAAM,gBAAgB,GAAG,MAAM,IAAA,mBAAQ,EAAC,uBAAuB,CAAC,CAAC;IACjE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAG3B,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAK3D,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;QAC1C,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;KACxC,CAAC,CAAC;IAQH,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;QAC9C,UAAU,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC;YACvC,UAAU,EAAE,iBAAiB,CAAC,QAAQ,EAAE;SACzC,CAAC;QACF,UAAU;KACX,CAAC,CAAC;IAIH,MAAM,EAAE,IAAI,EAAE,SAAS,EAAmB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;QACjE,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;QAC/D,gBAAgB,EAAE,aAAa;QAC/B,cAAc,EAAE,cAAc;KAC/B,CAAC,CAAC;IAGH,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEvB,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAKF,IAAI,IAAI,YAAY,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;IACxC,MAAM,IAAI,GAAG;QACX,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAChB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QACnB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QACnB,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;KACnB,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC;CACf;AAID,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as openpgp from "openpgp";
2
+ declare const encrypt: (data: {
3
+ passphrase: string;
4
+ message: string;
5
+ }) => Promise<openpgp.WebStream<string>>;
6
+ export default encrypt;
7
+ //# sourceMappingURL=encrypt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encrypt.d.ts","sourceRoot":"","sources":["../../src/lib/encrypt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AA2BnC,QAAA,MAAM,OAAO,SAAgB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,uCA0CnE,CAAC;AAeF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const openpgp = __importStar(require("openpgp"));
27
+ const promises_1 = require("fs/promises");
28
+ const args = process.argv.slice(2);
29
+ console.log(args);
30
+ const encrypt = async (data) => {
31
+ const message = data.message;
32
+ const passphrase = data.passphrase;
33
+ const privateKeyArmored = await (0, promises_1.readFile)("./src/key/rsa.priv.pgp");
34
+ const publicKeyArmored = await (0, promises_1.readFile)("./src/key/rsa.pub.pgp");
35
+ const publicKeyRead = await openpgp.readKey({
36
+ armoredKey: publicKeyArmored.toString(),
37
+ });
38
+ const privateKeyRead = await openpgp.decryptKey({
39
+ privateKey: await openpgp.readPrivateKey({
40
+ armoredKey: privateKeyArmored.toString(),
41
+ }),
42
+ passphrase,
43
+ });
44
+ const encrypted = await openpgp.encrypt({
45
+ message: await openpgp.createMessage({ text: message }),
46
+ encryptionKeys: publicKeyRead,
47
+ signingKeys: privateKeyRead,
48
+ });
49
+ console.log(encrypted);
50
+ return encrypted;
51
+ };
52
+ if (args instanceof Array && args.length) {
53
+ const data = {
54
+ passphrase: args[1],
55
+ message: args[3],
56
+ publicKey: args[5],
57
+ privateKey: args[7],
58
+ };
59
+ encrypt(data);
60
+ }
61
+ exports.default = encrypt;
62
+ //# sourceMappingURL=encrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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G;QACX,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QACnB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAChB,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;QAClB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;KACpB,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC;CACf;AAGD,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,13 @@
1
+ declare const generate: (data: {
2
+ bits: number;
3
+ curve: any;
4
+ email: string;
5
+ expiration: number;
6
+ format: any;
7
+ name: string;
8
+ passphrase: string;
9
+ sign: boolean;
10
+ type: any;
11
+ }) => Promise<object>;
12
+ export default generate;
13
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/lib/generate.ts"],"names":[],"mappings":"AA6BA,QAAA,MAAM,QAAQ,SAAgB;IAE5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;CACX,KAAG,QAAQ,MAAM,CAkBjB,CAAC;AAmBF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const openpgp = __importStar(require("openpgp"));
27
+ const args = process.argv.slice(2);
28
+ const generate = async (data) => {
29
+ const { privateKey, publicKey, revocationCertificate } = await openpgp.generateKey({
30
+ type: data.type,
31
+ rsaBits: Number(data.bits),
32
+ userIDs: [{ name: data.name, email: data.email }],
33
+ passphrase: data.passphrase,
34
+ curve: data.curve,
35
+ keyExpirationTime: Number(data.expiration),
36
+ subkeys: [{ sign: Boolean(data.sign) }],
37
+ format: data.format,
38
+ });
39
+ return { publicKey, privateKey, revocationCertificate };
40
+ };
41
+ if (args instanceof Array && args.length) {
42
+ const data = {
43
+ bits: Number(args[11]),
44
+ curve: args[9],
45
+ email: args[3],
46
+ expiration: Number(args[13]),
47
+ format: args[15],
48
+ name: args[1],
49
+ passphrase: args[5],
50
+ sign: Boolean(args[15]),
51
+ type: args[7],
52
+ };
53
+ generate(data);
54
+ }
55
+ exports.default = generate;
56
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/lib/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAGnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AA0BnC,MAAM,QAAQ,GAAG,KAAK,EAAE,IAWvB,EAAmB,EAAE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Q,CAAC"}
@@ -0,0 +1,5 @@
1
+ declare const revoke: (data: {
2
+ passphrase: string;
3
+ }) => Promise<string>;
4
+ export default revoke;
5
+ //# sourceMappingURL=revoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revoke.d.ts","sourceRoot":"","sources":["../../src/lib/revoke.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,MAAM,SAAgB;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,oBAiBjD,CAAC;AAYF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const openpgp = __importStar(require("openpgp"));
27
+ const promises_1 = require("fs/promises");
28
+ const args = process.argv.slice(2);
29
+ const revoke = async (data) => {
30
+ const passphrase = data.passphrase;
31
+ const privateKeyArmored = await (0, promises_1.readFile)("./src/key/rsa.priv.pgp");
32
+ const privateKeyRead = await openpgp.decryptKey({
33
+ privateKey: await openpgp.readPrivateKey({
34
+ armoredKey: privateKeyArmored.toString(),
35
+ }),
36
+ passphrase,
37
+ });
38
+ const { publicKey: revokedKeyArmored } = await openpgp.revokeKey({
39
+ key: privateKeyRead,
40
+ format: "armored",
41
+ });
42
+ console.log({ publicKey: revokedKeyArmored });
43
+ return revokedKeyArmored;
44
+ };
45
+ if (args instanceof Array && args.length) {
46
+ const data = {
47
+ passphrase: args[1],
48
+ };
49
+ revoke(data);
50
+ }
51
+ exports.default = revoke;
52
+ //# sourceMappingURL=revoke.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revoke.js","sourceRoot":"","sources":["../../src/lib/revoke.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,0CAAuC;AAGvC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAGnC,MAAM,MAAM,GAAG,KAAK,EAAE,IAA4B,EAAE,EAAE;IACpD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,MAAM,iBAAiB,GAAG,MAAM,IAAA,mBAAQ,EAAC,wBAAwB,CAAC,CAAC;IACnE,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;QAC9C,UAAU,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC;YACvC,UAAU,EAAE,iBAAiB,CAAC,QAAQ,EAAE;SACzC,CAAC;QACF,UAAU;KACX,CAAC,CAAC;IAEH,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC;QAC/D,GAAG,EAAE,cAAc;QACnB,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC9C,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAKF,IAAI,IAAI,YAAY,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;IACxC,MAAM,IAAI,GAAG;QACX,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;KACpB,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,CAAC;CACd;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,131 @@
1
+ {
2
+ "author": "Sebastien Rousseau <hello@crypto-service.co> (https://github.com/sebastienrousseau/crypto-service)",
3
+ "autoupdate": {
4
+ "fileMap": [
5
+ {
6
+ "basePath": "dist",
7
+ "files": [
8
+ "**/*"
9
+ ]
10
+ }
11
+ ],
12
+ "source": "git",
13
+ "target": "git://github.com/sebastienrousseau/crypto-service.git"
14
+ },
15
+ "bin": {
16
+ "crypto-lib": "bin/crypto-lib.js"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/sebastienrousseau/crypto-service/issues"
20
+ },
21
+ "dependencies": {
22
+ "openpgp": "^5.2.1"
23
+ },
24
+ "description": "Crypto Lib is a powerful intuitive cryptographic JavaScript library that encapsulates common algorithms, functions and provides an interface for low-level cryptographic operations.",
25
+ "devDependencies": {
26
+ "@sebastienrousseau/c8-config": "^0.0.1",
27
+ "@sebastienrousseau/eslint-config": "^0.0.2",
28
+ "@sebastienrousseau/jsdoc-config": "^0.0.5",
29
+ "@sebastienrousseau/markdownlint-config": "^0.0.1",
30
+ "@sebastienrousseau/mocha-config": "^0.0.1",
31
+ "@sebastienrousseau/prettier-config": "^0.0.4",
32
+ "@sebastienrousseau/remark-config": "^0.0.3",
33
+ "@typescript-eslint/eslint-plugin": "^5.26.0",
34
+ "@typescript-eslint/parser": "^5.26.0",
35
+ "c8": "^7.11.3",
36
+ "chai": "^4.3.6",
37
+ "dotenv": "^16.0.1",
38
+ "eslint": "^8.16.0",
39
+ "filesizes": "^0.1.2",
40
+ "minami": "^1.2.3",
41
+ "mocha": "^10.0.0",
42
+ "prettier": "^2.6.2",
43
+ "remark-cli": "^10.0.1",
44
+ "remark-footnotes": "^4.0.1",
45
+ "remark-preset-lint-consistent": "^5.1.1",
46
+ "remark-preset-lint-markdown-style-guide": "^5.1.2",
47
+ "remark-preset-lint-recommended": "^6.1.2",
48
+ "rimraf": "^3.0.2",
49
+ "typedoc": "^0.22.15",
50
+ "typedoc-plugin-missing-exports": "^0.22.6",
51
+ "typescript": "^4.7.2"
52
+ },
53
+ "directories": {
54
+ "src": "./src"
55
+ },
56
+ "engines": {
57
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
58
+ },
59
+ "files": [
60
+ "dist/"
61
+ ],
62
+ "funding": [
63
+ {
64
+ "type": "github",
65
+ "url": "https://github.com/sponsors/sebastienrousseau"
66
+ },
67
+ {
68
+ "type": "paypal",
69
+ "url": "https://paypal.me/wwdseb"
70
+ }
71
+ ],
72
+ "homepage": "https://cryptolib.io",
73
+ "keywords": [
74
+ "crypto-api",
75
+ "crypto-library",
76
+ "crypto-service",
77
+ "cryptography",
78
+ "cryptoservice",
79
+ "decryption-tool",
80
+ "decryption",
81
+ "ecc-cryptography",
82
+ "ecc-key-encryption",
83
+ "ecc",
84
+ "encryption-tool",
85
+ "encryption",
86
+ "encryption",
87
+ "openpgpjs",
88
+ "rfc4880",
89
+ "rsa-cryptography",
90
+ "rsa-decryption",
91
+ "rsa"
92
+ ],
93
+ "license": "MIT",
94
+ "license_URI": "http://www.opensource.org/licenses/mit-license.php",
95
+ "lockfileVersion": 1,
96
+ "main": "./dist/index.js",
97
+ "name": "@sebastienrousseau/crypto-lib",
98
+ "private": false,
99
+ "publishConfig": {
100
+ "access": "public",
101
+ "registry": "https://npm.pkg.github.com"
102
+ },
103
+ "repository": {
104
+ "directory": "packages/crypto-lib",
105
+ "type": "git",
106
+ "url": "git@github.com:sebastienrousseau/crypto-service.git"
107
+ },
108
+ "scripts": {
109
+ "build": "tsc -b && yarn run copy:makefile && yarn copy:package && yarn run copy:copyright && yarn run filesize:distribution",
110
+ "clean": "rimraf ./dist ./docs ./node_modules && rimraf tsconfig.tsbuildinfo",
111
+ "copy:package": "cp ./package.json ./dist/",
112
+ "copy:copyright": "cp COPYRIGHT dist/",
113
+ "copy:license": "cp LICENSE dist/",
114
+ "copy:makefile": "cp Makefile dist/",
115
+ "copy:readme": "cp README.md dist/",
116
+ "docs": "typedoc",
117
+ "fix": "eslint --fix src/**/*.ts",
118
+ "filesize:distribution": "filesizes dist/ > dist/Report.txt",
119
+ "lint": "eslint src/**/*.ts",
120
+ "markdown": "yarn remark ./*.md packages/**/*.md --rc-path ./.remarkrc --quiet",
121
+ "prepack": "yarn build",
122
+ "prettier": "prettier --write src/**/*.ts",
123
+ "release:prepare": "yarn pack",
124
+ "release:publish": "yarn publish --access public --ignore-scripts --@OWNER:registry='https://registry.npmjs.org'",
125
+ "release": "yarn release:prepare && yarn release:publish",
126
+ "start": "node dist/index.js",
127
+ "test": "c8 --config=.c8rc mocha --config=.mocharc"
128
+ },
129
+ "types": "./dist/index.d.ts",
130
+ "version": "0.0.1"
131
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,131 @@
1
+ {
2
+ "author": "Sebastien Rousseau <hello@crypto-service.co> (https://github.com/sebastienrousseau/crypto-service)",
3
+ "autoupdate": {
4
+ "fileMap": [
5
+ {
6
+ "basePath": "dist",
7
+ "files": [
8
+ "**/*"
9
+ ]
10
+ }
11
+ ],
12
+ "source": "git",
13
+ "target": "git://github.com/sebastienrousseau/crypto-service.git"
14
+ },
15
+ "bin": {
16
+ "crypto-lib": "bin/crypto-lib.js"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/sebastienrousseau/crypto-service/issues"
20
+ },
21
+ "dependencies": {
22
+ "openpgp": "^5.2.1"
23
+ },
24
+ "description": "Crypto Lib is a powerful intuitive cryptographic JavaScript library that encapsulates common algorithms, functions and provides an interface for low-level cryptographic operations.",
25
+ "devDependencies": {
26
+ "@sebastienrousseau/c8-config": "^0.0.1",
27
+ "@sebastienrousseau/eslint-config": "^0.0.2",
28
+ "@sebastienrousseau/jsdoc-config": "^0.0.5",
29
+ "@sebastienrousseau/markdownlint-config": "^0.0.1",
30
+ "@sebastienrousseau/mocha-config": "^0.0.1",
31
+ "@sebastienrousseau/prettier-config": "^0.0.4",
32
+ "@sebastienrousseau/remark-config": "^0.0.3",
33
+ "@typescript-eslint/eslint-plugin": "^5.26.0",
34
+ "@typescript-eslint/parser": "^5.26.0",
35
+ "c8": "^7.11.3",
36
+ "chai": "^4.3.6",
37
+ "dotenv": "^16.0.1",
38
+ "eslint": "^8.16.0",
39
+ "filesizes": "^0.1.2",
40
+ "minami": "^1.2.3",
41
+ "mocha": "^10.0.0",
42
+ "prettier": "^2.6.2",
43
+ "remark-cli": "^10.0.1",
44
+ "remark-footnotes": "^4.0.1",
45
+ "remark-preset-lint-consistent": "^5.1.1",
46
+ "remark-preset-lint-markdown-style-guide": "^5.1.2",
47
+ "remark-preset-lint-recommended": "^6.1.2",
48
+ "rimraf": "^3.0.2",
49
+ "typedoc": "^0.22.15",
50
+ "typedoc-plugin-missing-exports": "^0.22.6",
51
+ "typescript": "^4.7.2"
52
+ },
53
+ "directories": {
54
+ "src": "./src"
55
+ },
56
+ "engines": {
57
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
58
+ },
59
+ "files": [
60
+ "dist/"
61
+ ],
62
+ "funding": [
63
+ {
64
+ "type": "github",
65
+ "url": "https://github.com/sponsors/sebastienrousseau"
66
+ },
67
+ {
68
+ "type": "paypal",
69
+ "url": "https://paypal.me/wwdseb"
70
+ }
71
+ ],
72
+ "homepage": "https://cryptolib.io",
73
+ "keywords": [
74
+ "crypto-api",
75
+ "crypto-library",
76
+ "crypto-service",
77
+ "cryptography",
78
+ "cryptoservice",
79
+ "decryption-tool",
80
+ "decryption",
81
+ "ecc-cryptography",
82
+ "ecc-key-encryption",
83
+ "ecc",
84
+ "encryption-tool",
85
+ "encryption",
86
+ "encryption",
87
+ "openpgpjs",
88
+ "rfc4880",
89
+ "rsa-cryptography",
90
+ "rsa-decryption",
91
+ "rsa"
92
+ ],
93
+ "license": "MIT",
94
+ "license_URI": "http://www.opensource.org/licenses/mit-license.php",
95
+ "lockfileVersion": 1,
96
+ "main": "./dist/index.js",
97
+ "name": "@sebastienrousseau/crypto-lib",
98
+ "private": false,
99
+ "publishConfig": {
100
+ "access": "public",
101
+ "registry": "https://npm.pkg.github.com"
102
+ },
103
+ "repository": {
104
+ "directory": "packages/crypto-lib",
105
+ "type": "git",
106
+ "url": "git@github.com:sebastienrousseau/crypto-service.git"
107
+ },
108
+ "scripts": {
109
+ "build": "tsc -b && yarn run copy:makefile && yarn copy:package && yarn run copy:copyright && yarn run filesize:distribution",
110
+ "clean": "rimraf ./dist ./docs ./node_modules && rimraf tsconfig.tsbuildinfo",
111
+ "copy:package": "cp ./package.json ./dist/",
112
+ "copy:copyright": "cp COPYRIGHT dist/",
113
+ "copy:license": "cp LICENSE dist/",
114
+ "copy:makefile": "cp Makefile dist/",
115
+ "copy:readme": "cp README.md dist/",
116
+ "docs": "typedoc",
117
+ "fix": "eslint --fix src/**/*.ts",
118
+ "filesize:distribution": "filesizes dist/ > dist/Report.txt",
119
+ "lint": "eslint src/**/*.ts",
120
+ "markdown": "yarn remark ./*.md packages/**/*.md --rc-path ./.remarkrc --quiet",
121
+ "prepack": "yarn build",
122
+ "prettier": "prettier --write src/**/*.ts",
123
+ "release:prepare": "yarn pack",
124
+ "release:publish": "yarn publish --access public --ignore-scripts --@OWNER:registry='https://registry.npmjs.org'",
125
+ "release": "yarn release:prepare && yarn release:publish",
126
+ "start": "node dist/index.js",
127
+ "test": "c8 --config=.c8rc mocha --config=.mocharc"
128
+ },
129
+ "types": "./dist/index.d.ts",
130
+ "version": "0.0.1"
131
+ }