@otplib/plugin-crypto-node 13.1.1 → 13.2.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 +6 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -24,11 +24,8 @@ This plugin provides HMAC and random byte generation using Node.js's built-in `c
|
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
26
|
import { generateSecret, generate } from "otplib";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
const crypto = new NodeCryptoPlugin();
|
|
31
|
-
const base32 = new ScureBase32Plugin();
|
|
27
|
+
import { crypto } from "@otplib/plugin-crypto-node";
|
|
28
|
+
import { base32 } from "@otplib/plugin-base32-scure";
|
|
32
29
|
|
|
33
30
|
// Generate a secret
|
|
34
31
|
const secret = generateSecret({ crypto, base32 });
|
|
@@ -45,14 +42,11 @@ const token = await generate({
|
|
|
45
42
|
|
|
46
43
|
```typescript
|
|
47
44
|
import { generate } from "otplib";
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
|
|
51
|
-
const crypto = new NodeCryptoPlugin();
|
|
52
|
-
const base32 = new ScureBase32Plugin();
|
|
45
|
+
import { crypto } from "@otplib/plugin-crypto-node";
|
|
46
|
+
import { base32 } from "@otplib/plugin-base32-scure";
|
|
53
47
|
|
|
54
48
|
const token = await generate({
|
|
55
|
-
secret: "
|
|
49
|
+
secret: "GEZDGNBVGY3TQOJQGEZDGNBVGY",
|
|
56
50
|
algorithm: "sha256",
|
|
57
51
|
crypto,
|
|
58
52
|
base32,
|
|
@@ -64,9 +58,7 @@ const token = await generate({
|
|
|
64
58
|
The Node.js crypto plugin supports both synchronous and asynchronous HMAC operations:
|
|
65
59
|
|
|
66
60
|
```typescript
|
|
67
|
-
import {
|
|
68
|
-
|
|
69
|
-
const crypto = new NodeCryptoPlugin();
|
|
61
|
+
import { crypto } from "@otplib/plugin-crypto-node";
|
|
70
62
|
|
|
71
63
|
// Sync HMAC (faster, but blocks event loop)
|
|
72
64
|
const digest = crypto.hmacSync("sha1", key, data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otplib/plugin-crypto-node",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.1",
|
|
4
4
|
"description": "Node.js crypto module adapter for otplib",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gerald Yeo <support@yeojz.dev>",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@noble/hashes": "^2.0.1",
|
|
47
|
-
"@otplib/core": "13.
|
|
47
|
+
"@otplib/core": "13.2.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup": "^8.0.1",
|
|
51
51
|
"typescript": "^5.3.3",
|
|
52
|
-
"vitest": "^4.0.
|
|
52
|
+
"vitest": "^4.0.18"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|