You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-13Lines changed: 47 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,13 @@ ___
11
11
**AuthCrypto** is a powerful library for handling cryptographic operations and JWT (JSON Web Tokens) in Node.js applications. It provides utilities for hashing passwords, generating JWT tokens, and more.
12
12
13
13
> [!IMPORTANT]
14
+
>
14
15
> 🌟 **Support Our Open-Source Development!** 🌟
15
-
> We need your support to keep our projects going! If you find our > work valuable, please consider contributing. Your support helps us > continue to develop and maintain these tools.
16
+
> We need your support to keep our projects going! If you find our work valuable, please consider contributing. Your support helps us continue to develop and maintain these tools.
16
17
>
17
18
> **[Click here to support us!](https://fund.nasriya.net/)**
18
19
>
19
-
> Every contribution, big or small, makes a difference. Thank you for > your generosity and support!
20
+
> Every contribution, big or small, makes a difference. Thank you for your generosity and support!
20
21
___
21
22
## Features
22
23
@@ -53,14 +54,10 @@ ___
53
54
54
55
## Configuration
55
56
56
-
**AuthCrypto** reads configuration values from environment variables:
57
+
**AuthCrypto** reads configuration values from environment variables or by setting them up manually:
57
58
58
-
-`AuthCrypto_ROUNDS`: The number of hashing rounds for password hashing.
59
-
-`AuthCrypto_PASSWORDS_MIN`: Minimum length for passwords (default: `8`).
60
-
-`AuthCrypto_PASSWORDS_MAX`: Maximum length for passwords (default: `32`).
61
-
-`AuthCrypto_SECRET`**`*`**: A secret phrase to generate and verify JWT. Can be generated from [crypto.generateSecret()](#generating-secrets).
62
-
63
-
You can set these values in your `.env` file:
59
+
### A) Environment Variables
60
+
If you have full control over the source code, you can setup a `.env` file with the following properties:
64
61
65
62
```env
66
63
AuthCrypto_ROUNDS=10
@@ -69,9 +66,34 @@ AuthCrypto_PASSWORDS_MAX=32
69
66
AuthCrypto_SECRET=Your_secret
70
67
```
71
68
69
+
-`AuthCrypto_ROUNDS`: The number of hashing rounds for password hashing.
70
+
-`AuthCrypto_PASSWORDS_MIN`: Minimum length for passwords (default: `8`, min: `8`).
71
+
-`AuthCrypto_PASSWORDS_MAX`: Maximum length for passwords (default: `32`).
72
+
-`AuthCrypto_SECRET`**`*`**: A secret phrase to generate and verify JWT. Can be generated from [crypto.generateSecret()](#generating-secrets).
73
+
74
+
### B) Manual Configuration
75
+
You can manually set some or all configurations using the `config` module as follows:
> You must specify the `Crypto JWT_SECRET` variable in your environment, otherwise, your system might be at risk of forgery
96
+
> You must specify the `Crypto JWT_SECRET` variable in your environment, or set it using `authCrypto.config.jwtSecret`, otherwise, your system might be at risk of forgery
75
97
___
76
98
77
99
## Usage
@@ -158,7 +180,7 @@ Explanation:
158
180
The `verify` method checks if a provided password matches a previously hashed password.
159
181
160
182
Example Usage:
161
-
```ts
183
+
```js
162
184
constplainPassword='mySecretPassword';
163
185
consthashedPassword='hashedPasswordFromDatabase'; // Assume this is a valid hashed password
Copy file name to clipboardExpand all lines: package.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "@nasriya/authcrypto",
3
-
"version": "1.0.1",
3
+
"version": "1.1.0",
4
4
"description": "AuthCrypto is a versatile cryptographic toolkit for handling JSON Web Tokens (JWT), password hashing, and secure token generation and verification. It provides robust methods for creating and managing JWTs, hashing and verifying passwords with secure algorithms, and generating cryptographically strong random values for various use cases.",
0 commit comments