ecwt 0.2.0-beta.4 → 0.2.0-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/ecwt.cjs CHANGED
@@ -419,7 +419,7 @@ var EcwtFactory = class {
419
419
  * Parses token without throwing errors.
420
420
  * @async
421
421
  * @param {string} token String representation of token.
422
- * @returns {Promise<{ success: boolean, ecwt: Ecwt | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
422
+ * @returns {Promise<{ success: true, ecwt: Ecwt } | { success: false, ecwt: Ecwt | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
423
423
  */
424
424
  async safeVerify(token) {
425
425
  let ecwt = null;
@@ -451,7 +451,7 @@ var EcwtFactory = class {
451
451
  * @param {object} options -
452
452
  * @param {string} options.token_id -
453
453
  * @param {number} options.ts_ms_created -
454
- * @param {number} options.ttl_initial -
454
+ * @param {number | null} options.ttl_initial -
455
455
  * @returns {Promise<void>} -
456
456
  */
457
457
  async _revoke({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecwt",
3
- "version": "0.2.0-beta.4",
3
+ "version": "0.2.0-beta.5",
4
4
  "description": "Encrypted CBOR-encoded Web Token",
5
5
  "main": "src/main.js",
6
6
  "type": "module",
package/src/factory.js CHANGED
@@ -311,7 +311,7 @@ export class EcwtFactory {
311
311
  * Parses token without throwing errors.
312
312
  * @async
313
313
  * @param {string} token String representation of token.
314
- * @returns {Promise<{ success: boolean, ecwt: Ecwt | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
314
+ * @returns {Promise<{ success: true, ecwt: Ecwt } | { success: false, ecwt: Ecwt | null }>} Returns whether token was parsed and verified successfully and Ecwt if parsed.
315
315
  */
316
316
  async safeVerify(token) {
317
317
  let ecwt = null;
@@ -348,7 +348,7 @@ export class EcwtFactory {
348
348
  * @param {object} options -
349
349
  * @param {string} options.token_id -
350
350
  * @param {number} options.ts_ms_created -
351
- * @param {number} options.ttl_initial -
351
+ * @param {number | null} options.ttl_initial -
352
352
  * @returns {Promise<void>} -
353
353
  */
354
354
  async _revoke({
package/src/main.js CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ // @ts-check
3
+
2
4
  export { EcwtFactory } from './factory.js';
3
5
  export { Ecwt } from './token.js';
4
6
  export {
package/src/token.js CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ // @ts-check
3
+
2
4
  import { toSeconds } from './utils/time.js';
3
5
 
4
6
  /**
@@ -1,4 +1,6 @@
1
1
 
2
+ // @ts-check
3
+
2
4
  import basex from 'base-x';
3
5
 
4
6
  export const base62 = basex('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');
@@ -1,4 +1,6 @@
1
1
 
2
+ // @ts-check
3
+
2
4
  export class InvalidPackageInstanceError extends TypeError {
3
5
  constructor(property, class_name, package_name) {
4
6
  super(`Value ${property} must be an instance of ${class_name} from package "${package_name}". That error is probably caused by two separate installations of "${package_name}". Please, make sure that "${package_name}" in your project is matches "peerDependencies" of "ecwt" package.`);
package/src/utils/time.js CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ // @ts-check
3
+
2
4
  /**
3
5
  * Convert timestamp in seconds to milliseconds.
4
6
  * @param {*} value Timestamp in milliseconds.