@verdaccio/signature 8.0.0-next-8.30 → 8.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/README.md +36 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -15,6 +15,42 @@
|
|
|
15
15
|
[](https://hub.docker.com/r/verdaccio/verdaccio)
|
|
16
16
|
[](https://github.com/verdaccio/verdaccio/stargazers)
|
|
17
17
|
|
|
18
|
+
> **Note:** This package is mostly for internal use by Verdaccio and is only intended to be used with Verdaccio 6.x.
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
The `@verdaccio/signature` package handles cryptographic signing and verification of JWT tokens, as well as legacy AES encryption/decryption for Verdaccio authentication tokens.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @verdaccio/signature
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { aesDecrypt, aesEncrypt, signPayload, verifyPayload } from '@verdaccio/signature';
|
|
34
|
+
|
|
35
|
+
// Sign a JWT token
|
|
36
|
+
const token = await signPayload(remoteUser, secret, { expiresIn: '7d' });
|
|
37
|
+
|
|
38
|
+
// Verify a JWT token
|
|
39
|
+
const payload = verifyPayload(token, secret);
|
|
40
|
+
|
|
41
|
+
// AES encryption/decryption
|
|
42
|
+
const encrypted = aesEncrypt(Buffer.from('value'), 'secret-key');
|
|
43
|
+
const decrypted = aesDecrypt(encrypted, 'secret-key');
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### API
|
|
47
|
+
|
|
48
|
+
- **`signPayload(payload, secret, options)`** - Signs a `RemoteUser` payload into a JWT token
|
|
49
|
+
- **`verifyPayload(token, secret)`** - Verifies and decodes a JWT token
|
|
50
|
+
- **`aesEncrypt(value, key)`** - Encrypts strings using AES-256-CTR
|
|
51
|
+
- **`aesDecrypt(value, key)`** - Decrypts AES-encrypted strings
|
|
52
|
+
- **`parseBasicPayload(credentials)`** - Parses basic auth credentials
|
|
53
|
+
|
|
18
54
|
## Donations
|
|
19
55
|
|
|
20
56
|
Verdaccio is run by **volunteers**; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - **your logo might end up in this readme.** 😉
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/signature",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "Verdaccio Signature Utilities",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"node": ">=18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@verdaccio/config": "8.
|
|
37
|
-
"@verdaccio/core": "8.
|
|
36
|
+
"@verdaccio/config": "8.1.0",
|
|
37
|
+
"@verdaccio/core": "8.1.0",
|
|
38
38
|
"jsonwebtoken": "9.0.3",
|
|
39
39
|
"debug": "4.4.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@verdaccio/types": "13.0.0
|
|
43
|
-
"vitest": "
|
|
42
|
+
"@verdaccio/types": "13.0.0",
|
|
43
|
+
"vitest": "4.1.2"
|
|
44
44
|
},
|
|
45
45
|
"funding": {
|
|
46
46
|
"type": "opencollective",
|