@lindorm/rsa 0.2.11 → 0.3.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/README.md +23 -9
- package/dist/classes/RsaKit.d.ts +2 -2
- package/dist/classes/RsaKit.d.ts.map +1 -1
- package/dist/classes/RsaKit.js +11 -15
- package/dist/classes/RsaKit.js.map +1 -1
- package/dist/classes/index.d.ts +1 -1
- package/dist/classes/index.d.ts.map +1 -1
- package/dist/classes/index.js +1 -17
- package/dist/classes/index.js.map +1 -1
- package/dist/errors/RsaError.js +2 -6
- package/dist/errors/RsaError.js.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +1 -17
- package/dist/errors/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -19
- package/dist/index.js.map +1 -1
- package/dist/internal/get-key.d.ts +3 -3
- package/dist/internal/get-key.d.ts.map +1 -1
- package/dist/internal/get-key.js +10 -15
- package/dist/internal/get-key.js.map +1 -1
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +3 -19
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/map-algorithm.d.ts +2 -2
- package/dist/internal/map-algorithm.d.ts.map +1 -1
- package/dist/internal/map-algorithm.js +5 -9
- package/dist/internal/map-algorithm.js.map +1 -1
- package/dist/internal/rsa-signature.d.ts +1 -1
- package/dist/internal/rsa-signature.d.ts.map +1 -1
- package/dist/internal/rsa-signature.js +12 -18
- package/dist/internal/rsa-signature.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -17
- package/dist/types/index.js.map +1 -1
- package/dist/types/rsa-kit.d.ts +2 -2
- package/dist/types/rsa-kit.d.ts.map +1 -1
- package/dist/types/rsa-kit.js +1 -2
- package/package.json +19 -12
- package/CHANGELOG.md +0 -113
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @lindorm/rsa
|
|
2
2
|
|
|
3
|
-
RSA
|
|
3
|
+
RSA signing kit built on Node's `crypto` module and [`@lindorm/kryptos`](https://www.npmjs.com/package/@lindorm/kryptos). Provides an `RsaKit` class that implements the `IKeyKit` contract used across the Lindorm cryptography packages.
|
|
4
|
+
|
|
5
|
+
This package is **ESM-only**.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -8,6 +10,15 @@ RSA signature kit built on Node's `crypto` module and [`@lindorm/kryptos`](https
|
|
|
8
10
|
npm install @lindorm/rsa
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
`RsaKit` accepts an `IKryptos` instance constructed by the consumer, so [`@lindorm/kryptos`](https://www.npmjs.com/package/@lindorm/kryptos) must also be installed in your project.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Sign, verify, and assert RSA signatures over `Buffer` or `string` input
|
|
18
|
+
- Supports `RS256`, `RS384`, `RS512` (PKCS#1 v1.5) and `PS256`, `PS384`, `PS512` (PSS, salt length 32)
|
|
19
|
+
- Configurable string output encoding via Node's `BufferEncoding`
|
|
20
|
+
- Rejects non-RSA keys and RSA encryption algorithms (e.g. `RSA-OAEP`) at construction time
|
|
21
|
+
|
|
11
22
|
## Quick Start
|
|
12
23
|
|
|
13
24
|
```typescript
|
|
@@ -17,16 +28,12 @@ import { KryptosKit } from "@lindorm/kryptos";
|
|
|
17
28
|
const kryptos = KryptosKit.generate.sig.rsa({ algorithm: "PS256" });
|
|
18
29
|
const kit = new RsaKit({ kryptos });
|
|
19
30
|
|
|
20
|
-
// Sign
|
|
21
31
|
const signature = kit.sign("hello world");
|
|
22
32
|
|
|
23
|
-
// Verify
|
|
24
33
|
kit.verify("hello world", signature); // true
|
|
25
34
|
|
|
26
|
-
//
|
|
27
|
-
kit.assert("hello world", signature);
|
|
35
|
+
kit.assert("hello world", signature); // throws RsaError if invalid
|
|
28
36
|
|
|
29
|
-
// Format Buffer to string
|
|
30
37
|
kit.format(signature); // base64 string
|
|
31
38
|
```
|
|
32
39
|
|
|
@@ -36,11 +43,11 @@ kit.format(signature); // base64 string
|
|
|
36
43
|
new RsaKit({
|
|
37
44
|
kryptos, // IKryptos — must be an RSA key with a signing algorithm
|
|
38
45
|
dsa: "der", // DsaEncoding — "der" | "ieee-p1363" (default: "der")
|
|
39
|
-
encoding: "base64", // BufferEncoding —
|
|
46
|
+
encoding: "base64", // BufferEncoding — string encoding for verify/format (default: "base64")
|
|
40
47
|
});
|
|
41
48
|
```
|
|
42
49
|
|
|
43
|
-
The constructor validates that the key is an RSA
|
|
50
|
+
The constructor validates that the key is an RSA key with one of the supported signing algorithms (`RS256`, `RS384`, `RS512`, `PS256`, `PS384`, `PS512`). RSA encryption keys and non-RSA keys are rejected with an `RsaError`.
|
|
44
51
|
|
|
45
52
|
## API
|
|
46
53
|
|
|
@@ -55,6 +62,11 @@ class RsaKit implements IKeyKit {
|
|
|
55
62
|
|
|
56
63
|
`KeyData` is `Buffer | string`.
|
|
57
64
|
|
|
65
|
+
- `sign(data)` — produces a signature `Buffer` using the configured key and algorithm.
|
|
66
|
+
- `verify(data, signature)` — returns `true` if the signature is valid. String signatures are decoded using the configured `encoding`.
|
|
67
|
+
- `assert(data, signature)` — same as `verify`, but throws `RsaError` instead of returning `false`.
|
|
68
|
+
- `format(buffer)` — encodes a signature `Buffer` to a string using the configured `encoding`.
|
|
69
|
+
|
|
58
70
|
## Supported Algorithms
|
|
59
71
|
|
|
60
72
|
| Algorithm | Padding | Hash |
|
|
@@ -66,9 +78,11 @@ class RsaKit implements IKeyKit {
|
|
|
66
78
|
| PS384 | PSS | SHA-384 |
|
|
67
79
|
| PS512 | PSS | SHA-512 |
|
|
68
80
|
|
|
81
|
+
PSS variants are signed and verified with a salt length of 32 bytes.
|
|
82
|
+
|
|
69
83
|
## Error Handling
|
|
70
84
|
|
|
71
|
-
All errors are `RsaError
|
|
85
|
+
All errors thrown by this package are instances of `RsaError`:
|
|
72
86
|
|
|
73
87
|
```typescript
|
|
74
88
|
import { RsaError } from "@lindorm/rsa";
|
package/dist/classes/RsaKit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IKeyKit, KeyData } from "@lindorm/types";
|
|
2
|
-
import { RsaKitOptions } from "../types";
|
|
1
|
+
import type { IKeyKit, KeyData } from "@lindorm/types";
|
|
2
|
+
import type { RsaKitOptions } from "../types/index.js";
|
|
3
3
|
export declare class RsaKit implements IKeyKit {
|
|
4
4
|
private readonly dsa;
|
|
5
5
|
private readonly encoding;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RsaKit.d.ts","sourceRoot":"","sources":["../../src/classes/RsaKit.ts"],"names":[],"mappings":"AAMA,OAAO,EAAe,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"RsaKit.d.ts","sourceRoot":"","sources":["../../src/classes/RsaKit.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOvD,qBAAa,MAAO,YAAW,OAAO;IACpC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;gBAEnB,OAAO,EAAE,aAAa;IAiBlC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAQ3B,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO;IAUlD,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAU/C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGpC"}
|
package/dist/classes/RsaKit.js
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const errors_1 = require("../errors");
|
|
6
|
-
const index_1 = require("../internal/index");
|
|
7
|
-
class RsaKit {
|
|
1
|
+
import { KryptosKit, RSA_SIG_ALGORITHMS, } from "@lindorm/kryptos";
|
|
2
|
+
import { RsaError } from "../errors/index.js";
|
|
3
|
+
import { assertRsaSignature, createRsaSignature, verifyRsaSignature, } from "../internal/index.js";
|
|
4
|
+
export class RsaKit {
|
|
8
5
|
dsa;
|
|
9
6
|
encoding;
|
|
10
7
|
kryptos;
|
|
11
8
|
constructor(options) {
|
|
12
9
|
this.dsa = options.dsa ?? "der";
|
|
13
10
|
this.encoding = options.encoding ?? "base64";
|
|
14
|
-
if (!
|
|
15
|
-
throw new
|
|
11
|
+
if (!KryptosKit.isRsa(options.kryptos)) {
|
|
12
|
+
throw new RsaError("Invalid Kryptos instance");
|
|
16
13
|
}
|
|
17
|
-
if (!
|
|
18
|
-
throw new
|
|
14
|
+
if (!RSA_SIG_ALGORITHMS.includes(options.kryptos.algorithm)) {
|
|
15
|
+
throw new RsaError("RsaKit only supports signing algorithms (RS256, RS384, RS512, PS256, PS384, PS512)");
|
|
19
16
|
}
|
|
20
17
|
this.kryptos = options.kryptos;
|
|
21
18
|
}
|
|
22
19
|
sign(data) {
|
|
23
|
-
return
|
|
20
|
+
return createRsaSignature({
|
|
24
21
|
data,
|
|
25
22
|
dsaEncoding: this.dsa,
|
|
26
23
|
kryptos: this.kryptos,
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
26
|
verify(data, signature) {
|
|
30
|
-
return
|
|
27
|
+
return verifyRsaSignature({
|
|
31
28
|
data,
|
|
32
29
|
dsaEncoding: this.dsa,
|
|
33
30
|
encoding: this.encoding,
|
|
@@ -36,7 +33,7 @@ class RsaKit {
|
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
35
|
assert(data, signature) {
|
|
39
|
-
return
|
|
36
|
+
return assertRsaSignature({
|
|
40
37
|
data,
|
|
41
38
|
dsaEncoding: this.dsa,
|
|
42
39
|
encoding: this.encoding,
|
|
@@ -48,5 +45,4 @@ class RsaKit {
|
|
|
48
45
|
return data.toString(this.encoding);
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
exports.RsaKit = RsaKit;
|
|
52
48
|
//# sourceMappingURL=RsaKit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RsaKit.js","sourceRoot":"","sources":["../../src/classes/RsaKit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RsaKit.js","sourceRoot":"","sources":["../../src/classes/RsaKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,kBAAkB,GAEnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,OAAO,MAAM;IACA,GAAG,CAAc;IACjB,QAAQ,CAAiB;IACzB,OAAO,CAAc;IAEtC,YAAmB,OAAsB;QACvC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC;QAE7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,QAAQ,CAAC,0BAA0B,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,SAA4B,CAAC,EAAE,CAAC;YAC/E,MAAM,IAAI,QAAQ,CAChB,oFAAoF,CACrF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;IAEM,IAAI,CAAC,IAAa;QACvB,OAAO,kBAAkB,CAAC;YACxB,IAAI;YACJ,WAAW,EAAE,IAAI,CAAC,GAAG;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,IAAa,EAAE,SAAkB;QAC7C,OAAO,kBAAkB,CAAC;YACxB,IAAI;YACJ,WAAW,EAAE,IAAI,CAAC,GAAG;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,IAAa,EAAE,SAAkB;QAC7C,OAAO,kBAAkB,CAAC;YACxB,IAAI;YACJ,WAAW,EAAE,IAAI,CAAC,GAAG;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF"}
|
package/dist/classes/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./RsaKit";
|
|
1
|
+
export * from "./RsaKit.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/dist/classes/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./RsaKit"), exports);
|
|
1
|
+
export * from "./RsaKit.js";
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/dist/errors/RsaError.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.RsaError = void 0;
|
|
4
|
-
const errors_1 = require("@lindorm/errors");
|
|
5
|
-
class RsaError extends errors_1.LindormError {
|
|
1
|
+
import { LindormError } from "@lindorm/errors";
|
|
2
|
+
export class RsaError extends LindormError {
|
|
6
3
|
}
|
|
7
|
-
exports.RsaError = RsaError;
|
|
8
4
|
//# sourceMappingURL=RsaError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RsaError.js","sourceRoot":"","sources":["../../src/errors/RsaError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RsaError.js","sourceRoot":"","sources":["../../src/errors/RsaError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,QAAS,SAAQ,YAAY;CAAG"}
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./RsaError";
|
|
1
|
+
export * from "./RsaError.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/errors/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./RsaError"), exports);
|
|
1
|
+
export * from "./RsaError.js";
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./classes";
|
|
2
|
-
export * from "./errors";
|
|
3
|
-
export * from "./types";
|
|
1
|
+
export * from "./classes/index.js";
|
|
2
|
+
export * from "./errors/index.js";
|
|
3
|
+
export * from "./types/index.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./classes"), exports);
|
|
18
|
-
__exportStar(require("./errors"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * from "./classes/index.js";
|
|
2
|
+
export * from "./errors/index.js";
|
|
3
|
+
export * from "./types/index.js";
|
|
20
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IKryptosRsa } from "@lindorm/kryptos";
|
|
2
|
-
import { DsaEncoding } from "@lindorm/types";
|
|
3
|
-
import { SignPrivateKeyInput, VerifyPublicKeyInput } from "crypto";
|
|
1
|
+
import type { IKryptosRsa } from "@lindorm/kryptos";
|
|
2
|
+
import type { DsaEncoding } from "@lindorm/types";
|
|
3
|
+
import type { SignPrivateKeyInput, VerifyPublicKeyInput } from "crypto";
|
|
4
4
|
export declare const getSignKey: (kryptos: IKryptosRsa, dsaEncoding: DsaEncoding) => SignPrivateKeyInput | string;
|
|
5
5
|
export declare const getVerifyKey: (kryptos: IKryptosRsa, dsaEncoding: DsaEncoding) => VerifyPublicKeyInput | string;
|
|
6
6
|
//# sourceMappingURL=get-key.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-key.d.ts","sourceRoot":"","sources":["../../src/internal/get-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-key.d.ts","sourceRoot":"","sources":["../../src/internal/get-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAKxE,eAAO,MAAM,UAAU,GACrB,SAAS,WAAW,EACpB,aAAa,WAAW,KACvB,mBAAmB,GAAG,MAqBxB,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,SAAS,WAAW,EACpB,aAAa,WAAW,KACvB,oBAAoB,GAAG,MAqBzB,CAAC"}
|
package/dist/internal/get-key.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getVerifyKey = exports.getSignKey = void 0;
|
|
4
|
-
const constants_1 = require("constants");
|
|
5
|
-
const errors_1 = require("../errors");
|
|
1
|
+
import { RSA_PKCS1_PSS_PADDING } from "constants";
|
|
2
|
+
import { RsaError } from "../errors/index.js";
|
|
6
3
|
const RSA_PKCS1_SALT_LENGTH = 32;
|
|
7
|
-
const getSignKey = (kryptos, dsaEncoding) => {
|
|
4
|
+
export const getSignKey = (kryptos, dsaEncoding) => {
|
|
8
5
|
const { privateKey } = kryptos.export("pem");
|
|
9
6
|
if (!privateKey) {
|
|
10
|
-
throw new
|
|
7
|
+
throw new RsaError("Private key not found in key set", { debug: { kryptos } });
|
|
11
8
|
}
|
|
12
9
|
if (kryptos.algorithm.startsWith("PS")) {
|
|
13
10
|
return {
|
|
14
11
|
key: privateKey,
|
|
15
|
-
padding:
|
|
12
|
+
padding: RSA_PKCS1_PSS_PADDING,
|
|
16
13
|
saltLength: RSA_PKCS1_SALT_LENGTH,
|
|
17
14
|
dsaEncoding,
|
|
18
15
|
};
|
|
@@ -20,18 +17,17 @@ const getSignKey = (kryptos, dsaEncoding) => {
|
|
|
20
17
|
if (kryptos.algorithm.startsWith("RS")) {
|
|
21
18
|
return { key: privateKey, dsaEncoding };
|
|
22
19
|
}
|
|
23
|
-
throw new
|
|
20
|
+
throw new RsaError("Unsupported RSA algorithm", { debug: { kryptos } });
|
|
24
21
|
};
|
|
25
|
-
|
|
26
|
-
const getVerifyKey = (kryptos, dsaEncoding) => {
|
|
22
|
+
export const getVerifyKey = (kryptos, dsaEncoding) => {
|
|
27
23
|
const { publicKey } = kryptos.export("pem");
|
|
28
24
|
if (!publicKey) {
|
|
29
|
-
throw new
|
|
25
|
+
throw new RsaError("Public key not found in key set", { debug: { kryptos } });
|
|
30
26
|
}
|
|
31
27
|
if (kryptos.algorithm.startsWith("PS")) {
|
|
32
28
|
return {
|
|
33
29
|
key: publicKey,
|
|
34
|
-
padding:
|
|
30
|
+
padding: RSA_PKCS1_PSS_PADDING,
|
|
35
31
|
saltLength: RSA_PKCS1_SALT_LENGTH,
|
|
36
32
|
dsaEncoding,
|
|
37
33
|
};
|
|
@@ -39,7 +35,6 @@ const getVerifyKey = (kryptos, dsaEncoding) => {
|
|
|
39
35
|
if (kryptos.algorithm.startsWith("RS")) {
|
|
40
36
|
return { key: publicKey, dsaEncoding };
|
|
41
37
|
}
|
|
42
|
-
throw new
|
|
38
|
+
throw new RsaError("Unsupported RSA algorithm", { debug: { kryptos } });
|
|
43
39
|
};
|
|
44
|
-
exports.getVerifyKey = getVerifyKey;
|
|
45
40
|
//# sourceMappingURL=get-key.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-key.js","sourceRoot":"","sources":["../../src/internal/get-key.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-key.js","sourceRoot":"","sources":["../../src/internal/get-key.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,qBAAqB,GAAG,EAAW,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,OAAoB,EACpB,WAAwB,EACM,EAAE;IAChC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE7C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,QAAQ,CAAC,kCAAkC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,OAAO;YACL,GAAG,EAAE,UAAU;YACf,OAAO,EAAE,qBAAqB;YAC9B,UAAU,EAAE,qBAAqB;YACjC,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED,MAAM,IAAI,QAAQ,CAAC,2BAA2B,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,OAAoB,EACpB,WAAwB,EACO,EAAE;IACjC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE5C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,QAAQ,CAAC,iCAAiC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,OAAO;YACL,GAAG,EAAE,SAAS;YACd,OAAO,EAAE,qBAAqB;YAC9B,UAAU,EAAE,qBAAqB;YACjC,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;IACzC,CAAC;IAED,MAAM,IAAI,QAAQ,CAAC,2BAA2B,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC"}
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./get-key";
|
|
2
|
-
export * from "./map-algorithm";
|
|
3
|
-
export * from "./rsa-signature";
|
|
1
|
+
export * from "./get-key.js";
|
|
2
|
+
export * from "./map-algorithm.js";
|
|
3
|
+
export * from "./rsa-signature.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
package/dist/internal/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./get-key"), exports);
|
|
18
|
-
__exportStar(require("./map-algorithm"), exports);
|
|
19
|
-
__exportStar(require("./rsa-signature"), exports);
|
|
1
|
+
export * from "./get-key.js";
|
|
2
|
+
export * from "./map-algorithm.js";
|
|
3
|
+
export * from "./rsa-signature.js";
|
|
20
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IKryptosRsa } from "@lindorm/kryptos";
|
|
2
|
-
import { ShaAlgorithm } from "@lindorm/types";
|
|
1
|
+
import { type IKryptosRsa } from "@lindorm/kryptos";
|
|
2
|
+
import type { ShaAlgorithm } from "@lindorm/types";
|
|
3
3
|
export declare const mapRsaAlgorithm: (kryptos: IKryptosRsa) => ShaAlgorithm;
|
|
4
4
|
//# sourceMappingURL=map-algorithm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-algorithm.d.ts","sourceRoot":"","sources":["../../src/internal/map-algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"map-algorithm.d.ts","sourceRoot":"","sources":["../../src/internal/map-algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAYnD,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,YAQtD,CAAC"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.mapRsaAlgorithm = void 0;
|
|
4
|
-
const kryptos_1 = require("@lindorm/kryptos");
|
|
5
|
-
const errors_1 = require("../errors");
|
|
1
|
+
import { RSA_SIG_ALGORITHMS, } from "@lindorm/kryptos";
|
|
2
|
+
import { RsaError } from "../errors/index.js";
|
|
6
3
|
const RSA_SIG_ALGORITHM_MAP = {
|
|
7
4
|
RS256: "SHA256",
|
|
8
5
|
RS384: "SHA384",
|
|
@@ -11,13 +8,12 @@ const RSA_SIG_ALGORITHM_MAP = {
|
|
|
11
8
|
PS384: "SHA384",
|
|
12
9
|
PS512: "SHA512",
|
|
13
10
|
};
|
|
14
|
-
const mapRsaAlgorithm = (kryptos) => {
|
|
15
|
-
if (!
|
|
16
|
-
throw new
|
|
11
|
+
export const mapRsaAlgorithm = (kryptos) => {
|
|
12
|
+
if (!RSA_SIG_ALGORITHMS.includes(kryptos.algorithm)) {
|
|
13
|
+
throw new RsaError("Unsupported RSA algorithm for signing", {
|
|
17
14
|
debug: { algorithm: kryptos.algorithm },
|
|
18
15
|
});
|
|
19
16
|
}
|
|
20
17
|
return RSA_SIG_ALGORITHM_MAP[kryptos.algorithm];
|
|
21
18
|
};
|
|
22
|
-
exports.mapRsaAlgorithm = mapRsaAlgorithm;
|
|
23
19
|
//# sourceMappingURL=map-algorithm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-algorithm.js","sourceRoot":"","sources":["../../src/internal/map-algorithm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"map-algorithm.js","sourceRoot":"","sources":["../../src/internal/map-algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,GAEnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,qBAAqB,GAA0C;IACnE,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAoB,EAAgB,EAAE;IACpE,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,SAA4B,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,QAAQ,CAAC,uCAAuC,EAAE;YAC1D,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,qBAAqB,CAAC,OAAO,CAAC,SAA4B,CAAC,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateRsaSignatureOptions, VerifyRsaSignatureOptions } from "../types";
|
|
1
|
+
import type { CreateRsaSignatureOptions, VerifyRsaSignatureOptions } from "../types/index.js";
|
|
2
2
|
export declare const createRsaSignature: ({ data, dsaEncoding, kryptos, }: CreateRsaSignatureOptions) => Buffer;
|
|
3
3
|
export declare const verifyRsaSignature: ({ data, dsaEncoding, encoding, kryptos, signature, }: VerifyRsaSignatureOptions) => boolean;
|
|
4
4
|
export declare const assertRsaSignature: (options: VerifyRsaSignatureOptions) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsa-signature.d.ts","sourceRoot":"","sources":["../../src/internal/rsa-signature.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"rsa-signature.d.ts","sourceRoot":"","sources":["../../src/internal/rsa-signature.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAI3B,eAAO,MAAM,kBAAkB,GAAI,iCAIhC,yBAAyB,KAAG,MAIY,CAAC;AAE5C,eAAO,MAAM,kBAAkB,GAAI,sDAMhC,yBAAyB,KAAG,OAO1B,CAAC;AAEN,eAAO,MAAM,kBAAkB,GAAI,SAAS,yBAAyB,KAAG,IAGvE,CAAC"}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const get_key_1 = require("./get-key");
|
|
8
|
-
const map_algorithm_1 = require("./map-algorithm");
|
|
9
|
-
const createRsaSignature = ({ data, dsaEncoding, kryptos, }) => (0, crypto_1.createSign)((0, map_algorithm_1.mapRsaAlgorithm)(kryptos))
|
|
1
|
+
import { isString } from "@lindorm/is";
|
|
2
|
+
import { createSign, createVerify } from "crypto";
|
|
3
|
+
import { RsaError } from "../errors/index.js";
|
|
4
|
+
import { getSignKey, getVerifyKey } from "./get-key.js";
|
|
5
|
+
import { mapRsaAlgorithm } from "./map-algorithm.js";
|
|
6
|
+
export const createRsaSignature = ({ data, dsaEncoding, kryptos, }) => createSign(mapRsaAlgorithm(kryptos))
|
|
10
7
|
.update(data)
|
|
11
8
|
.end()
|
|
12
|
-
.sign(
|
|
13
|
-
|
|
14
|
-
const verifyRsaSignature = ({ data, dsaEncoding, encoding, kryptos, signature, }) => (0, crypto_1.createVerify)((0, map_algorithm_1.mapRsaAlgorithm)(kryptos))
|
|
9
|
+
.sign(getSignKey(kryptos, dsaEncoding));
|
|
10
|
+
export const verifyRsaSignature = ({ data, dsaEncoding, encoding, kryptos, signature, }) => createVerify(mapRsaAlgorithm(kryptos))
|
|
15
11
|
.update(data)
|
|
16
12
|
.end()
|
|
17
|
-
.verify(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if ((0, exports.verifyRsaSignature)(options))
|
|
13
|
+
.verify(getVerifyKey(kryptos, dsaEncoding), isString(signature) ? Buffer.from(signature, encoding) : signature);
|
|
14
|
+
export const assertRsaSignature = (options) => {
|
|
15
|
+
if (verifyRsaSignature(options))
|
|
21
16
|
return;
|
|
22
|
-
throw new
|
|
17
|
+
throw new RsaError("Invalid signature");
|
|
23
18
|
};
|
|
24
|
-
exports.assertRsaSignature = assertRsaSignature;
|
|
25
19
|
//# sourceMappingURL=rsa-signature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsa-signature.js","sourceRoot":"","sources":["../../src/internal/rsa-signature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rsa-signature.js","sourceRoot":"","sources":["../../src/internal/rsa-signature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAK9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,IAAI,EACJ,WAAW,EACX,OAAO,GACmB,EAAU,EAAE,CACtC,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;KACjC,MAAM,CAAC,IAAI,CAAC;KACZ,GAAG,EAAE;KACL,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,GACiB,EAAW,EAAE,CACvC,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;KACnC,MAAM,CAAC,IAAI,CAAC;KACZ,GAAG,EAAE;KACL,MAAM,CACL,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,EAClC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CACnE,CAAC;AAEN,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAkC,EAAQ,EAAE;IAC7E,IAAI,kBAAkB,CAAC,OAAO,CAAC;QAAE,OAAO;IACxC,MAAM,IAAI,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./rsa-kit";
|
|
1
|
+
export * from "./rsa-kit.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./rsa-kit"), exports);
|
|
1
|
+
export * from "./rsa-kit.js";
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/dist/types/rsa-kit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IKryptos, IKryptosRsa } from "@lindorm/kryptos";
|
|
2
|
-
import { DsaEncoding, KeyData } from "@lindorm/types";
|
|
1
|
+
import type { IKryptos, IKryptosRsa } from "@lindorm/kryptos";
|
|
2
|
+
import type { DsaEncoding, KeyData } from "@lindorm/types";
|
|
3
3
|
export type CreateRsaSignatureOptions = {
|
|
4
4
|
data: KeyData;
|
|
5
5
|
dsaEncoding: DsaEncoding;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsa-kit.d.ts","sourceRoot":"","sources":["../../src/types/rsa-kit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"rsa-kit.d.ts","sourceRoot":"","sources":["../../src/types/rsa-kit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC"}
|
package/dist/types/rsa-kit.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lindorm/rsa",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"author": "Jonn Nilsson",
|
|
6
6
|
"repository": {
|
|
@@ -11,15 +11,24 @@
|
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
15
18
|
"typings": "dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
16
25
|
"scripts": {
|
|
17
26
|
"build": "rimraf dist && tsc -b ./tsconfig.build.json",
|
|
18
27
|
"example": "ts-node example",
|
|
19
28
|
"prettier": "prettier --write ./src/*",
|
|
20
|
-
"test": "
|
|
21
|
-
"test:
|
|
22
|
-
"test:watch": "
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:unit": "vitest run --exclude '**/*.integration.test.ts'",
|
|
31
|
+
"test:watch": "vitest",
|
|
23
32
|
"typecheck": "tsc",
|
|
24
33
|
"typecheck:watch": "tsc --watch",
|
|
25
34
|
"update": "ncu -i",
|
|
@@ -27,12 +36,10 @@
|
|
|
27
36
|
"verify": "npm run typecheck && npm run build && npm test"
|
|
28
37
|
},
|
|
29
38
|
"dependencies": {
|
|
30
|
-
"@lindorm/errors": "^0.1
|
|
31
|
-
"@lindorm/is": "^0.1
|
|
32
|
-
"@lindorm/kryptos": "^0.
|
|
33
|
-
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@lindorm/types": "^0.5.0"
|
|
39
|
+
"@lindorm/errors": "^0.2.1",
|
|
40
|
+
"@lindorm/is": "^0.2.1",
|
|
41
|
+
"@lindorm/kryptos": "^0.8.1",
|
|
42
|
+
"@lindorm/types": "^0.6.1"
|
|
36
43
|
},
|
|
37
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "da067071d415e07d7d25bbac1621b9e02fcc3166"
|
|
38
45
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [0.2.11](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.10...@lindorm/rsa@0.2.11) (2026-04-19)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
9
|
-
|
|
10
|
-
## [0.2.10](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.9...@lindorm/rsa@0.2.10) (2026-04-15)
|
|
11
|
-
|
|
12
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
13
|
-
|
|
14
|
-
## [0.2.9](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.8...@lindorm/rsa@0.2.9) (2026-04-01)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
17
|
-
|
|
18
|
-
## [0.2.8](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.7...@lindorm/rsa@0.2.8) (2026-03-13)
|
|
19
|
-
|
|
20
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
21
|
-
|
|
22
|
-
## [0.2.7](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.6...@lindorm/rsa@0.2.7) (2026-03-13)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
25
|
-
|
|
26
|
-
## [0.2.6](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.5...@lindorm/rsa@0.2.6) (2026-02-17)
|
|
27
|
-
|
|
28
|
-
### Bug Fixes
|
|
29
|
-
|
|
30
|
-
- **ec,oct,okp,rsa:** harden signing kits with validation and security fixes ([910f016](https://github.com/lindorm-io/monorepo/commit/910f01669aefcb4e6eb69c0297291fe2404232f8))
|
|
31
|
-
|
|
32
|
-
## [0.2.5](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.4...@lindorm/rsa@0.2.5) (2025-09-18)
|
|
33
|
-
|
|
34
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
35
|
-
|
|
36
|
-
## [0.2.4](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.3...@lindorm/rsa@0.2.4) (2025-07-19)
|
|
37
|
-
|
|
38
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
39
|
-
|
|
40
|
-
## [0.2.3](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.2...@lindorm/rsa@0.2.3) (2025-07-12)
|
|
41
|
-
|
|
42
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
43
|
-
|
|
44
|
-
## [0.2.2](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.1...@lindorm/rsa@0.2.2) (2025-07-10)
|
|
45
|
-
|
|
46
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
47
|
-
|
|
48
|
-
## [0.2.1](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.0...@lindorm/rsa@0.2.1) (2025-07-02)
|
|
49
|
-
|
|
50
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
51
|
-
|
|
52
|
-
# [0.2.0](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.9...@lindorm/rsa@0.2.0) (2025-06-17)
|
|
53
|
-
|
|
54
|
-
### Bug Fixes
|
|
55
|
-
|
|
56
|
-
- add and implement keykit interface ([70762aa](https://github.com/lindorm-io/monorepo/commit/70762aaca51c9fe904121b69b4bc072cdd89c8a2))
|
|
57
|
-
- align with changes to kryptos ([74bbfff](https://github.com/lindorm-io/monorepo/commit/74bbfff6fb50504dc70327f7de3fd6d4b45cb65a))
|
|
58
|
-
- align with kryptos changes ([206eb38](https://github.com/lindorm-io/monorepo/commit/206eb38ae2a03b14973e706035c87a953cc753af))
|
|
59
|
-
|
|
60
|
-
### Features
|
|
61
|
-
|
|
62
|
-
- add dsa encoding ([a893601](https://github.com/lindorm-io/monorepo/commit/a8936015a9408733445cdbda8d8b70d633a2330a))
|
|
63
|
-
- upgrade key kits ([198956c](https://github.com/lindorm-io/monorepo/commit/198956c5fa276ae192af22cb204b3c2158c74339))
|
|
64
|
-
|
|
65
|
-
## [0.1.9](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.8...@lindorm/rsa@0.1.9) (2025-01-28)
|
|
66
|
-
|
|
67
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
68
|
-
|
|
69
|
-
## [0.1.8](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.7...@lindorm/rsa@0.1.8) (2024-10-12)
|
|
70
|
-
|
|
71
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
72
|
-
|
|
73
|
-
## [0.1.7](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.6...@lindorm/rsa@0.1.7) (2024-10-09)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
76
|
-
|
|
77
|
-
## [0.1.6](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.5...@lindorm/rsa@0.1.6) (2024-09-25)
|
|
78
|
-
|
|
79
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
80
|
-
|
|
81
|
-
## [0.1.5](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.4...@lindorm/rsa@0.1.5) (2024-09-23)
|
|
82
|
-
|
|
83
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
84
|
-
|
|
85
|
-
## [0.1.4](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.3...@lindorm/rsa@0.1.4) (2024-09-20)
|
|
86
|
-
|
|
87
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
88
|
-
|
|
89
|
-
## [0.1.3](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.2...@lindorm/rsa@0.1.3) (2024-05-20)
|
|
90
|
-
|
|
91
|
-
**Note:** Version bump only for package @lindorm/rsa
|
|
92
|
-
|
|
93
|
-
## [0.1.2](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.1...@lindorm/rsa@0.1.2) (2024-05-19)
|
|
94
|
-
|
|
95
|
-
### Bug Fixes
|
|
96
|
-
|
|
97
|
-
- align with kryptos changes ([344c4e2](https://github.com/lindorm-io/monorepo/commit/344c4e2fad07e66c91f7e0820bfc929c1f8ffcab))
|
|
98
|
-
- improve kryptos generate method ([9e7098d](https://github.com/lindorm-io/monorepo/commit/9e7098d4b219b11140e28e554ffd573204772249))
|
|
99
|
-
- simplify interfaces with kryptos metadata ([c4075d2](https://github.com/lindorm-io/monorepo/commit/c4075d2e133c2fe0a1fafa548da68db34b3407c6))
|
|
100
|
-
- use crypto constants ([2fc218e](https://github.com/lindorm-io/monorepo/commit/2fc218e8c279d23bdb386421a9896bbf9896e72b))
|
|
101
|
-
|
|
102
|
-
## [0.1.1](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.0...@lindorm/rsa@0.1.1) (2024-05-12)
|
|
103
|
-
|
|
104
|
-
### Bug Fixes
|
|
105
|
-
|
|
106
|
-
- rename signature to hash ([e2a536e](https://github.com/lindorm-io/monorepo/commit/e2a536e712e81e61bb8c16c447a734a8aa67eca2))
|
|
107
|
-
- upgrade code style for better alignment ([2fc8205](https://github.com/lindorm-io/monorepo/commit/2fc82054fdce72d58a0a6b504643eaecddbb60fa))
|
|
108
|
-
|
|
109
|
-
# 0.1.0 (2024-05-11)
|
|
110
|
-
|
|
111
|
-
### Features
|
|
112
|
-
|
|
113
|
-
- initialise rsa package ([e16e47b](https://github.com/lindorm-io/monorepo/commit/e16e47b7263ee4b5392f2219df9f20355eb7fd45))
|