@lindorm/rsa 0.2.0 → 0.2.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/CHANGELOG.md +4 -0
- package/README.md +81 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.2.1](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.2.0...@lindorm/rsa@0.2.1) (2025-07-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @lindorm/rsa
|
|
9
|
+
|
|
6
10
|
# [0.2.0](https://github.com/lindorm-io/monorepo/compare/@lindorm/rsa@0.1.9...@lindorm/rsa@0.2.0) (2025-06-17)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -1 +1,82 @@
|
|
|
1
1
|
# @lindorm/rsa
|
|
2
|
+
|
|
3
|
+
Lightweight **RSA signing / verification kit** that wraps a `RSxxx` key from
|
|
4
|
+
[`@lindorm/kryptos`](../kryptos). Provides a convenient `RsaKit` class that fulfils the `IKeyKit`
|
|
5
|
+
contract used by the Lindorm crypto packages.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @lindorm/rsa
|
|
13
|
+
# or
|
|
14
|
+
yarn add @lindorm/rsa
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Generate or import a key via Kryptos:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { KryptosKit } from '@lindorm/kryptos';
|
|
21
|
+
|
|
22
|
+
const RS256 = KryptosKit.generate.rsa({ alg: 'RS256', use: 'sig', modulusLength: 2048 });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { RsaKit } from '@lindorm/rsa';
|
|
31
|
+
|
|
32
|
+
const kit = new RsaKit({ kryptos: RS256, encoding: 'base64url' });
|
|
33
|
+
|
|
34
|
+
const signature = kit.sign('hello');
|
|
35
|
+
|
|
36
|
+
kit.assert('hello', signature); // throws RsaError if invalid
|
|
37
|
+
|
|
38
|
+
console.log(kit.format(signature)); // string representation
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### DSA encoding
|
|
42
|
+
|
|
43
|
+
Set `dsa: 'ieee-p1363'` when you need raw concatenated r||s encoding instead of DER:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const kit = new RsaKit({ kryptos: RS256, dsa: 'ieee-p1363' });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
class RsaKit implements IKeyKit {
|
|
55
|
+
constructor(options: {
|
|
56
|
+
kryptos: IKryptosRsa;
|
|
57
|
+
dsa?: DsaEncoding; // 'der' | 'ieee-p1363' (default 'der')
|
|
58
|
+
encoding?: BufferEncoding; // default 'base64'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
sign(data: KeyData): Buffer;
|
|
62
|
+
verify(data: KeyData, signature: KeyData): boolean;
|
|
63
|
+
assert(data: KeyData, signature: KeyData): void; // throws RsaError
|
|
64
|
+
format(buf: Buffer): string; // encode Buffer → string
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`KeyData` accepts `Buffer`, `string` or `Uint8Array`.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## TypeScript
|
|
73
|
+
|
|
74
|
+
Written in TS; declaration files included. Runtime dependencies are limited to Node’s `crypto`
|
|
75
|
+
module plus Lindorm utilities.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
AGPL-3.0-or-later – see the root [`LICENSE`](../../LICENSE).
|
|
82
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lindorm/rsa",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"author": "Jonn Nilsson",
|
|
6
6
|
"repository": {
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"update:auto": "ncu -u"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@lindorm/errors": "^0.1.
|
|
32
|
+
"@lindorm/errors": "^0.1.9",
|
|
33
33
|
"@lindorm/is": "^0.1.8",
|
|
34
|
-
"@lindorm/kryptos": "^0.4.
|
|
34
|
+
"@lindorm/kryptos": "^0.4.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@lindorm/types": "^0.3.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e66150efb6d7a4688bcece59481ab98d54865af3"
|
|
40
40
|
}
|