phrasekit 2.0.1 → 2.0.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 +15 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,18 +89,26 @@ class Phrase {
|
|
|
89
89
|
|
|
90
90
|
get entropy(): number; // Calculation of bits of randomness (e.g., ~77.5 for 6 words).
|
|
91
91
|
|
|
92
|
-
toString(): string;
|
|
93
|
-
toJSON(): string[];
|
|
94
|
-
join(separator: string):
|
|
95
|
-
string;
|
|
92
|
+
toString(): string; // Returns the phrase joined by spaces.
|
|
93
|
+
toJSON(): string[]; // Returns same output as this.words.
|
|
94
|
+
join(separator: string): string; // Returns the phrase with a custom separator (e.g., "-").
|
|
96
95
|
|
|
97
96
|
hash(options: HashOptions): Promise; // Server-side only. Returns a hex-encoded hash. See below.
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
// Hashing options
|
|
101
100
|
type HashOptions =
|
|
102
|
-
| {
|
|
103
|
-
|
|
101
|
+
| {
|
|
102
|
+
algorithm: "scrypt";
|
|
103
|
+
salt: string;
|
|
104
|
+
cost?: number;
|
|
105
|
+
r?: number;
|
|
106
|
+
p?: number;
|
|
107
|
+
}
|
|
108
|
+
| {
|
|
109
|
+
algorithm: "hmac-sha256";
|
|
110
|
+
salt: string;
|
|
111
|
+
};
|
|
104
112
|
```
|
|
105
113
|
|
|
106
114
|
## 🔐 Hashing
|
|
@@ -112,7 +120,7 @@ type HashOptions =
|
|
|
112
120
|
const hash = await phrase.hash({
|
|
113
121
|
algorithm: "scrypt",
|
|
114
122
|
salt: "your-app-salt",
|
|
115
|
-
cost:
|
|
123
|
+
cost: 65536, // optional, default is 65536 (N param)
|
|
116
124
|
});
|
|
117
125
|
|
|
118
126
|
// ✅ HMAC-SHA256 (faster, good for low-latency lookups)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phrasekit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A lightweight, zero-dependency TypeScript library for generating and managing secure word-based keys. Inspired by Mullvad VPN, but made more human.",
|
|
5
5
|
"author": "Aria Lume <thearialume@gmail.com> (https://github.com/thearialume)",
|
|
6
6
|
"license": "MIT",
|