From 86604a0150f7119c6c3d8a1572d05a7496f2eb1e Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Thu, 23 Sep 2021 22:51:14 +0200 Subject: [PATCH] Updated example code --- README.md | 10 +++++++++- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a624fd4..1790f68 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ async () => { // Verifing token const isValid = await jwt.verify(token, 'secret') + // Check for validity + if (!isValid) + return + // Decoding token const payload = jwt.decode(token) } @@ -53,6 +57,10 @@ async () => { // Verifing token const isValid = await jwt.verify(token, 'secret') // false + // Check for validity + if (!isValid) + return + // Decoding token const payload = jwt.decode(token) // { name: 'John Doe', email: 'john.doe@gmail.com', ... } } @@ -103,4 +111,4 @@ Argument | Type | Satus | Default | Description `token` | `string` | required | - | The token string generated by `jwt.sign()`. #### `return` -Returns payload `object`. \ No newline at end of file +Returns payload `object`. diff --git a/package-lock.json b/package-lock.json index 4b16c43..0023ef1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tsndr/cloudflare-worker-jwt", - "version": "1.1.2", + "version": "1.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@tsndr/cloudflare-worker-jwt", - "version": "1.1.2", + "version": "1.1.3", "license": "MIT", "devDependencies": { "tslint": "^6.1.3" diff --git a/package.json b/package.json index 7d31788..1598fe0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tsndr/cloudflare-worker-jwt", - "version": "1.1.2", + "version": "1.1.3", "description": "A lightweight JWT implementation with ZERO dependencies for Cloudflare Worker", "main": "index.js", "scripts": {