@riao/crypto 1.0.0 → 1.1.0

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.
Files changed (2) hide show
  1. package/README.md +69 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,22 +1,87 @@
1
1
  # riao-crypto
2
2
 
3
- {{ remrg:task Write a brief project description }}
3
+ A comprehensive TypeScript cryptography library providing secure encryption, hashing, JWT management, and key generation utilities.
4
+
5
+ ## Features
6
+
7
+ - **Encryption & Decryption**: RSA public-key encryption with OAEP padding and SHA-256 hashing
8
+ - **Hashing**: Secure password and data hashing with bcrypt
9
+ - **JWT Management**: Sign and verify JSON Web Tokens with HS256 and RS256 algorithms
10
+ - **Key Pair Generation**: Generate and manage RSA key pairs
11
+ - **Secret Management**: Flexible secret handling for different cryptographic algorithms
12
+ - **TypeScript Support**: Fully typed API with comprehensive type safety
4
13
 
5
14
  ## Installation
6
15
 
7
16
  ```bash
8
- npm install riao-crypto
17
+ npm install @riao/crypto
9
18
  ```
10
19
 
11
20
  ## Getting Started
12
21
 
13
22
  Read the [Getting Started Guide](./docs/guides/getting-started.md) to get started.
14
23
 
24
+ ## Usage
25
+
26
+ ### Encryption & Decryption
27
+
28
+ ```typescript
29
+ import { generateKeyPair } from '@riao/crypto';
30
+ import { Encryptor, Decryptor } from '@riao/crypto';
31
+
32
+ const { publicKey, privateKey } = await generateKeyPair();
33
+
34
+ const encryptor = new Encryptor(publicKey);
35
+ const encrypted = encryptor.encrypt('secret message');
36
+
37
+ const decryptor = new Decryptor(privateKey);
38
+ const decrypted = decryptor.decrypt(encrypted);
39
+ ```
40
+
41
+ ### Hashing
42
+
43
+ ```typescript
44
+ import { hashPassword, comparePassword } from '@riao/crypto';
45
+
46
+ const hashed = await hashPassword('myPassword');
47
+ const isMatch = await comparePassword('myPassword', hashed);
48
+ ```
49
+
50
+ ### JWT
51
+
52
+ ```typescript
53
+ import { Jwt } from '@riao/crypto';
54
+
55
+ const jwt = new Jwt({ secret: 'your-secret-key' });
56
+ const token = jwt.sign({ userId: 123 }, { expiresIn: '1h' });
57
+ const payload = jwt.verify(token);
58
+ ```
59
+
60
+ ### Key Pair Generation
61
+
62
+ ```typescript
63
+ import { generateKeyPair } from '@riao/crypto';
64
+
65
+ const { publicKey, privateKey } = await generateKeyPair();
66
+ ```
67
+
68
+ For detailed guides on each module, see:
69
+
70
+ - [Encryption & Decryption Guide](./docs/guides/encryptor-decryptor-guide.md)
71
+ - [Hashing Guide](./docs/guides/hash-guide.md)
72
+ - [JWT Guide](./docs/guides/jwt-guide.md)
73
+ - [Key Pair Guide](./docs/guides/keypair-guide.md)
74
+ - [Crypto Guide](./docs/guides/crypto-guide.md)
75
+
76
+ ## Documentation
77
+
78
+ - [Architecture Overview](./docs/architecture/overview.md)
79
+
15
80
  ## Contributing
16
81
 
17
82
  - [Contributing Guide](./CONTRIBUTING.md)
18
- - [Setup Guide](./docs/guides//setup.md)
19
- - [Development Guide](./docs/guides/development.md)
83
+ - [Setup Guide](./docs/contributing/setup.md)
84
+ - [Development Guide](./docs/contributing/development.md)
20
85
 
21
86
  ## License
22
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riao/crypto",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "author": "riao-project",
6
6
  "license": "MIT",