From b0a37f2af076e8e525e31f30de13846e7a211719 Mon Sep 17 00:00:00 2001 From: Jacob Veal Date: Fri, 3 Mar 2023 12:45:53 -0600 Subject: [PATCH] chore: add ci build steps --- .github/workflows/ci.yaml | 44 ++++++++ package.json | 13 +-- pnpm-lock.yaml | 219 ++++---------------------------------- src/token.ts | 5 +- src/types.ts | 13 +++ src/utils.ts | 4 +- test/utils.ts | 8 +- tsconfig.build.json | 7 ++ tsconfig.json | 8 +- 9 files changed, 100 insertions(+), 221 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 tsconfig.build.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..8fa24ae --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,44 @@ +--- +name: CI + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + identity-token: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [lts/-2, lts/-1, lts/*] + + name: Node.js ${{ matrix.node-version }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: pnpm/action-setup@v2 + with: + version: 7 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + cache: "pnpm" + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: pnpm install + + - name: Compile TypeScript + run: pnpm build + + - name: Test + run: pnpm test + + - name: Lint + run: pnpm lint diff --git a/package.json b/package.json index bb741cc..8ad5a8a 100644 --- a/package.json +++ b/package.json @@ -12,16 +12,17 @@ "dist/src/" ], "scripts": { - "build": "tsc", + "build": "tsc -p 'tsconfig.build.json'", "clean": "rm -rf -- dist", "lint": "eslint src", "test": "c8 mocha -r ts-node/register test/**/*.ts --exit" }, "dependencies": { - "@bitgo-private/wallet-platform-types": "*", "jose": "^4.11.2", "jsonwebtoken": "^8.5.1", - "superagent": "^8.0.9" + "superagent": "^8.0.9", + "fp-ts": "^2.10.5", + "io-ts": "2.1.3" }, "devDependencies": { "@types/chai": "4.3.1", @@ -38,18 +39,12 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", - "fp-ts": "^2.10.5", - "io-ts": "2.1.3", "mocha": "10.0.0", "nock": "13.3.0", - "node:16": "link:@types/node:16", "prettier": "^2.8.4", "ts-node": "10.4.0", "typescript": "4.6.3" }, - "engines": { - "node": "16" - }, "publishConfig": { "access": "public" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a8cd8e..df39f38 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,6 @@ lockfileVersion: 5.4 specifiers: - '@bitgo-private/wallet-platform-types': '*' '@types/chai': 4.3.1 '@types/jsonwebtoken': 8.5.9 '@types/mocha': 9.1.1 @@ -22,15 +21,15 @@ specifiers: jsonwebtoken: ^8.5.1 mocha: 10.0.0 nock: 13.3.0 - node:16: link:@types/node:16 prettier: ^2.8.4 superagent: ^8.0.9 ts-node: 10.4.0 typescript: 4.6.3 dependencies: - '@bitgo-private/wallet-platform-types': 1.1.0 - jose: 4.13.0 + fp-ts: 2.13.1 + io-ts: 2.1.3_fp-ts@2.13.1 + jose: 4.13.1 jsonwebtoken: 8.5.1 superagent: 8.0.9 @@ -39,7 +38,7 @@ devDependencies: '@types/jsonwebtoken': 8.5.9 '@types/mocha': 9.1.1 '@types/nock': 9.3.0 - '@types/node': 18.14.2 + '@types/node': 18.14.5 '@typescript-eslint/eslint-plugin': 5.54.0_ij3tmhbxkeplw6lkretgla2pm4 '@typescript-eslint/parser': 5.54.0_uzojwigngz6z6gjoclmgl5f5uq c8: 7.13.0 @@ -49,68 +48,18 @@ devDependencies: eslint-plugin-prettier: 4.2.1_rlq4czn2p5niyau36qwtjimf2y eslint-plugin-react: 7.32.2_eslint@8.35.0 eslint-plugin-react-hooks: 4.6.0_eslint@8.35.0 - fp-ts: 2.13.1 - io-ts: 2.1.3_fp-ts@2.13.1 mocha: 10.0.0 nock: 13.3.0 - node:16: link:@types/node:16 prettier: 2.8.4 - ts-node: 10.4.0_kug44zlfrkhpfed2xqk5a7oor4 + ts-node: 10.4.0_xcxoujuxnnsxf2fmc7mpqni3de typescript: 4.6.3 packages: - /@api-ts/io-ts-http/1.0.0_jgcx2a34deswuft7xnehcifowq: - resolution: {integrity: sha512-eP3pyoR9r7y7YCkJY5avi7NMKBWFGTs4CB1RE053yXcEDgVcq+X8Oxsq4Jaq+g6IPkhGGueCo7APefRiHjTxMw==} - dependencies: - '@api-ts/response': 1.0.0 - fp-ts: 2.12.3 - io-ts: 2.1.3_fp-ts@2.12.3 - io-ts-types: 0.5.16_sawt45bzulkyxhswpng7n6wcse - transitivePeerDependencies: - - monocle-ts - - newtype-ts - dev: false - - /@api-ts/response/1.0.0: - resolution: {integrity: sha512-OTrMH5yyxNzzkC3fZPcz7KFN2j8A9ZD8YhwiYxy8zGKkE5aOJ4wWQO+q44H5mQLi3txD8AlvwQfkbpo3KyCmGw==} - dev: false - /@bcoe/v8-coverage/0.2.3: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@bitgo-private/query-param-types/1.0.0: - resolution: {integrity: sha512-TxdoycHokug3aFxWcsyWu6i1mxB3XUjdXCtaT/Nj24t/nAnuXAqd9h3xqFNjuZwHUdAkpM2HAzrlgUiuL4IFNA==, tarball: '@bitgo-private/query-param-types/-/@bitgo-private/query-param-types-1.0.0.tgz'} - dependencies: - fp-ts: 2.11.8 - io-ts: 2.1.3_fp-ts@2.11.8 - io-ts-types: 0.5.16_omi66avllbrqykstwpvku5zlsi - monocle-ts: 2.3.13_fp-ts@2.11.8 - newtype-ts: 0.3.5_rwdkjybort55mgflzu3yfqg2mi - dev: false - - /@bitgo-private/schema-decoding/1.0.0: - resolution: {integrity: sha512-wAJxO8IEFq8XZHjqYHyTx7Y182VxypPUOBgu4fbmXigH6A/UkhAun9swK6n/kc1pWQp8/Cn/adkbs7/mqJTAbQ==, tarball: '@bitgo-private/schema-decoding/-/@bitgo-private/schema-decoding-1.0.0.tgz'} - dependencies: - fp-ts: 2.12.1 - io-ts: 2.1.3_fp-ts@2.12.1 - dev: false - - /@bitgo-private/wallet-platform-types/1.1.0: - resolution: {integrity: sha512-yg4mgZ5QIal9DFPqxYCqXUuK8EWTwMfrVKA9Y+cdiLWWLIUtAo+4oZVL0HrSTTVDHDNtq1ztEzooZmQzmfpEfw==, tarball: '@bitgo-private/wallet-platform-types/-/@bitgo-private/wallet-platform-types-1.1.0.tgz'} - dependencies: - '@api-ts/io-ts-http': 1.0.0_jgcx2a34deswuft7xnehcifowq - '@bitgo-private/query-param-types': 1.0.0 - '@bitgo-private/schema-decoding': 1.0.0 - fp-ts: 2.13.1 - io-ts: 2.1.3_fp-ts@2.13.1 - io-ts-numbers: 1.1.1_tpx22hdvietzfjmbx2gx2cfc4u - io-ts-types: 0.5.16_2erii5un74vlpzg7jpsqiymuui - monocle-ts: 2.3.13_fp-ts@2.13.1 - newtype-ts: 0.3.5_y4ecnzjsatnzoei5elwf4wjeqa - dev: false - /@cspotcode/source-map-consumer/0.8.0: resolution: {integrity: sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==} engines: {node: '>= 12'} @@ -238,7 +187,7 @@ packages: /@types/jsonwebtoken/8.5.9: resolution: {integrity: sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==} dependencies: - '@types/node': 18.14.2 + '@types/node': 18.14.5 dev: true /@types/mocha/9.1.1: @@ -248,11 +197,11 @@ packages: /@types/nock/9.3.0: resolution: {integrity: sha512-ZHf/X8rTQ5Tb1rHjxIJYqm55uO265agE3G7NoSXVa2ep+EcJXgB2fsme+zBvK7MhrxTwkC/xkB6THyv50u0MGw==} dependencies: - '@types/node': 18.14.2 + '@types/node': 18.14.5 dev: true - /@types/node/18.14.2: - resolution: {integrity: sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==} + /@types/node/18.14.5: + resolution: {integrity: sha512-CRT4tMK/DHYhw1fcCEBwME9CSaZNclxfzVMe7GsO6ULSwsttbj70wSiX6rZdIjGblu93sTJxLdhNIT85KKI7Qw==} dev: true /@types/semver/7.3.13: @@ -794,7 +743,7 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 internal-slot: 1.0.5 - is-array-buffer: 3.0.1 + is-array-buffer: 3.0.2 is-callable: 1.2.7 is-negative-zero: 2.0.2 is-regex: 1.1.4 @@ -991,7 +940,7 @@ packages: eslint-utils: 3.0.0_eslint@8.35.0 eslint-visitor-keys: 3.3.0 espree: 9.4.1 - esquery: 1.4.2 + esquery: 1.5.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 file-entry-cache: 6.0.1 @@ -1029,8 +978,8 @@ packages: eslint-visitor-keys: 3.3.0 dev: true - /esquery/1.4.2: - resolution: {integrity: sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==} + /esquery/1.5.0: + resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} engines: {node: '>=0.10'} dependencies: estraverse: 5.3.0 @@ -1166,20 +1115,9 @@ packages: qs: 6.11.0 dev: false - /fp-ts/2.11.8: - resolution: {integrity: sha512-WQT6rP6Jt3TxMdQB3IKzvfZKLuldumntgumLhIUhvPrukTHdWNI4JgEHY04Bd0LIOR9IQRpB+7RuxgUU0Vhmcg==} - dev: false - - /fp-ts/2.12.1: - resolution: {integrity: sha512-oxvgqUYR6O9VkKXrxkJ0NOyU0FrE705MeqgBUMEPWyTu6Pwn768cJbHChw2XOBlgFLKfIHxjr2OOBFpv2mUGZw==} - dev: false - - /fp-ts/2.12.3: - resolution: {integrity: sha512-8m0XvW8kZbfnJOA4NvSVXu95mLbPf4LQGwQyqVukIYS4KzSNJiyKSmuZUmbVHteUi6MGkAJGPb0goPZqI+Tsqg==} - dev: false - /fp-ts/2.13.1: resolution: {integrity: sha512-0eu5ULPS2c/jsa1lGFneEFFEdTbembJv8e4QKXeVJ3lm/5hyve06dlKZrpxmMwJt6rYen7sxmHHK2CLaXvWuWQ==} + dev: false /fs.realpath/1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} @@ -1395,93 +1333,16 @@ packages: side-channel: 1.0.4 dev: true - /io-ts-numbers/1.1.1_tpx22hdvietzfjmbx2gx2cfc4u: - resolution: {integrity: sha512-dY+vUz4satTU7hbFYEJ8dNNh3pqGG6l/uyS+1E7o967uCcxg/DDyID82hFDpp77bW1Y8a1TQ3U7YAHGn6+XWAA==} - peerDependencies: - fp-ts: '>= 2.0.0' - io-ts: '>= 2.0.0' - io-ts-types: '>= 0.5.0' - dependencies: - fp-ts: 2.13.1 - io-ts: 2.1.3_fp-ts@2.13.1 - io-ts-types: 0.5.16_2erii5un74vlpzg7jpsqiymuui - dev: false - - /io-ts-types/0.5.16_2erii5un74vlpzg7jpsqiymuui: - resolution: {integrity: sha512-h9noYVfY9rlbmKI902SJdnV/06jgiT2chxG6lYDxaYNp88HscPi+SBCtmcU+m0E7WT5QSwt7sIMj93+qu0FEwQ==} - peerDependencies: - fp-ts: ^2.0.0 - io-ts: ^2.0.0 - monocle-ts: ^2.0.0 - newtype-ts: ^0.3.2 - dependencies: - fp-ts: 2.13.1 - io-ts: 2.1.3_fp-ts@2.13.1 - monocle-ts: 2.3.13_fp-ts@2.13.1 - newtype-ts: 0.3.5_y4ecnzjsatnzoei5elwf4wjeqa - dev: false - - /io-ts-types/0.5.16_omi66avllbrqykstwpvku5zlsi: - resolution: {integrity: sha512-h9noYVfY9rlbmKI902SJdnV/06jgiT2chxG6lYDxaYNp88HscPi+SBCtmcU+m0E7WT5QSwt7sIMj93+qu0FEwQ==} - peerDependencies: - fp-ts: ^2.0.0 - io-ts: ^2.0.0 - monocle-ts: ^2.0.0 - newtype-ts: ^0.3.2 - dependencies: - fp-ts: 2.11.8 - io-ts: 2.1.3_fp-ts@2.11.8 - monocle-ts: 2.3.13_fp-ts@2.11.8 - newtype-ts: 0.3.5_rwdkjybort55mgflzu3yfqg2mi - dev: false - - /io-ts-types/0.5.16_sawt45bzulkyxhswpng7n6wcse: - resolution: {integrity: sha512-h9noYVfY9rlbmKI902SJdnV/06jgiT2chxG6lYDxaYNp88HscPi+SBCtmcU+m0E7WT5QSwt7sIMj93+qu0FEwQ==} - peerDependencies: - fp-ts: ^2.0.0 - io-ts: ^2.0.0 - monocle-ts: ^2.0.0 - newtype-ts: ^0.3.2 - dependencies: - fp-ts: 2.12.3 - io-ts: 2.1.3_fp-ts@2.12.3 - monocle-ts: 2.3.13_fp-ts@2.13.1 - newtype-ts: 0.3.5_y4ecnzjsatnzoei5elwf4wjeqa - dev: false - - /io-ts/2.1.3_fp-ts@2.11.8: - resolution: {integrity: sha512-QFMR2QEBSP6w1TPmkpfca6xkzBbXO+K7ubdbV26GlCGI7CP9LV59bfty422JYtWgbBITuL/zBb1+mziv9f5Wfg==} - peerDependencies: - fp-ts: ^2.0.0 - dependencies: - fp-ts: 2.11.8 - dev: false - - /io-ts/2.1.3_fp-ts@2.12.1: - resolution: {integrity: sha512-QFMR2QEBSP6w1TPmkpfca6xkzBbXO+K7ubdbV26GlCGI7CP9LV59bfty422JYtWgbBITuL/zBb1+mziv9f5Wfg==} - peerDependencies: - fp-ts: ^2.0.0 - dependencies: - fp-ts: 2.12.1 - dev: false - - /io-ts/2.1.3_fp-ts@2.12.3: - resolution: {integrity: sha512-QFMR2QEBSP6w1TPmkpfca6xkzBbXO+K7ubdbV26GlCGI7CP9LV59bfty422JYtWgbBITuL/zBb1+mziv9f5Wfg==} - peerDependencies: - fp-ts: ^2.0.0 - dependencies: - fp-ts: 2.12.3 - dev: false - /io-ts/2.1.3_fp-ts@2.13.1: resolution: {integrity: sha512-QFMR2QEBSP6w1TPmkpfca6xkzBbXO+K7ubdbV26GlCGI7CP9LV59bfty422JYtWgbBITuL/zBb1+mziv9f5Wfg==} peerDependencies: fp-ts: ^2.0.0 dependencies: fp-ts: 2.13.1 + dev: false - /is-array-buffer/3.0.1: - resolution: {integrity: sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==} + /is-array-buffer/3.0.2: + resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} dependencies: call-bind: 1.0.2 get-intrinsic: 1.2.0 @@ -1647,8 +1508,8 @@ packages: istanbul-lib-report: 3.0.0 dev: true - /jose/4.13.0: - resolution: {integrity: sha512-v6BN7fuPVfG9XIxcPT2jzyAg5EmA/mtNeJEXJ7d31Wz7fFOqOZeN8mPtNJYQmnuAIxJII7EcURcbZ7qXs9a4kA==} + /jose/4.13.1: + resolution: {integrity: sha512-MSJQC5vXco5Br38mzaQKiq9mwt7lwj2eXpgpRyQYNHYt2lq1PjkWa7DLXX0WVcQLE9HhMh3jPiufS7fhJf+CLQ==} dev: false /js-sdsl/4.3.0: @@ -1884,22 +1745,6 @@ packages: yargs-unparser: 2.0.0 dev: true - /monocle-ts/2.3.13_fp-ts@2.11.8: - resolution: {integrity: sha512-D5Ygd3oulEoAm3KuGO0eeJIrhFf1jlQIoEVV2DYsZUMz42j4tGxgct97Aq68+F8w4w4geEnwFa8HayTS/7lpKQ==} - peerDependencies: - fp-ts: ^2.5.0 - dependencies: - fp-ts: 2.11.8 - dev: false - - /monocle-ts/2.3.13_fp-ts@2.13.1: - resolution: {integrity: sha512-D5Ygd3oulEoAm3KuGO0eeJIrhFf1jlQIoEVV2DYsZUMz42j4tGxgct97Aq68+F8w4w4geEnwFa8HayTS/7lpKQ==} - peerDependencies: - fp-ts: ^2.5.0 - dependencies: - fp-ts: 2.13.1 - dev: false - /ms/2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} @@ -1920,26 +1765,6 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true - /newtype-ts/0.3.5_rwdkjybort55mgflzu3yfqg2mi: - resolution: {integrity: sha512-v83UEQMlVR75yf1OUdoSFssjitxzjZlqBAjiGQ4WJaML8Jdc68LJ+BaSAXUmKY4bNzp7hygkKLYTsDi14PxI2g==} - peerDependencies: - fp-ts: ^2.0.0 - monocle-ts: ^2.0.0 - dependencies: - fp-ts: 2.11.8 - monocle-ts: 2.3.13_fp-ts@2.11.8 - dev: false - - /newtype-ts/0.3.5_y4ecnzjsatnzoei5elwf4wjeqa: - resolution: {integrity: sha512-v83UEQMlVR75yf1OUdoSFssjitxzjZlqBAjiGQ4WJaML8Jdc68LJ+BaSAXUmKY4bNzp7hygkKLYTsDi14PxI2g==} - peerDependencies: - fp-ts: ^2.0.0 - monocle-ts: ^2.0.0 - dependencies: - fp-ts: 2.13.1 - monocle-ts: 2.3.13_fp-ts@2.13.1 - dev: false - /nock/13.3.0: resolution: {integrity: sha512-HHqYQ6mBeiMc+N038w8LkMpDCRquCHWeNmN3v6645P3NhN2+qXOBqvPqo7Rt1VyCMzKhJ733wZqw5B7cQVFNPg==} engines: {node: '>= 10.13'} @@ -2378,7 +2203,7 @@ packages: is-number: 7.0.0 dev: true - /ts-node/10.4.0_kug44zlfrkhpfed2xqk5a7oor4: + /ts-node/10.4.0_xcxoujuxnnsxf2fmc7mpqni3de: resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} hasBin: true peerDependencies: @@ -2397,7 +2222,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 - '@types/node': 18.14.2 + '@types/node': 18.14.5 acorn: 8.8.2 acorn-walk: 8.2.0 arg: 4.1.3 @@ -2566,7 +2391,7 @@ packages: require-directory: 2.1.1 string-width: 4.2.3 y18n: 5.0.8 - yargs-parser: 20.2.4 + yargs-parser: 20.2.9 dev: true /yn/3.1.1: diff --git a/src/token.ts b/src/token.ts index b57df40..635c873 100644 --- a/src/token.ts +++ b/src/token.ts @@ -1,5 +1,4 @@ -import type { AccessTokenResponse } from '@bitgo-private/wallet-platform-types'; -import type { IdentityJWTPayload } from './types'; +import type { IdentityJWTPayload, LegacyAccessToken } from './types'; export class IdentityToken { public readonly payload: IdentityJWTPayload; @@ -17,7 +16,7 @@ export class IdentityToken { * @param originToUse - the web origin to select when jwt contains more than * one allowed web origin */ - public mapToLegacy(originToUse?: string): AccessTokenResponse { + public mapToLegacy(originToUse?: string): LegacyAccessToken { return { id: this.payload.jti || '', client: this.payload.azp, diff --git a/src/types.ts b/src/types.ts index 1168cb7..ae19376 100644 --- a/src/types.ts +++ b/src/types.ts @@ -47,3 +47,16 @@ export const IdentityJWTPayload = t.type({ }); export type IdentityJWTPayload = t.TypeOf; + +export type LegacyAccessToken = { + id: string; + client: string; + user: string; + scope: string[]; + created: Date; + expires: Date; + origin: string; + label: string; + isExtensible: boolean; + token: string; +}; diff --git a/src/utils.ts b/src/utils.ts index a33d63a..3c5d24b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -17,9 +17,7 @@ export const getIdentityJWKSetFunction = ( baseUrl?: string, options?: jose.RemoteJWKSetOptions ): GetKeyFunction => { - const url = - baseUrl || - 'http://identity-service-keycloakx-http.identity-service.svc.cluster.local'; + const url = baseUrl || 'https://identity.bitgo.com'; return jose.createRemoteJWKSet( new URL(`${url}/realms/bitgo/protocol/openid-connect/certs`), options diff --git a/test/utils.ts b/test/utils.ts index 22fd9b0..9d473f3 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -2,9 +2,7 @@ import nock from 'nock'; export const nockGetJWKSetCall = () => { // JWS keys are from identity.bitgo-dev.com - nock( - 'http://identity-service-keycloakx-http.identity-service.svc.cluster.local' - ) + nock('https://identity.bitgo.com') .get('/realms/bitgo/protocol/openid-connect/certs') .reply(200, { keys: [ @@ -39,9 +37,7 @@ export const nockGetJWKSetCall = () => { }; export const nockGetJWKSetCallFailure = () => { - nock( - 'http://identity-service-keycloakx-http.identity-service.svc.cluster.local' - ) + nock('https://identity.bitgo.com') .get('/realms/bitgo/protocol/openid-connect/certs') .reply(500); }; diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..af54461 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "exclude": [ + "test", + ] + } + \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 7bd3e72..5be9e6f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,8 +8,9 @@ "node_modules" ], "compilerOptions": { - "outDir": "./dist", - "baseUrl": "./", + "outDir": "dist", + "baseUrl": "src", + "rootDir": ".", "strict": true, "esModuleInterop": true, "strictNullChecks": true, @@ -19,6 +20,7 @@ "resolveJsonModule": true, "skipLibCheck": true, "module": "CommonJS", - "target": "ES2020" + "target": "ES2020", + "declaration": true } }