sip-nonce 0.3.0 → 0.3.2
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 +35 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,35 @@
|
|
|
1
|
-
Small library for generating random SIP nonce values
|
|
1
|
+
## Small library for generating random SIP nonce values
|
|
2
|
+
|
|
3
|
+
Contains both CommonJS and ESM modules for generating SIP-compatible random string values between 10 and 24 chars in length.
|
|
4
|
+
|
|
5
|
+
Note: for speed, this library does not use crypto libraries for generating random bytes or seed data. It just uses several iterations of A-Z,a-z,0-9, shuffled and then randomly sliced into a substring.
|
|
6
|
+
|
|
7
|
+
**Installation**
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install sip-nonce
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Usage Examples**
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
// For ESM use
|
|
17
|
+
import nonce from "sip-nonce";
|
|
18
|
+
|
|
19
|
+
// OR, for CommonJS use
|
|
20
|
+
const nonce = require("sip-nonce");
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
// by default this will generate a 10 char string
|
|
25
|
+
const n = nonce();
|
|
26
|
+
|
|
27
|
+
// generate a 12 char string
|
|
28
|
+
const n = nonce(12);
|
|
29
|
+
|
|
30
|
+
// generate a string with a random length between 10 and 12 (recommended)
|
|
31
|
+
const n = nonce(10, 12);
|
|
32
|
+
|
|
33
|
+
// a string with a random length between 10 and 24
|
|
34
|
+
const n = nonce(10, 24);
|
|
35
|
+
```
|