@otplib/uri 13.1.0 → 13.2.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 +13 -12
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -27,7 +27,7 @@ otpauth://TYPE/LABEL?PARAMETERS
27
27
  Example:
28
28
 
29
29
  ```
30
- otpauth://totp/GitHub:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub
30
+ otpauth://totp/GitHub:user@example.com?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY&issuer=GitHub
31
31
  ```
32
32
 
33
33
  ## Parsing URIs
@@ -37,7 +37,8 @@ otpauth://totp/GitHub:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub
37
37
  ```typescript
38
38
  import { parse } from "@otplib/uri";
39
39
 
40
- const uri = "otpauth://totp/GitHub:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub";
40
+ const uri =
41
+ "otpauth://totp/GitHub:user@example.com?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY&issuer=GitHub";
41
42
  const result = parse(uri);
42
43
 
43
44
  console.log(result);
@@ -45,7 +46,7 @@ console.log(result);
45
46
  // type: 'totp',
46
47
  // label: 'GitHub:user@example.com',
47
48
  // params: {
48
- // secret: 'JBSWY3DPEHPK3PXP',
49
+ // secret: 'GEZDGNBVGY3TQOJQGEZDGNBVGY',
49
50
  // issuer: 'GitHub',
50
51
  // algorithm: 'sha1',
51
52
  // digits: 6,
@@ -59,7 +60,7 @@ console.log(result);
59
60
  ```typescript
60
61
  import { parse } from "@otplib/uri";
61
62
 
62
- const uri = "otpauth://totp/ACME%20Corp:john@example.com?secret=JBSWY3DPEHPK3PXP";
63
+ const uri = "otpauth://totp/ACME%20Corp:john@example.com?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY";
63
64
  const { label, params } = parse(uri);
64
65
 
65
66
  // Split label to get issuer and account
@@ -104,11 +105,11 @@ import { generateTOTP } from "@otplib/uri";
104
105
  const uri = generateTOTP({
105
106
  issuer: "ACME Corp",
106
107
  label: "john@example.com",
107
- secret: "JBSWY3DPEHPK3PXP",
108
+ secret: "GEZDGNBVGY3TQOJQGEZDGNBVGY",
108
109
  });
109
110
 
110
111
  console.log(uri);
111
- // 'otpauth://totp/ACME%20Corp:john@example.com?secret=JBSWY3DPEHPK3PXP&issuer=ACME%20Corp'
112
+ // 'otpauth://totp/ACME%20Corp:john@example.com?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY&issuer=ACME%20Corp'
112
113
  ```
113
114
 
114
115
  ### TOTP with Custom Options
@@ -119,7 +120,7 @@ import { generateTOTP } from "@otplib/uri";
119
120
  const uri = generateTOTP({
120
121
  issuer: "GitHub",
121
122
  label: "user@github.com",
122
- secret: "JBSWY3DPEHPK3PXP",
123
+ secret: "GEZDGNBVGY3TQOJQGEZDGNBVGY",
123
124
  algorithm: "sha256", // Non-default algorithm
124
125
  digits: 8, // 8-digit tokens
125
126
  period: 60, // 60-second period
@@ -134,12 +135,12 @@ import { generateHOTP } from "@otplib/uri";
134
135
  const uri = generateHOTP({
135
136
  issuer: "MyApp",
136
137
  label: "user123",
137
- secret: "JBSWY3DPEHPK3PXP",
138
+ secret: "GEZDGNBVGY3TQOJQGEZDGNBVGY",
138
139
  counter: 0, // Starting counter
139
140
  });
140
141
 
141
142
  console.log(uri);
142
- // 'otpauth://hotp/MyApp:user123?secret=JBSWY3DPEHPK3PXP&issuer=MyApp&counter=0'
143
+ // 'otpauth://hotp/MyApp:user123?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY&issuer=MyApp&counter=0'
143
144
  ```
144
145
 
145
146
  ### Low-Level Generation
@@ -153,7 +154,7 @@ const uri = generate({
153
154
  type: "totp",
154
155
  label: "CustomApp:user@example.com",
155
156
  params: {
156
- secret: "JBSWY3DPEHPK3PXP",
157
+ secret: "GEZDGNBVGY3TQOJQGEZDGNBVGY",
157
158
  issuer: "CustomApp",
158
159
  algorithm: "sha1",
159
160
  digits: 6,
@@ -182,7 +183,7 @@ import { generateTOTP } from "@otplib/uri";
182
183
  const uri = generateTOTP({
183
184
  issuer: "MyService",
184
185
  label: "user@example.com",
185
- secret: "JBSWY3DPEHPK3PXP",
186
+ secret: "GEZDGNBVGY3TQOJQGEZDGNBVGY",
186
187
  // algorithm: 'sha1', // Default, compatible
187
188
  // digits: 6, // Default, compatible
188
189
  // period: 30, // Default, compatible
@@ -200,7 +201,7 @@ import QRCode from "qrcode"; // Example library
200
201
  const uri = generateTOTP({
201
202
  issuer: "MyApp",
202
203
  label: "user@example.com",
203
- secret: "JBSWY3DPEHPK3PXP",
204
+ secret: "GEZDGNBVGY3TQOJQGEZDGNBVGY",
204
205
  });
205
206
 
206
207
  // Generate QR code as data URL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otplib/uri",
3
- "version": "13.1.0",
3
+ "version": "13.2.0",
4
4
  "description": "otpauth:// URI parsing and generation for otplib",
5
5
  "license": "MIT",
6
6
  "author": "Gerald Yeo <support@yeojz.dev>",
@@ -44,12 +44,12 @@
44
44
  "LICENSE"
45
45
  ],
46
46
  "dependencies": {
47
- "@otplib/core": "13.1.0"
47
+ "@otplib/core": "13.2.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "tsup": "^8.0.1",
51
51
  "typescript": "^5.3.3",
52
- "vitest": "^4.0.16",
52
+ "vitest": "^4.0.18",
53
53
  "@repo/testing": "13.0.1"
54
54
  },
55
55
  "publishConfig": {