ecwt 0.1.1-beta.1 → 0.1.1-beta.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 +5 -5
- package/dist/ecwt.cjs +8 -2
- package/package.json +1 -1
- package/src/main.js +5 -0
package/README.md
CHANGED
|
@@ -156,15 +156,15 @@ Creates a token.
|
|
|
156
156
|
|
|
157
157
|
`options.ttl` specifies the time to live of the token in seconds. If set to null, token will never expire.
|
|
158
158
|
|
|
159
|
-
> **Be careful with `ttl=null`!**
|
|
159
|
+
> **Be careful with `ttl = null`!**
|
|
160
160
|
>
|
|
161
|
-
> Revoked tokens are stored in Redis until they expire.
|
|
161
|
+
> Revoked tokens are stored in Redis until they expire. Never-expiring tokens will be stored in Redis **forever**, which will lead to uncontrolled Redis database growth.
|
|
162
162
|
|
|
163
163
|
Returns `Ecwt` instance.
|
|
164
164
|
|
|
165
165
|
```javascript
|
|
166
166
|
// Example
|
|
167
|
-
const
|
|
167
|
+
const ecwt = await ecwtFactory.create(
|
|
168
168
|
{
|
|
169
169
|
user_id: 1,
|
|
170
170
|
nick: 'kirick',
|
|
@@ -195,12 +195,12 @@ Returns `Ecwt` instance.
|
|
|
195
195
|
If the token is invalid, throws `EcwtInvalidError` which contains `Ecwt` instance in the `ecwt` property.
|
|
196
196
|
|
|
197
197
|
```javascript
|
|
198
|
-
const
|
|
198
|
+
const ecwt = await ecwtFactory.verify(token);
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
### `Ecwt`
|
|
202
202
|
|
|
203
|
-
Represents the token.
|
|
203
|
+
Represents the token. Its counstructor cannot be called by the user.
|
|
204
204
|
|
|
205
205
|
```javascript
|
|
206
206
|
import { Ecwt } from 'ecwt';
|
package/dist/ecwt.cjs
CHANGED
|
@@ -30,7 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var main_exports = {};
|
|
31
31
|
__export(main_exports, {
|
|
32
32
|
Ecwt: () => Ecwt,
|
|
33
|
-
|
|
33
|
+
EcwtExpiredError: () => EcwtExpiredError,
|
|
34
|
+
EcwtFactory: () => EcwtFactory,
|
|
35
|
+
EcwtInvalidError: () => EcwtInvalidError,
|
|
36
|
+
EcwtRevokedError: () => EcwtRevokedError
|
|
34
37
|
});
|
|
35
38
|
module.exports = __toCommonJS(main_exports);
|
|
36
39
|
|
|
@@ -426,5 +429,8 @@ var EcwtFactory = class {
|
|
|
426
429
|
// Annotate the CommonJS export names for ESM import in node:
|
|
427
430
|
0 && (module.exports = {
|
|
428
431
|
Ecwt,
|
|
429
|
-
|
|
432
|
+
EcwtExpiredError,
|
|
433
|
+
EcwtFactory,
|
|
434
|
+
EcwtInvalidError,
|
|
435
|
+
EcwtRevokedError
|
|
430
436
|
});
|
package/package.json
CHANGED