web3-token icon indicating copy to clipboard operation
web3-token copied to clipboard

Unable to execute verify function

Open aph5nt opened this issue 2 years ago • 5 comments

I get the following error during compile time

node_modules/web3-token/dist/web3-token.d.ts:7:31 - error TS2307: Cannot find module './lib/interfaces' or its corresponding type declarations.

7         sign: (signer: import("./lib/interfaces").Signer, opts?: string | import("./lib/interfaces").SignOpts) => Promise<string>;
                                ~~~~~~~~~~~~~~~~~~

node_modules/web3-token/dist/web3-token.d.ts:7:82 - error TS2307: Cannot find module './lib/interfaces' or its corresponding type declarations.

7         sign: (signer: import("./lib/interfaces").Signer, opts?: string | import("./lib/interfaces").SignOpts) => Promise<string>;
                                                                                   ~~~~~~~~~~~~~~~~~~

node_modules/web3-token/dist/web3-token.d.ts:8:47 - error TS2307: Cannot find module './lib/interfaces' or its corresponding type declarations.

8         verify: (token: string, opts?: import("./lib/interfaces").VerifyOpts) => {
                                                ~~~~~~~~~~~~~~~~~~

node_modules/web3-token/dist/web3-token.d.ts:10:26 - error TS2307: Cannot find module './lib/interfaces' or its corresponding type declarations.

10             body: import("./lib/interfaces").DecryptedBody;
                            ~~~~~~~~~~~~~~~~~~


Found 4 errors in the same file, starting at: node_modules/web3-token/dist/web3-token.d.ts:7

source code:


export async function authorize(token) {
    try {

        const { address, body } = await verify(token);

        return {};
    } catch (e) {
        // eslint-disable-next-line no-console
        return null;
    }
}

package.json

  "name": "",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "build": "tsc",
    "watch": "tsc -w",
    "prestart": "npm run build",
    "start": "func start",
    "test": "echo \"No tests yet...\""
  },
  "dependencies": {
    "@moralisweb3/streams-typings": "^1.0.5",
    "ethers": "^5.7.1",
    "i": "^0.3.7",
    "npm": "^8.19.2",
    "web3-token": "^1.0.2"
  },
  "devDependencies": {
    "@azure/functions": "^3.0.0",
    "typescript": "^4.0.0"
  }
}

aph5nt avatar Oct 18 '22 20:10 aph5nt