@nestia/fetcher 1.3.2 → 1.3.4
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/lib/AesPkcs5.d.ts +30 -30
- package/lib/AesPkcs5.js +48 -48
- package/lib/AesPkcs5.js.map +1 -1
- package/lib/Fetcher.d.ts +72 -72
- package/lib/Fetcher.js +190 -190
- package/lib/HttpError.d.ts +46 -46
- package/lib/HttpError.js +80 -80
- package/lib/IConnection.d.ts +46 -54
- package/lib/IConnection.js +2 -2
- package/lib/IEncryptionPassword.d.ts +46 -46
- package/lib/IEncryptionPassword.js +2 -2
- package/lib/IRandomGenerator.d.ts +32 -32
- package/lib/IRandomGenerator.js +2 -2
- package/lib/Primitive.d.ts +54 -52
- package/lib/Primitive.js +2 -2
- package/lib/index.d.ts +6 -6
- package/lib/index.js +22 -22
- package/lib/internal/Singleton.d.ts +1 -1
- package/lib/internal/Singleton.js +23 -23
- package/package.json +5 -2
- package/src/IConnection.ts +0 -9
- package/src/Primitive.ts +7 -1
package/lib/AesPkcs5.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility class for the AES-128/256 encryption.
|
|
3
|
-
*
|
|
4
|
-
* - AES-128/256
|
|
5
|
-
* - CBC mode
|
|
6
|
-
* - PKCS#5 Padding
|
|
7
|
-
* - Base64 Encoding
|
|
8
|
-
*
|
|
9
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
10
|
-
*/
|
|
11
|
-
export declare namespace AesPkcs5 {
|
|
12
|
-
/**
|
|
13
|
-
* Encrypt data
|
|
14
|
-
*
|
|
15
|
-
* @param data Target data
|
|
16
|
-
* @param key Key value of the encryption.
|
|
17
|
-
* @param iv Initializer Vector for the encryption
|
|
18
|
-
* @return Encrypted data
|
|
19
|
-
*/
|
|
20
|
-
function encrypt(data: string, key: string, iv: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Decrypt data.
|
|
23
|
-
*
|
|
24
|
-
* @param data Target data
|
|
25
|
-
* @param key Key value of the decryption.
|
|
26
|
-
* @param iv Initializer Vector for the decryption
|
|
27
|
-
* @return Decrypted data.
|
|
28
|
-
*/
|
|
29
|
-
function decrypt(data: string, key: string, iv: string): string;
|
|
30
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for the AES-128/256 encryption.
|
|
3
|
+
*
|
|
4
|
+
* - AES-128/256
|
|
5
|
+
* - CBC mode
|
|
6
|
+
* - PKCS#5 Padding
|
|
7
|
+
* - Base64 Encoding
|
|
8
|
+
*
|
|
9
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
10
|
+
*/
|
|
11
|
+
export declare namespace AesPkcs5 {
|
|
12
|
+
/**
|
|
13
|
+
* Encrypt data
|
|
14
|
+
*
|
|
15
|
+
* @param data Target data
|
|
16
|
+
* @param key Key value of the encryption.
|
|
17
|
+
* @param iv Initializer Vector for the encryption
|
|
18
|
+
* @return Encrypted data
|
|
19
|
+
*/
|
|
20
|
+
function encrypt(data: string, key: string, iv: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Decrypt data.
|
|
23
|
+
*
|
|
24
|
+
* @param data Target data
|
|
25
|
+
* @param key Key value of the decryption.
|
|
26
|
+
* @param iv Initializer Vector for the decryption
|
|
27
|
+
* @return Decrypted data.
|
|
28
|
+
*/
|
|
29
|
+
function decrypt(data: string, key: string, iv: string): string;
|
|
30
|
+
}
|
package/lib/AesPkcs5.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
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
|
-
exports.AesPkcs5 = void 0;
|
|
7
|
-
var crypto_1 = __importDefault(require("crypto"));
|
|
8
|
-
/**
|
|
9
|
-
* Utility class for the AES-128/256 encryption.
|
|
10
|
-
*
|
|
11
|
-
* - AES-128/256
|
|
12
|
-
* - CBC mode
|
|
13
|
-
* - PKCS#5 Padding
|
|
14
|
-
* - Base64 Encoding
|
|
15
|
-
*
|
|
16
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
17
|
-
*/
|
|
18
|
-
var AesPkcs5;
|
|
19
|
-
(function (AesPkcs5) {
|
|
20
|
-
/**
|
|
21
|
-
* Encrypt data
|
|
22
|
-
*
|
|
23
|
-
* @param data Target data
|
|
24
|
-
* @param key Key value of the encryption.
|
|
25
|
-
* @param iv Initializer Vector for the encryption
|
|
26
|
-
* @return Encrypted data
|
|
27
|
-
*/
|
|
28
|
-
function encrypt(data, key, iv) {
|
|
29
|
-
var bytes = key.length * 8;
|
|
30
|
-
var cipher = crypto_1.default.createCipheriv("AES-".concat(bytes, "-CBC"), key, iv);
|
|
31
|
-
return cipher.update(data, "utf8", "base64") + cipher.final("base64");
|
|
32
|
-
}
|
|
33
|
-
AesPkcs5.encrypt = encrypt;
|
|
34
|
-
/**
|
|
35
|
-
* Decrypt data.
|
|
36
|
-
*
|
|
37
|
-
* @param data Target data
|
|
38
|
-
* @param key Key value of the decryption.
|
|
39
|
-
* @param iv Initializer Vector for the decryption
|
|
40
|
-
* @return Decrypted data.
|
|
41
|
-
*/
|
|
42
|
-
function decrypt(data, key, iv) {
|
|
43
|
-
var bytes = key.length * 8;
|
|
44
|
-
var decipher = crypto_1.default.createDecipheriv("AES-".concat(bytes, "-CBC"), key, iv);
|
|
45
|
-
return decipher.update(data, "base64", "utf8") + decipher.final("utf8");
|
|
46
|
-
}
|
|
47
|
-
AesPkcs5.decrypt = decrypt;
|
|
48
|
-
})(AesPkcs5
|
|
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
|
+
exports.AesPkcs5 = void 0;
|
|
7
|
+
var crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
/**
|
|
9
|
+
* Utility class for the AES-128/256 encryption.
|
|
10
|
+
*
|
|
11
|
+
* - AES-128/256
|
|
12
|
+
* - CBC mode
|
|
13
|
+
* - PKCS#5 Padding
|
|
14
|
+
* - Base64 Encoding
|
|
15
|
+
*
|
|
16
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
17
|
+
*/
|
|
18
|
+
var AesPkcs5;
|
|
19
|
+
(function (AesPkcs5) {
|
|
20
|
+
/**
|
|
21
|
+
* Encrypt data
|
|
22
|
+
*
|
|
23
|
+
* @param data Target data
|
|
24
|
+
* @param key Key value of the encryption.
|
|
25
|
+
* @param iv Initializer Vector for the encryption
|
|
26
|
+
* @return Encrypted data
|
|
27
|
+
*/
|
|
28
|
+
function encrypt(data, key, iv) {
|
|
29
|
+
var bytes = key.length * 8;
|
|
30
|
+
var cipher = crypto_1.default.createCipheriv("AES-".concat(bytes, "-CBC"), key, iv);
|
|
31
|
+
return cipher.update(data, "utf8", "base64") + cipher.final("base64");
|
|
32
|
+
}
|
|
33
|
+
AesPkcs5.encrypt = encrypt;
|
|
34
|
+
/**
|
|
35
|
+
* Decrypt data.
|
|
36
|
+
*
|
|
37
|
+
* @param data Target data
|
|
38
|
+
* @param key Key value of the decryption.
|
|
39
|
+
* @param iv Initializer Vector for the decryption
|
|
40
|
+
* @return Decrypted data.
|
|
41
|
+
*/
|
|
42
|
+
function decrypt(data, key, iv) {
|
|
43
|
+
var bytes = key.length * 8;
|
|
44
|
+
var decipher = crypto_1.default.createDecipheriv("AES-".concat(bytes, "-CBC"), key, iv);
|
|
45
|
+
return decipher.update(data, "base64", "utf8") + decipher.final("utf8");
|
|
46
|
+
}
|
|
47
|
+
AesPkcs5.decrypt = decrypt;
|
|
48
|
+
})(AesPkcs5 || (exports.AesPkcs5 = AesPkcs5 = {}));
|
|
49
49
|
//# sourceMappingURL=AesPkcs5.js.map
|
package/lib/AesPkcs5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesPkcs5.js","sourceRoot":"","sources":["../src/AesPkcs5.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4B;AAE5B;;;;;;;;;GASG;AACH,IAAiB,QAAQ,CAsCxB;AAtCD,WAAiB,QAAQ;IACrB;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QACzD,IAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAM,MAAM,GAAkB,gBAAM,CAAC,cAAc,CAC/C,cAAO,KAAK,SAAM,EAClB,GAAG,EACH,EAAE,CACL,CAAC;QAEF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1E,CAAC;IATe,gBAAO,UAStB,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QACzD,IAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAM,QAAQ,GAAoB,gBAAM,CAAC,gBAAgB,CACrD,cAAO,KAAK,SAAM,EAClB,GAAG,EACH,EAAE,CACL,CAAC;QAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5E,CAAC;IATe,gBAAO,UAStB,CAAA;AACL,CAAC,EAtCgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"AesPkcs5.js","sourceRoot":"","sources":["../src/AesPkcs5.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4B;AAE5B;;;;;;;;;GASG;AACH,IAAiB,QAAQ,CAsCxB;AAtCD,WAAiB,QAAQ;IACrB;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QACzD,IAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAM,MAAM,GAAkB,gBAAM,CAAC,cAAc,CAC/C,cAAO,KAAK,SAAM,EAClB,GAAG,EACH,EAAE,CACL,CAAC;QAEF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1E,CAAC;IATe,gBAAO,UAStB,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QACzD,IAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAM,QAAQ,GAAoB,gBAAM,CAAC,gBAAgB,CACrD,cAAO,KAAK,SAAM,EAClB,GAAG,EACH,EAAE,CACL,CAAC;QAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5E,CAAC;IATe,gBAAO,UAStB,CAAA;AACL,CAAC,EAtCgB,QAAQ,wBAAR,QAAQ,QAsCxB"}
|
package/lib/Fetcher.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { IConnection } from "./IConnection";
|
|
2
|
-
import { Primitive } from "./Primitive";
|
|
3
|
-
/**
|
|
4
|
-
* Fetcher, utility class for the [**Nestia**](https://github.com/samchon/nestia) fetch.
|
|
5
|
-
*
|
|
6
|
-
* `Fetcher` is a utility class providing the {@link Fetcher.fetch} functions who're being
|
|
7
|
-
* used by all of the SDK libraries, interacting with the remote HTTP servers, who are
|
|
8
|
-
* generated by the [**Nestia**](https://github.com/samchon/nestia).
|
|
9
|
-
*
|
|
10
|
-
* As this `Fetcher` be used only by the [**Nestia**](https://github.com/samchon/nestia)
|
|
11
|
-
* generated SDK libraries, you don't need to handle this class directly. It may only be
|
|
12
|
-
* appeared in the source codes of the [**Nestia**](https://github.com/samchon/nestia)
|
|
13
|
-
* generated SDK libraries.
|
|
14
|
-
*
|
|
15
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
16
|
-
*/
|
|
17
|
-
export declare class Fetcher {
|
|
18
|
-
/**
|
|
19
|
-
* Fetch function for the `GET` methods.
|
|
20
|
-
*
|
|
21
|
-
* @param connection Connection information for the remote HTTP server
|
|
22
|
-
* @param encrypted Whether the request/response body be encrypted or not
|
|
23
|
-
* @param method Method of the HTTP request
|
|
24
|
-
* @param path Path of the HTTP request
|
|
25
|
-
* @return Response body data from the remote HTTP server
|
|
26
|
-
*/
|
|
27
|
-
static fetch<Output>(connection: IConnection, encrypted: Fetcher.IEncrypted, method: "GET", path: string): Promise<Primitive<Output>>;
|
|
28
|
-
/**
|
|
29
|
-
* Fetch function for the `POST`, `PUT`, `PATCH` and `DELETE` methods.
|
|
30
|
-
*
|
|
31
|
-
* @param connection Connection information for the remote HTTP server
|
|
32
|
-
* @param encrypted Whether the request/response body be encrypted or not
|
|
33
|
-
* @param method Method of the HTTP request
|
|
34
|
-
* @param path Path of the HTTP request
|
|
35
|
-
* @param input Request body data for the HTTP request
|
|
36
|
-
* @param stringify JSON string conversion function, default is the `JSON.stringify`
|
|
37
|
-
* @return Response body data from the remote HTTP server
|
|
38
|
-
*/
|
|
39
|
-
static fetch<Input, Output>(connection: IConnection, encrypted: Fetcher.IEncrypted, method: "POST" | "PUT" | "PATCH" | "DELETE", path: string, input?: Input, stringify?: (input: Input) => string): Promise<Primitive<Output>>;
|
|
40
|
-
}
|
|
41
|
-
export declare namespace Fetcher {
|
|
42
|
-
/**
|
|
43
|
-
* Whether be encrypted or not.
|
|
44
|
-
*
|
|
45
|
-
* `Fetcher.IEncrypted` is a type of interface who represents whether the HTTP request
|
|
46
|
-
* and response body must be encrypted or not.
|
|
47
|
-
*
|
|
48
|
-
* Like the {@link Fetcher} who are being used by all of the SDK libraries that are
|
|
49
|
-
* generated by the [Nestia](https://github.com/samchon/nestia), this `IEncrypted`
|
|
50
|
-
* interface would be used by the [Nestia](https://github.com/samchon/nestia) generated
|
|
51
|
-
* SDK libaries.
|
|
52
|
-
*
|
|
53
|
-
* As this `Fetcher` be used only by the [**Nestia**](https://github.com/samchon/nestia)
|
|
54
|
-
* generated SDK libraries, you don't need to handle this class directly. It may only be
|
|
55
|
-
* appeared in the source codes of the [**Nestia**](https://github.com/samchon/nestia)
|
|
56
|
-
* generated SDK libraries.
|
|
57
|
-
*/
|
|
58
|
-
interface IEncrypted {
|
|
59
|
-
/**
|
|
60
|
-
* Whether the request body be encrypted or not.
|
|
61
|
-
*/
|
|
62
|
-
request?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Whether the response body be encrypted or not.
|
|
65
|
-
*/
|
|
66
|
-
response: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* When special status code is allowed.
|
|
69
|
-
*/
|
|
70
|
-
status?: number;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
1
|
+
import { IConnection } from "./IConnection";
|
|
2
|
+
import { Primitive } from "./Primitive";
|
|
3
|
+
/**
|
|
4
|
+
* Fetcher, utility class for the [**Nestia**](https://github.com/samchon/nestia) fetch.
|
|
5
|
+
*
|
|
6
|
+
* `Fetcher` is a utility class providing the {@link Fetcher.fetch} functions who're being
|
|
7
|
+
* used by all of the SDK libraries, interacting with the remote HTTP servers, who are
|
|
8
|
+
* generated by the [**Nestia**](https://github.com/samchon/nestia).
|
|
9
|
+
*
|
|
10
|
+
* As this `Fetcher` be used only by the [**Nestia**](https://github.com/samchon/nestia)
|
|
11
|
+
* generated SDK libraries, you don't need to handle this class directly. It may only be
|
|
12
|
+
* appeared in the source codes of the [**Nestia**](https://github.com/samchon/nestia)
|
|
13
|
+
* generated SDK libraries.
|
|
14
|
+
*
|
|
15
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
16
|
+
*/
|
|
17
|
+
export declare class Fetcher {
|
|
18
|
+
/**
|
|
19
|
+
* Fetch function for the `GET` methods.
|
|
20
|
+
*
|
|
21
|
+
* @param connection Connection information for the remote HTTP server
|
|
22
|
+
* @param encrypted Whether the request/response body be encrypted or not
|
|
23
|
+
* @param method Method of the HTTP request
|
|
24
|
+
* @param path Path of the HTTP request
|
|
25
|
+
* @return Response body data from the remote HTTP server
|
|
26
|
+
*/
|
|
27
|
+
static fetch<Output>(connection: IConnection, encrypted: Fetcher.IEncrypted, method: "GET", path: string): Promise<Primitive<Output>>;
|
|
28
|
+
/**
|
|
29
|
+
* Fetch function for the `POST`, `PUT`, `PATCH` and `DELETE` methods.
|
|
30
|
+
*
|
|
31
|
+
* @param connection Connection information for the remote HTTP server
|
|
32
|
+
* @param encrypted Whether the request/response body be encrypted or not
|
|
33
|
+
* @param method Method of the HTTP request
|
|
34
|
+
* @param path Path of the HTTP request
|
|
35
|
+
* @param input Request body data for the HTTP request
|
|
36
|
+
* @param stringify JSON string conversion function, default is the `JSON.stringify`
|
|
37
|
+
* @return Response body data from the remote HTTP server
|
|
38
|
+
*/
|
|
39
|
+
static fetch<Input, Output>(connection: IConnection, encrypted: Fetcher.IEncrypted, method: "POST" | "PUT" | "PATCH" | "DELETE", path: string, input?: Input, stringify?: (input: Input) => string): Promise<Primitive<Output>>;
|
|
40
|
+
}
|
|
41
|
+
export declare namespace Fetcher {
|
|
42
|
+
/**
|
|
43
|
+
* Whether be encrypted or not.
|
|
44
|
+
*
|
|
45
|
+
* `Fetcher.IEncrypted` is a type of interface who represents whether the HTTP request
|
|
46
|
+
* and response body must be encrypted or not.
|
|
47
|
+
*
|
|
48
|
+
* Like the {@link Fetcher} who are being used by all of the SDK libraries that are
|
|
49
|
+
* generated by the [Nestia](https://github.com/samchon/nestia), this `IEncrypted`
|
|
50
|
+
* interface would be used by the [Nestia](https://github.com/samchon/nestia) generated
|
|
51
|
+
* SDK libaries.
|
|
52
|
+
*
|
|
53
|
+
* As this `Fetcher` be used only by the [**Nestia**](https://github.com/samchon/nestia)
|
|
54
|
+
* generated SDK libraries, you don't need to handle this class directly. It may only be
|
|
55
|
+
* appeared in the source codes of the [**Nestia**](https://github.com/samchon/nestia)
|
|
56
|
+
* generated SDK libraries.
|
|
57
|
+
*/
|
|
58
|
+
interface IEncrypted {
|
|
59
|
+
/**
|
|
60
|
+
* Whether the request body be encrypted or not.
|
|
61
|
+
*/
|
|
62
|
+
request?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the response body be encrypted or not.
|
|
65
|
+
*/
|
|
66
|
+
response: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* When special status code is allowed.
|
|
69
|
+
*/
|
|
70
|
+
status?: number;
|
|
71
|
+
}
|
|
72
|
+
}
|