From 71131bfabf78d1f8b06fd25dfd34a53bf8c3271e Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Fri, 16 Dec 2022 02:37:55 +0530 Subject: [PATCH] session refresh added --- examples/react-example/package-lock.json | 420 +++-------------------- examples/react-example/package.json | 4 +- examples/react-example/src/App.tsx | 1 + packages/openlogin/src/OpenLogin.ts | 16 +- 4 files changed, 67 insertions(+), 374 deletions(-) diff --git a/examples/react-example/package-lock.json b/examples/react-example/package-lock.json index d8b31e7d..548e9940 100644 --- a/examples/react-example/package-lock.json +++ b/examples/react-example/package-lock.json @@ -11,9 +11,9 @@ "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", - "@toruslabs/openlogin-ed25519": "^0.9.1", + "@toruslabs/openlogin-ed25519": "^2.0.0", "bs58": "^4.0.1", - "openlogin": "^2.5.0", + "openlogin": "file:../../packages/openlogin", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3", @@ -38,6 +38,27 @@ "prettier": "^2.3.2" } }, + "../../packages/openlogin": { + "name": "@toruslabs/openlogin", + "version": "2.10.0", + "license": "ISC", + "dependencies": { + "@toruslabs/eccrypto": "^1.1.8", + "@toruslabs/http-helpers": "^3.2.0", + "@toruslabs/openlogin-jrpc": "^2.9.0", + "@toruslabs/openlogin-utils": "^2.1.0", + "lodash.merge": "^4.6.2", + "loglevel": "^1.8.1", + "pump": "^3.0.0" + }, + "devDependencies": { + "@types/lodash.merge": "^4.6.7", + "@types/pump": "^1.1.1" + }, + "peerDependencies": { + "@babel/runtime": "7.x" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -3226,64 +3247,10 @@ "node": ">= 6" } }, - "node_modules/@toruslabs/eccrypto": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/@toruslabs/eccrypto/-/eccrypto-1.1.8.tgz", - "integrity": "sha512-5dIrO2KVqvnAPOPfJ2m6bnjp9vav9GIcCZXiXRW/bJuIDRLVxJhVvRlleF4oaEZPq5yX5piHq5jVHagNNS0jOQ==", - "hasInstallScript": true, - "dependencies": { - "acorn": "^8.4.1", - "elliptic": "^6.5.4", - "es6-promise": "^4.2.8", - "nan": "^2.14.2" - }, - "optionalDependencies": { - "secp256k1": "^3.8.0" - } - }, - "node_modules/@toruslabs/http-helpers": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-3.1.0.tgz", - "integrity": "sha512-BBr+NBYjNTrR0F9ROFdc26P0Ccrprsnl51dJwcfBA7FkcW8442KNj1CnTyiztUyJxW3sXl9l2N+fZ5SRKbEaBA==", - "dependencies": { - "lodash.merge": "^4.6.2", - "loglevel": "^1.8.0" - }, - "engines": { - "node": ">=14.17.0", - "npm": ">=6.x" - }, - "peerDependencies": { - "@babel/runtime": "^7.x", - "@sentry/types": "^7.x" - }, - "peerDependenciesMeta": { - "@sentry/types": { - "optional": true - } - } - }, - "node_modules/@toruslabs/openlogin": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin/-/openlogin-2.5.0.tgz", - "integrity": "sha512-SGecWFRGPTuPAB3sX0J7fRSkczWLJHi1u6LxEFoOMrSckancVeiyhKMn3P+RCOoVUHLt9n8g8yWsiBa7D7mT0A==", - "dependencies": { - "@toruslabs/eccrypto": "^1.1.8", - "@toruslabs/http-helpers": "^3.1.0", - "@toruslabs/openlogin-jrpc": "^2.5.0", - "@toruslabs/openlogin-utils": "^2.1.0", - "lodash.merge": "^4.6.2", - "loglevel": "^1.8.0", - "pump": "^3.0.0" - }, - "peerDependencies": { - "@babel/runtime": "7.x" - } - }, "node_modules/@toruslabs/openlogin-ed25519": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-ed25519/-/openlogin-ed25519-0.9.5.tgz", - "integrity": "sha512-zlwVR6nQD+mFVlmCEogmSGb0+fCKphfrIZ19XDTidlWoqSRFBDl/daditf33aTH58rrEmb2l7JKkwEYkxhdZJA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-ed25519/-/openlogin-ed25519-2.0.0.tgz", + "integrity": "sha512-gz00QpMHbSVaZFKATxbsCbtO2uRyF7xIvetuzOCfbfcjkTz0Wonr/8B44uiIDe4j2ddv4Hx8HvnBikFDLQQrZA==", "dependencies": { "@toruslabs/tweetnacl-js": "^1.0.3" }, @@ -3291,37 +3258,6 @@ "@babel/runtime": "7.x" } }, - "node_modules/@toruslabs/openlogin-jrpc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-jrpc/-/openlogin-jrpc-2.5.0.tgz", - "integrity": "sha512-A46zxx5r76iWpawYYLu0aHfaHnHQuycDdJvmGSAZ1dzPuhGbFzXWqx4puBoQn08C4V7SpUsr+yMUNk/aMp/gYA==", - "dependencies": { - "@toruslabs/openlogin-utils": "^2.1.0", - "end-of-stream": "^1.4.4", - "eth-rpc-errors": "^4.0.3", - "events": "^3.3.0", - "fast-safe-stringify": "^2.1.1", - "once": "^1.4.0", - "pump": "^3.0.0", - "readable-stream": "^3.6.0" - }, - "peerDependencies": { - "@babel/runtime": "7.x" - } - }, - "node_modules/@toruslabs/openlogin-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-utils/-/openlogin-utils-2.1.0.tgz", - "integrity": "sha512-UVgjco4winOn4Gj0VRTvjSZgBA84h2OIkKuxrBFjS+yWhgxQBF4hXGp83uicSgx1MujtjyUOdhJrpV2joRHt9w==", - "dependencies": { - "base64url": "^3.0.1", - "keccak": "^3.0.2", - "randombytes": "^2.1.0" - }, - "peerDependencies": { - "@babel/runtime": "7.x" - } - }, "node_modules/@toruslabs/tweetnacl-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@toruslabs/tweetnacl-js/-/tweetnacl-js-1.0.3.tgz", @@ -5115,14 +5051,6 @@ } ] }, - "node_modules/base64url": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", - "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==", - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -5168,15 +5096,6 @@ "file-uri-to-path": "1.0.0" } }, - "node_modules/bip66": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", - "integrity": "sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw==", - "optional": true, - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -7181,20 +7100,6 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" }, - "node_modules/drbg.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", - "integrity": "sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g==", - "optional": true, - "dependencies": { - "browserify-aes": "^1.0.6", - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -7483,11 +7388,6 @@ "es6-symbol": "^3.1.1" } }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, "node_modules/es6-symbol": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", @@ -8535,14 +8435,6 @@ "node": ">= 0.6" } }, - "node_modules/eth-rpc-errors": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz", - "integrity": "sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg==", - "dependencies": { - "fast-safe-stringify": "^2.0.6" - } - }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -8930,11 +8822,6 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, - "node_modules/fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" - }, "node_modules/fastq": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", @@ -13057,20 +12944,6 @@ "node": ">=4.0" } }, - "node_modules/keccak": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", - "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", - "hasInstallScript": true, - "dependencies": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -13237,9 +13110,9 @@ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" }, "node_modules/loglevel": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.0.tgz", - "integrity": "sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", + "integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==", "engines": { "node": ">= 0.6.0" }, @@ -13754,7 +13627,8 @@ "node_modules/nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "optional": true }, "node_modules/nanoid": { "version": "3.2.0", @@ -13838,11 +13712,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, - "node_modules/node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" - }, "node_modules/node-forge": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", @@ -13851,16 +13720,6 @@ "node": ">= 6.0.0" } }, - "node_modules/node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -14296,18 +14155,8 @@ } }, "node_modules/openlogin": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/openlogin/-/openlogin-2.5.0.tgz", - "integrity": "sha512-M/Cska/KdatbM4zyfB+/sgTzC8Uh8HZug33J3VqzLNnZhgU6pOzSQW/KN1brTCBSgx/kwkpFtT3OZaKGI5YvKw==", - "dependencies": { - "@toruslabs/openlogin": "^2.5.0", - "@toruslabs/openlogin-jrpc": "^2.5.0", - "@toruslabs/openlogin-utils": "^2.1.0", - "bn.js": "^5.2.1" - }, - "peerDependencies": { - "@babel/runtime": "7.x" - } + "resolved": "../../packages/openlogin", + "link": true }, "node_modules/opn": { "version": "5.5.0", @@ -17899,32 +17748,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/secp256k1": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.8.0.tgz", - "integrity": "sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "bindings": "^1.5.0", - "bip66": "^1.1.5", - "bn.js": "^4.11.8", - "create-hash": "^1.2.0", - "drbg.js": "^1.0.1", - "elliptic": "^6.5.2", - "nan": "^2.14.0", - "safe-buffer": "^5.1.2" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/secp256k1/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "optional": true - }, "node_modules/select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -24110,74 +23933,14 @@ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" }, - "@toruslabs/eccrypto": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/@toruslabs/eccrypto/-/eccrypto-1.1.8.tgz", - "integrity": "sha512-5dIrO2KVqvnAPOPfJ2m6bnjp9vav9GIcCZXiXRW/bJuIDRLVxJhVvRlleF4oaEZPq5yX5piHq5jVHagNNS0jOQ==", - "requires": { - "acorn": "^8.4.1", - "elliptic": "^6.5.4", - "es6-promise": "^4.2.8", - "nan": "^2.14.2", - "secp256k1": "^3.8.0" - } - }, - "@toruslabs/http-helpers": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@toruslabs/http-helpers/-/http-helpers-3.1.0.tgz", - "integrity": "sha512-BBr+NBYjNTrR0F9ROFdc26P0Ccrprsnl51dJwcfBA7FkcW8442KNj1CnTyiztUyJxW3sXl9l2N+fZ5SRKbEaBA==", - "requires": { - "lodash.merge": "^4.6.2", - "loglevel": "^1.8.0" - } - }, - "@toruslabs/openlogin": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin/-/openlogin-2.5.0.tgz", - "integrity": "sha512-SGecWFRGPTuPAB3sX0J7fRSkczWLJHi1u6LxEFoOMrSckancVeiyhKMn3P+RCOoVUHLt9n8g8yWsiBa7D7mT0A==", - "requires": { - "@toruslabs/eccrypto": "^1.1.8", - "@toruslabs/http-helpers": "^3.1.0", - "@toruslabs/openlogin-jrpc": "^2.5.0", - "@toruslabs/openlogin-utils": "^2.1.0", - "lodash.merge": "^4.6.2", - "loglevel": "^1.8.0", - "pump": "^3.0.0" - } - }, "@toruslabs/openlogin-ed25519": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-ed25519/-/openlogin-ed25519-0.9.5.tgz", - "integrity": "sha512-zlwVR6nQD+mFVlmCEogmSGb0+fCKphfrIZ19XDTidlWoqSRFBDl/daditf33aTH58rrEmb2l7JKkwEYkxhdZJA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-ed25519/-/openlogin-ed25519-2.0.0.tgz", + "integrity": "sha512-gz00QpMHbSVaZFKATxbsCbtO2uRyF7xIvetuzOCfbfcjkTz0Wonr/8B44uiIDe4j2ddv4Hx8HvnBikFDLQQrZA==", "requires": { "@toruslabs/tweetnacl-js": "^1.0.3" } }, - "@toruslabs/openlogin-jrpc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-jrpc/-/openlogin-jrpc-2.5.0.tgz", - "integrity": "sha512-A46zxx5r76iWpawYYLu0aHfaHnHQuycDdJvmGSAZ1dzPuhGbFzXWqx4puBoQn08C4V7SpUsr+yMUNk/aMp/gYA==", - "requires": { - "@toruslabs/openlogin-utils": "^2.1.0", - "end-of-stream": "^1.4.4", - "eth-rpc-errors": "^4.0.3", - "events": "^3.3.0", - "fast-safe-stringify": "^2.1.1", - "once": "^1.4.0", - "pump": "^3.0.0", - "readable-stream": "^3.6.0" - } - }, - "@toruslabs/openlogin-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@toruslabs/openlogin-utils/-/openlogin-utils-2.1.0.tgz", - "integrity": "sha512-UVgjco4winOn4Gj0VRTvjSZgBA84h2OIkKuxrBFjS+yWhgxQBF4hXGp83uicSgx1MujtjyUOdhJrpV2joRHt9w==", - "requires": { - "base64url": "^3.0.1", - "keccak": "^3.0.2", - "randombytes": "^2.1.0" - } - }, "@toruslabs/tweetnacl-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@toruslabs/tweetnacl-js/-/tweetnacl-js-1.0.3.tgz", @@ -25633,11 +25396,6 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, - "base64url": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", - "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" - }, "batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -25674,15 +25432,6 @@ "file-uri-to-path": "1.0.0" } }, - "bip66": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", - "integrity": "sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw==", - "optional": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -27323,17 +27072,6 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" }, - "drbg.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", - "integrity": "sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g==", - "optional": true, - "requires": { - "browserify-aes": "^1.0.6", - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4" - } - }, "duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -27585,11 +27323,6 @@ "es6-symbol": "^3.1.1" } }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, "es6-symbol": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", @@ -28301,14 +28034,6 @@ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" }, - "eth-rpc-errors": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz", - "integrity": "sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg==", - "requires": { - "fast-safe-stringify": "^2.0.6" - } - }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -28642,11 +28367,6 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, - "fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" - }, "fastq": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", @@ -31842,16 +31562,6 @@ "object.assign": "^4.1.2" } }, - "keccak": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", - "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", - "requires": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - } - }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -31994,9 +31704,9 @@ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" }, "loglevel": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.0.tgz", - "integrity": "sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA==" + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", + "integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==" }, "loose-envify": { "version": "1.4.0", @@ -32409,7 +32119,8 @@ "nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "optional": true }, "nanoid": { "version": "3.2.0", @@ -32483,21 +32194,11 @@ } } }, - "node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" - }, "node-forge": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" }, - "node-gyp-build": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", - "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -32841,14 +32542,17 @@ } }, "openlogin": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/openlogin/-/openlogin-2.5.0.tgz", - "integrity": "sha512-M/Cska/KdatbM4zyfB+/sgTzC8Uh8HZug33J3VqzLNnZhgU6pOzSQW/KN1brTCBSgx/kwkpFtT3OZaKGI5YvKw==", + "version": "file:../../packages/openlogin", "requires": { - "@toruslabs/openlogin": "^2.5.0", - "@toruslabs/openlogin-jrpc": "^2.5.0", + "@toruslabs/eccrypto": "^1.1.8", + "@toruslabs/http-helpers": "^3.2.0", + "@toruslabs/openlogin-jrpc": "^2.9.0", "@toruslabs/openlogin-utils": "^2.1.0", - "bn.js": "^5.2.1" + "@types/lodash.merge": "^4.6.7", + "@types/pump": "^1.1.1", + "lodash.merge": "^4.6.2", + "loglevel": "^1.8.1", + "pump": "^3.0.0" } }, "opn": { @@ -35686,30 +35390,6 @@ "ajv-keywords": "^3.5.2" } }, - "secp256k1": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.8.0.tgz", - "integrity": "sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw==", - "optional": true, - "requires": { - "bindings": "^1.5.0", - "bip66": "^1.1.5", - "bn.js": "^4.11.8", - "create-hash": "^1.2.0", - "drbg.js": "^1.0.1", - "elliptic": "^6.5.2", - "nan": "^2.14.0", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "optional": true - } - } - }, "select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", diff --git a/examples/react-example/package.json b/examples/react-example/package.json index eca69b8c..a4528bdb 100644 --- a/examples/react-example/package.json +++ b/examples/react-example/package.json @@ -6,9 +6,9 @@ "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", - "@toruslabs/openlogin-ed25519": "^0.9.1", + "@toruslabs/openlogin-ed25519": "^2.0.0", "bs58": "^4.0.1", - "openlogin": "^2.5.0", + "openlogin": "file:../../packages/openlogin", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3", diff --git a/examples/react-example/src/App.tsx b/examples/react-example/src/App.tsx index fb71d3b1..90642ec8 100644 --- a/examples/react-example/src/App.tsx +++ b/examples/react-example/src/App.tsx @@ -32,6 +32,7 @@ function App() { setLoading(true); try { const privKey = await openlogin.login({ + sessionTime: 60, // pass empty string '' as loginProvider to open default torus modal // with all default supported login providers or you can pass specific // login provider from available list to set as default. diff --git a/packages/openlogin/src/OpenLogin.ts b/packages/openlogin/src/OpenLogin.ts index d387d1dd..48e8d5ad 100644 --- a/packages/openlogin/src/OpenLogin.ts +++ b/packages/openlogin/src/OpenLogin.ts @@ -242,6 +242,9 @@ class OpenLogin { }); this.state.privKey = ""; + this.state.store.set("sessionId", ""); + this.state.store.set("refreshToken", ""); + this.state.store.set("idToken", ""); return res; } @@ -418,7 +421,12 @@ class OpenLogin { return this.request>({ allowedInteractions: [ALLOWED_INTERACTIONS.JRPC], method: OPENLOGIN_METHOD.GET_DATA, - params: [{}], + params: [ + { + appRefreshToken: this.state.store.get("refreshToken"), + appIdToken: this.state.store.get("idToken"), + }, + ], }); } @@ -428,7 +436,11 @@ class OpenLogin { throw new Error("expected store to be an object"); } Object.keys(newState.store).forEach((key) => { - this.state.store.set(key, newState.store[key]); + // empty values of refresh, id token and refreshed session id might come coz of 3pc issues. + // reset only if new value is present or if privKey is not present (logout case) + if (newState.store[key] || !newState.privKey) { + this.state.store.set(key, newState.store[key]); + } }); } const { store } = this.state;