ecwt 0.2.1-beta.4 → 0.2.1-beta.5
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/dist/main.cjs +3 -3
- package/dist/types/factory.d.ts +7 -7
- package/package.json +1 -1
- package/src/factory.js +3 -3
package/dist/main.cjs
CHANGED
|
@@ -242,7 +242,7 @@ var EcwtFactory = class {
|
|
|
242
242
|
* @param {D} data Data to be stored in token.
|
|
243
243
|
* @param {object} [options] -
|
|
244
244
|
* @param {number | null} [options.ttl] Time to live in seconds. By default, token will never expire.
|
|
245
|
-
* @returns {Promise<Ecwt
|
|
245
|
+
* @returns {Promise<Ecwt<D>>} -
|
|
246
246
|
*/
|
|
247
247
|
async create(data, {
|
|
248
248
|
ttl = null
|
|
@@ -301,7 +301,7 @@ var EcwtFactory = class {
|
|
|
301
301
|
* Parses token.
|
|
302
302
|
* @async
|
|
303
303
|
* @param {string} token String representation of token.
|
|
304
|
-
* @returns {Promise<Ecwt
|
|
304
|
+
* @returns {Promise<Ecwt<D>>} -
|
|
305
305
|
*/
|
|
306
306
|
async verify(token) {
|
|
307
307
|
if (typeof token !== "string") {
|
|
@@ -381,7 +381,7 @@ var EcwtFactory = class {
|
|
|
381
381
|
* Parses token without throwing errors.
|
|
382
382
|
* @async
|
|
383
383
|
* @param {string} token String representation of token.
|
|
384
|
-
* @returns {Promise<{ success: true, ecwt: Ecwt } | { success: false, ecwt: Ecwt | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
|
|
384
|
+
* @returns {Promise<{ success: true, ecwt: Ecwt<D> } | { success: false, ecwt: Ecwt<D> | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
|
|
385
385
|
*/
|
|
386
386
|
async safeVerify(token) {
|
|
387
387
|
let ecwt = null;
|
package/dist/types/factory.d.ts
CHANGED
|
@@ -30,30 +30,30 @@ export class EcwtFactory<D extends Record<string, any> = Record<string, any>> {
|
|
|
30
30
|
* @param {D} data Data to be stored in token.
|
|
31
31
|
* @param {object} [options] -
|
|
32
32
|
* @param {number | null} [options.ttl] Time to live in seconds. By default, token will never expire.
|
|
33
|
-
* @returns {Promise<Ecwt
|
|
33
|
+
* @returns {Promise<Ecwt<D>>} -
|
|
34
34
|
*/
|
|
35
35
|
create(data: D, { ttl, }?: {
|
|
36
36
|
ttl?: number | null | undefined;
|
|
37
|
-
} | undefined): Promise<Ecwt
|
|
37
|
+
} | undefined): Promise<Ecwt<D>>;
|
|
38
38
|
/**
|
|
39
39
|
* Parses token.
|
|
40
40
|
* @async
|
|
41
41
|
* @param {string} token String representation of token.
|
|
42
|
-
* @returns {Promise<Ecwt
|
|
42
|
+
* @returns {Promise<Ecwt<D>>} -
|
|
43
43
|
*/
|
|
44
|
-
verify(token: string): Promise<Ecwt
|
|
44
|
+
verify(token: string): Promise<Ecwt<D>>;
|
|
45
45
|
/**
|
|
46
46
|
* Parses token without throwing errors.
|
|
47
47
|
* @async
|
|
48
48
|
* @param {string} token String representation of token.
|
|
49
|
-
* @returns {Promise<{ success: true, ecwt: Ecwt } | { success: false, ecwt: Ecwt | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
|
|
49
|
+
* @returns {Promise<{ success: true, ecwt: Ecwt<D> } | { success: false, ecwt: Ecwt<D> | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
|
|
50
50
|
*/
|
|
51
51
|
safeVerify(token: string): Promise<{
|
|
52
52
|
success: true;
|
|
53
|
-
ecwt: Ecwt
|
|
53
|
+
ecwt: Ecwt<D>;
|
|
54
54
|
} | {
|
|
55
55
|
success: false;
|
|
56
|
-
ecwt: Ecwt | null;
|
|
56
|
+
ecwt: Ecwt<D> | null;
|
|
57
57
|
}>;
|
|
58
58
|
/**
|
|
59
59
|
* Revokes token.
|
package/package.json
CHANGED
package/src/factory.js
CHANGED
|
@@ -111,7 +111,7 @@ export class EcwtFactory {
|
|
|
111
111
|
* @param {D} data Data to be stored in token.
|
|
112
112
|
* @param {object} [options] -
|
|
113
113
|
* @param {number | null} [options.ttl] Time to live in seconds. By default, token will never expire.
|
|
114
|
-
* @returns {Promise<Ecwt
|
|
114
|
+
* @returns {Promise<Ecwt<D>>} -
|
|
115
115
|
*/
|
|
116
116
|
async create(
|
|
117
117
|
data,
|
|
@@ -190,7 +190,7 @@ export class EcwtFactory {
|
|
|
190
190
|
* Parses token.
|
|
191
191
|
* @async
|
|
192
192
|
* @param {string} token String representation of token.
|
|
193
|
-
* @returns {Promise<Ecwt
|
|
193
|
+
* @returns {Promise<Ecwt<D>>} -
|
|
194
194
|
*/
|
|
195
195
|
async verify(token) {
|
|
196
196
|
if (typeof token !== 'string') {
|
|
@@ -297,7 +297,7 @@ export class EcwtFactory {
|
|
|
297
297
|
* Parses token without throwing errors.
|
|
298
298
|
* @async
|
|
299
299
|
* @param {string} token String representation of token.
|
|
300
|
-
* @returns {Promise<{ success: true, ecwt: Ecwt } | { success: false, ecwt: Ecwt | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
|
|
300
|
+
* @returns {Promise<{ success: true, ecwt: Ecwt<D> } | { success: false, ecwt: Ecwt<D> | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
|
|
301
301
|
*/
|
|
302
302
|
async safeVerify(token) {
|
|
303
303
|
let ecwt = null;
|