From e9dd630be0f5bc4295fc4ff536f2b32ced1671e1 Mon Sep 17 00:00:00 2001 From: 0xPenryn Date: Wed, 13 Dec 2023 05:20:05 +0100 Subject: [PATCH] feat: v0.1.0 (#5) * feat: bump to idkit v1 * fix * fix * fix: support both credentials * empty * try this * fix: try more * facepalm * cleanup * feat: action description --- package.json | 4 +- pnpm-lock.yaml | 277 ++++++++++++++++++------------------ src/pages/api/isVerified.ts | 14 +- src/pages/api/verify.ts | 56 ++++---- src/pages/verify.tsx | 34 ++--- 5 files changed, 189 insertions(+), 196 deletions(-) diff --git a/package.json b/package.json index 5efbda3..e381515 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,13 @@ "@types/node": "18.16.3", "@types/react": "18.2.0", "@types/react-dom": "18.2.1", - "@worldcoin/idkit": "1.0.0-alpha.6", + "@worldcoin/idkit": "^1.1.0", "eslint": "8.39.0", "eslint-config-next": "13.3.4", "next": "13.3.4", "react": "18.2.0", "react-dom": "18.2.0", - "redis": "^4.6.10", + "redis": "^4.6.11", "typescript": "5.0.4" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 72a88e2..8007a45 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ dependencies: specifier: 18.2.1 version: 18.2.1 '@worldcoin/idkit': - specifier: 1.0.0-alpha.6 - version: 1.0.0-alpha.6(@types/react-dom@18.2.1)(@types/react@18.2.0)(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0)(tailwindcss@3.3.2)(typescript@5.0.4) + specifier: ^1.1.0 + version: 1.1.0(@types/react-dom@18.2.1)(@types/react@18.2.0)(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0)(tailwindcss@3.3.2)(typescript@5.0.4) eslint: specifier: 8.39.0 version: 8.39.0 @@ -33,8 +33,8 @@ dependencies: specifier: 18.2.0 version: 18.2.0(react@18.2.0) redis: - specifier: ^4.6.10 - version: 4.6.10 + specifier: ^4.6.11 + version: 4.6.11 typescript: specifier: 5.0.4 version: 5.0.4 @@ -65,8 +65,8 @@ packages: resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} engines: {node: '>=10'} - /@babel/runtime@7.23.2: - resolution: {integrity: sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==} + /@babel/runtime@7.23.6: + resolution: {integrity: sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==} engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.0 @@ -101,15 +101,15 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: false - /@eslint/eslintrc@2.1.2: - resolution: {integrity: sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==} + /@eslint/eslintrc@2.1.4: + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 debug: 4.3.4 espree: 9.6.1 - globals: 13.23.0 - ignore: 5.2.4 + globals: 13.24.0 + ignore: 5.3.0 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -354,7 +354,7 @@ packages: /@radix-ui/primitive@1.0.1: resolution: {integrity: sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw==} dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 dev: false /@radix-ui/react-collection@1.0.3(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0): @@ -370,7 +370,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@radix-ui/react-context': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) @@ -390,7 +390,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@types/react': 18.2.0 react: 18.2.0 dev: false @@ -404,7 +404,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@types/react': 18.2.0 react: 18.2.0 dev: false @@ -422,7 +422,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/primitive': 1.0.1 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@radix-ui/react-context': 1.0.1(@types/react@18.2.0)(react@18.2.0) @@ -456,7 +456,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/primitive': 1.0.1 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) @@ -477,7 +477,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@types/react': 18.2.0 react: 18.2.0 dev: false @@ -495,7 +495,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.2.0)(react@18.2.0) @@ -514,7 +514,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 react: 18.2.0 @@ -533,7 +533,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) '@types/react': 18.2.0 '@types/react-dom': 18.2.1 @@ -554,7 +554,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 @@ -576,7 +576,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-slot': 1.0.2(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 '@types/react-dom': 18.2.1 @@ -593,7 +593,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 react: 18.2.0 @@ -612,7 +612,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/primitive': 1.0.1 '@radix-ui/react-collection': 1.0.3(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.0)(react@18.2.0) @@ -640,7 +640,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@types/react': 18.2.0 react: 18.2.0 dev: false @@ -654,7 +654,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 react: 18.2.0 @@ -669,7 +669,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.2.0)(react@18.2.0) '@types/react': 18.2.0 react: 18.2.0 @@ -684,7 +684,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@types/react': 18.2.0 react: 18.2.0 dev: false @@ -702,7 +702,7 @@ packages: '@types/react-dom': optional: true dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) '@types/react': 18.2.0 '@types/react-dom': 18.2.1 @@ -710,16 +710,16 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false - /@redis/bloom@1.2.0(@redis/client@1.5.11): + /@redis/bloom@1.2.0(@redis/client@1.5.12): resolution: {integrity: sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==} peerDependencies: '@redis/client': ^1.0.0 dependencies: - '@redis/client': 1.5.11 + '@redis/client': 1.5.12 dev: false - /@redis/client@1.5.11: - resolution: {integrity: sha512-cV7yHcOAtNQ5x/yQl7Yw1xf53kO0FNDTdDU6bFIMbW6ljB7U7ns0YRM+QIkpoqTAt6zK5k9Fq0QWlUbLcq9AvA==} + /@redis/client@1.5.12: + resolution: {integrity: sha512-/ZjE18HRzMd80eXIIUIPcH81UoZpwulbo8FmbElrjPqH0QC0SeIKu1BOU49bO5trM5g895kAjhvalt5h77q+4A==} engines: {node: '>=14'} dependencies: cluster-key-slot: 1.1.2 @@ -727,40 +727,40 @@ packages: yallist: 4.0.0 dev: false - /@redis/graph@1.1.0(@redis/client@1.5.11): - resolution: {integrity: sha512-16yZWngxyXPd+MJxeSr0dqh2AIOi8j9yXKcKCwVaKDbH3HTuETpDVPcLujhFYVPtYrngSco31BUcSa9TH31Gqg==} + /@redis/graph@1.1.1(@redis/client@1.5.12): + resolution: {integrity: sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw==} peerDependencies: '@redis/client': ^1.0.0 dependencies: - '@redis/client': 1.5.11 + '@redis/client': 1.5.12 dev: false - /@redis/json@1.0.6(@redis/client@1.5.11): + /@redis/json@1.0.6(@redis/client@1.5.12): resolution: {integrity: sha512-rcZO3bfQbm2zPRpqo82XbW8zg4G/w4W3tI7X8Mqleq9goQjAGLL7q/1n1ZX4dXEAmORVZ4s1+uKLaUOg7LrUhw==} peerDependencies: '@redis/client': ^1.0.0 dependencies: - '@redis/client': 1.5.11 + '@redis/client': 1.5.12 dev: false - /@redis/search@1.1.5(@redis/client@1.5.11): - resolution: {integrity: sha512-hPP8w7GfGsbtYEJdn4n7nXa6xt6hVZnnDktKW4ArMaFQ/m/aR7eFvsLQmG/mn1Upq99btPJk+F27IQ2dYpCoUg==} + /@redis/search@1.1.6(@redis/client@1.5.12): + resolution: {integrity: sha512-mZXCxbTYKBQ3M2lZnEddwEAks0Kc7nauire8q20oA0oA/LoA+E/b5Y5KZn232ztPb1FkIGqo12vh3Lf+Vw5iTw==} peerDependencies: '@redis/client': ^1.0.0 dependencies: - '@redis/client': 1.5.11 + '@redis/client': 1.5.12 dev: false - /@redis/time-series@1.0.5(@redis/client@1.5.11): + /@redis/time-series@1.0.5(@redis/client@1.5.12): resolution: {integrity: sha512-IFjIgTusQym2B5IZJG3XKr5llka7ey84fw/NOYqESP5WUfQs9zz1ww/9+qoz4ka/S6KcGBodzlCeZ5UImKbscg==} peerDependencies: '@redis/client': ^1.0.0 dependencies: - '@redis/client': 1.5.11 + '@redis/client': 1.5.12 dev: false - /@rushstack/eslint-patch@1.5.1: - resolution: {integrity: sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==} + /@rushstack/eslint-patch@1.6.0: + resolution: {integrity: sha512-2/U3GXA6YiPYQDLGwtGlnNgKYBSwCFIHf8Y9LUY5VATHdtbLlU0Y1R3QoBnT0aB4qv/BEiVVsj7LJXoQCgJ2vA==} dev: false /@scure/base@1.1.3: @@ -788,8 +788,8 @@ packages: tslib: 2.6.2 dev: false - /@tailwindcss/forms@0.5.6(tailwindcss@3.3.2): - resolution: {integrity: sha512-Fw+2BJ0tmAwK/w01tEFL5TiaJBX1NLT1/YbWgvm7ws3Qcn11kiXxzNTEQDMs5V3mQemhB56l3u0i9dwdzSQldA==} + /@tailwindcss/forms@0.5.7(tailwindcss@3.3.2): + resolution: {integrity: sha512-QE7X69iQI+ZXwldE+rzasvbJiyV/ju1FGHH0Qn2W3FKbuYtqp8LKcy6iSw79fVUT5/Vvf+0XgLCeYVG+UV6hOw==} peerDependencies: tailwindcss: '>=3.0.0 || >= 3.0.0-alpha.1' dependencies: @@ -809,8 +809,8 @@ packages: resolution: {integrity: sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==} dev: false - /@types/prop-types@15.7.9: - resolution: {integrity: sha512-n1yyPsugYNSmHgxDFjicaI2+gCNjsBck8UX9kuofAKlc0h1bL+20oSF72KeNaW2DUlesbEVCFgyV2dPGTiY42g==} + /@types/prop-types@15.7.11: + resolution: {integrity: sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==} dev: false /@types/react-dom@18.2.1: @@ -822,13 +822,13 @@ packages: /@types/react@18.2.0: resolution: {integrity: sha512-0FLj93y5USLHdnhIhABk83rm8XEGA7kH3cr+YUlvxoUGp1xNt/DINUMvqPxLyOQMzLmZe8i4RTHbvb8MC7NmrA==} dependencies: - '@types/prop-types': 15.7.9 - '@types/scheduler': 0.16.5 - csstype: 3.1.2 + '@types/prop-types': 15.7.11 + '@types/scheduler': 0.16.8 + csstype: 3.1.3 dev: false - /@types/scheduler@0.16.5: - resolution: {integrity: sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw==} + /@types/scheduler@0.16.8: + resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} dev: false /@typescript-eslint/parser@5.62.0(eslint@8.39.0)(typescript@5.0.4): @@ -893,13 +893,13 @@ packages: eslint-visitor-keys: 3.4.3 dev: false - /@worldcoin/idkit-core@1.0.0-alpha.6(@types/react@18.2.0)(react@18.2.0)(typescript@5.0.4): - resolution: {integrity: sha512-c2xccSqG0aMU2wz5FLpFuMMmlcnPd/WMfHgEjMY7cnaVcUHVzz324LvDSPBCimmMLt0CCcul8c7zC1JY57jnWg==} + /@worldcoin/idkit-core@1.1.0(@types/react@18.2.0)(react@18.2.0)(typescript@5.0.4): + resolution: {integrity: sha512-fT4adkX9yryewkQwvXIUW4m0sW15lJE7x2uIsC0dtrBTYGR9OjnYgNLMcqwnOxhRU8SfI0xyJXcO4JPLeQihgw==} engines: {node: '>=12.4'} dependencies: buffer: 6.0.3 viem: 1.19.13(typescript@5.0.4) - zustand: 4.4.5(@types/react@18.2.0)(react@18.2.0) + zustand: 4.4.7(@types/react@18.2.0)(react@18.2.0) transitivePeerDependencies: - '@types/react' - bufferutil @@ -910,8 +910,8 @@ packages: - zod dev: false - /@worldcoin/idkit@1.0.0-alpha.6(@types/react-dom@18.2.1)(@types/react@18.2.0)(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0)(tailwindcss@3.3.2)(typescript@5.0.4): - resolution: {integrity: sha512-2UsG82tC25wdwqTMgXqgPpD2ILcXR2to3FH9tmvwH83LngxHknC41cD3LJE1GhYNp3o+zGSidGKvbiYytvbFlA==} + /@worldcoin/idkit@1.1.0(@types/react-dom@18.2.1)(@types/react@18.2.0)(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0)(tailwindcss@3.3.2)(typescript@5.0.4): + resolution: {integrity: sha512-zTA05oMv0PteDABjvCidaOEM/jn54dQXjZz8stGakyGI31aXjRVTtoYzbhDrAWRYv84qgGbIg76BcgNV9Kpfqg==} engines: {node: '>=12.4'} peerDependencies: react: '>18.0.0' @@ -921,8 +921,8 @@ packages: '@headlessui/react': 1.7.17(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-dialog': 1.0.5(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-toast': 1.1.5(@types/react-dom@18.2.1)(@types/react@18.2.0)(react-dom@18.2.0)(react@18.2.0) - '@tailwindcss/forms': 0.5.6(tailwindcss@3.3.2) - '@worldcoin/idkit-core': 1.0.0-alpha.6(@types/react@18.2.0)(react@18.2.0)(typescript@5.0.4) + '@tailwindcss/forms': 0.5.7(tailwindcss@3.3.2) + '@worldcoin/idkit-core': 1.1.0(@types/react@18.2.0)(react@18.2.0)(typescript@5.0.4) copy-to-clipboard: 3.3.3 framer-motion: 7.10.3(react-dom@18.2.0)(react@18.2.0) posthog-js-lite: 2.4.0 @@ -930,7 +930,7 @@ packages: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-shadow: 19.1.0(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0) - zustand: 4.4.5(@types/react@18.2.0)(react@18.2.0) + zustand: 4.4.7(@types/react@18.2.0)(react@18.2.0) transitivePeerDependencies: - '@types/react' - '@types/react-dom' @@ -1120,8 +1120,8 @@ packages: peerDependencies: postcss: ^8.1.0 dependencies: - browserslist: 4.22.1 - caniuse-lite: 1.0.30001559 + browserslist: 4.22.2 + caniuse-lite: 1.0.30001568 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -1168,15 +1168,15 @@ packages: dependencies: fill-range: 7.0.1 - /browserslist@4.22.1: - resolution: {integrity: sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==} + /browserslist@4.22.2: + resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001559 - electron-to-chromium: 1.4.574 - node-releases: 2.0.13 - update-browserslist-db: 1.0.13(browserslist@4.22.1) + caniuse-lite: 1.0.30001568 + electron-to-chromium: 1.4.610 + node-releases: 2.0.14 + update-browserslist-db: 1.0.13(browserslist@4.22.2) dev: true /buffer@6.0.3: @@ -1215,8 +1215,8 @@ packages: engines: {node: '>=6'} dev: false - /caniuse-lite@1.0.30001559: - resolution: {integrity: sha512-cPiMKZgqgkg5LY3/ntGeLFUpi6tzddBNS58A4tnTgQw1zON7u2sZMU7SzOeVH4tj20++9ggL+V6FDOFMTaFFYA==} + /caniuse-lite@1.0.30001568: + resolution: {integrity: sha512-vSUkH84HontZJ88MiNrOau1EBrCqEQYgkC5gIySiDlpsm8sGVrhU7Kx4V6h0tnqaHzIHZv08HlJIwPbL4XL9+A==} /chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} @@ -1309,8 +1309,8 @@ packages: engines: {node: '>=4'} hasBin: true - /csstype@3.1.2: - resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + /csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} dev: false /damerau-levenshtein@1.0.8: @@ -1407,8 +1407,8 @@ packages: esutils: 2.0.3 dev: false - /electron-to-chromium@1.4.574: - resolution: {integrity: sha512-bg1m8L0n02xRzx4LsTTMbBPiUd9yIR+74iPtS/Ao65CuXvhVZHP0ym1kSdDG3yHFDXqHQQBKujlN1AQ8qZnyFg==} + /electron-to-chromium@1.4.610: + resolution: {integrity: sha512-mqi2oL1mfeHYtOdCxbPQYV/PL7YrQlxbvFEZ0Ee8GbDdShimqt2/S6z2RWqysuvlwdOrQdqvE0KZrBTipAeJzg==} dev: true /emoji-regex@8.0.0: @@ -1467,7 +1467,7 @@ packages: is-weakref: 1.0.2 object-inspect: 1.13.1 object-keys: 1.1.1 - object.assign: 4.1.4 + object.assign: 4.1.5 regexp.prototype.flags: 1.5.1 safe-array-concat: 1.0.1 safe-regex-test: 1.0.0 @@ -1545,7 +1545,7 @@ packages: optional: true dependencies: '@next/eslint-plugin-next': 13.3.4 - '@rushstack/eslint-patch': 1.5.1 + '@rushstack/eslint-patch': 1.6.0 '@typescript-eslint/parser': 5.62.0(eslint@8.39.0)(typescript@5.0.4) eslint: 8.39.0 eslint-import-resolver-node: 0.3.9 @@ -1582,7 +1582,7 @@ packages: eslint: 8.39.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.39.0) eslint-plugin-import: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.39.0) - fast-glob: 3.3.1 + fast-glob: 3.3.2 get-tsconfig: 4.7.2 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -1664,7 +1664,7 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 aria-query: 5.3.0 array-includes: 3.1.7 array.prototype.flatmap: 1.3.2 @@ -1737,7 +1737,7 @@ packages: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.39.0) '@eslint-community/regexpp': 4.10.0 - '@eslint/eslintrc': 2.1.2 + '@eslint/eslintrc': 2.1.4 '@eslint/js': 8.39.0 '@humanwhocodes/config-array': 0.11.13 '@humanwhocodes/module-importer': 1.0.1 @@ -1757,9 +1757,9 @@ packages: file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.23.0 + globals: 13.24.0 grapheme-splitter: 1.0.4 - ignore: 5.2.4 + ignore: 5.3.0 import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 @@ -1816,8 +1816,8 @@ packages: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: false - /fast-glob@3.3.1: - resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} + /fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 @@ -1855,7 +1855,7 @@ packages: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} dependencies: - flat-cache: 3.1.1 + flat-cache: 3.2.0 dev: false /fill-range@7.0.1: @@ -1880,9 +1880,9 @@ packages: path-exists: 4.0.0 dev: false - /flat-cache@3.1.1: - resolution: {integrity: sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==} - engines: {node: '>=12.0.0'} + /flat-cache@3.2.0: + resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} + engines: {node: ^10.12.0 || >=12.0.0} dependencies: flatted: 3.2.9 keyv: 4.5.4 @@ -2027,8 +2027,8 @@ packages: path-is-absolute: 1.0.1 dev: false - /globals@13.23.0: - resolution: {integrity: sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==} + /globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -2047,8 +2047,8 @@ packages: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.3.1 - ignore: 5.2.4 + fast-glob: 3.3.2 + ignore: 5.3.0 merge2: 1.4.1 slash: 3.0.0 dev: false @@ -2121,8 +2121,8 @@ packages: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: false - /ignore@5.2.4: - resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} + /ignore@5.3.0: + resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} engines: {node: '>= 4'} dev: false @@ -2148,8 +2148,8 @@ packages: /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - /inline-style-prefixer@6.0.4: - resolution: {integrity: sha512-FwXmZC2zbeeS7NzGjJ6pAiqRhXR0ugUShSNb6GApMl6da0/XGc4MOJsoWAywia52EEWbXNSy0pzkwz/+Y+swSg==} + /inline-style-prefixer@7.0.0: + resolution: {integrity: sha512-I7GEdScunP1dQ6IM2mQWh6v0mOYdYmH3Bp31UecKdrcUgcURTcctSe1IECdUznSHKSmsHtjrT3CwCPI1pyxfUQ==} dependencies: css-in-js-utils: 3.1.0 fast-loops: 1.1.3 @@ -2405,7 +2405,7 @@ packages: dependencies: array-includes: 3.1.7 array.prototype.flat: 1.3.2 - object.assign: 4.1.4 + object.assign: 4.1.5 object.values: 1.1.7 dev: false @@ -2438,6 +2438,10 @@ packages: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} + /lilconfig@3.0.0: + resolution: {integrity: sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==} + engines: {node: '>=14'} + /lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} @@ -2517,26 +2521,26 @@ packages: object-assign: 4.1.1 thenify-all: 1.6.0 - /nano-css@5.3.5(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-vSB9X12bbNu4ALBu7nigJgRViZ6ja3OU7CeuiV1zMIbXOdmkLahgtPmh3GBOlDxbKY0CitqlPdOReGlBLSp+yg==} + /nano-css@5.6.1(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-T2Mhc//CepkTa3X4pUhKgbEheJHYAxD0VptuqFhDbGMUWVV2m+lkNiW/Ieuj35wrfC8Zm0l7HvssQh7zcEttSw==} peerDependencies: react: '*' react-dom: '*' dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 css-tree: 1.1.3 - csstype: 3.1.2 + csstype: 3.1.3 fastest-stable-stringify: 2.0.2 - inline-style-prefixer: 6.0.4 + inline-style-prefixer: 7.0.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) rtl-css-js: 1.16.1 - sourcemap-codec: 1.4.8 stacktrace-js: 2.0.2 stylis: 4.3.0 dev: false - /nanoid@3.3.6: - resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true @@ -2568,7 +2572,7 @@ packages: '@next/env': 13.3.4 '@swc/helpers': 0.5.1 busboy: 1.6.0 - caniuse-lite: 1.0.30001559 + caniuse-lite: 1.0.30001568 postcss: 8.4.14 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -2588,8 +2592,8 @@ packages: - babel-plugin-macros dev: false - /node-releases@2.0.13: - resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} + /node-releases@2.0.14: + resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true /normalize-path@3.0.0: @@ -2618,8 +2622,8 @@ packages: engines: {node: '>= 0.4'} dev: false - /object.assign@4.1.4: - resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} + /object.assign@4.1.5: + resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.5 @@ -2790,8 +2794,8 @@ packages: camelcase-css: 2.0.1 postcss: 8.4.23 - /postcss-load-config@4.0.1(postcss@8.4.23): - resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==} + /postcss-load-config@4.0.2(postcss@8.4.23): + resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} engines: {node: '>= 14'} peerDependencies: postcss: '>=8.0.9' @@ -2802,9 +2806,9 @@ packages: ts-node: optional: true dependencies: - lilconfig: 2.1.0 + lilconfig: 3.0.0 postcss: 8.4.23 - yaml: 2.3.3 + yaml: 2.3.4 /postcss-nested@6.0.1(postcss@8.4.23): resolution: {integrity: sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==} @@ -2829,7 +2833,7 @@ packages: resolution: {integrity: sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.6 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 dev: false @@ -2838,7 +2842,7 @@ packages: resolution: {integrity: sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.6 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 @@ -2980,7 +2984,7 @@ packages: fast-deep-equal: 3.1.3 fast-shallow-equal: 1.0.0 js-cookie: 2.2.1 - nano-css: 5.3.5(react-dom@18.2.0)(react@18.2.0) + nano-css: 5.6.1(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-universal-interface: 0.6.2(react@18.2.0)(tslib@2.6.2) @@ -3010,15 +3014,15 @@ packages: dependencies: picomatch: 2.3.1 - /redis@4.6.10: - resolution: {integrity: sha512-mmbyhuKgDiJ5TWUhiKhBssz+mjsuSI/lSZNPI9QvZOYzWvYGejtb+W3RlDDf8LD6Bdl5/mZeG8O1feUGhXTxEg==} + /redis@4.6.11: + resolution: {integrity: sha512-kg1Lt4NZLYkAjPOj/WcyIGWfZfnyfKo1Wg9YKVSlzhFwxpFIl3LYI8BWy1Ab963LLDsTz2+OwdsesHKljB3WMQ==} dependencies: - '@redis/bloom': 1.2.0(@redis/client@1.5.11) - '@redis/client': 1.5.11 - '@redis/graph': 1.1.0(@redis/client@1.5.11) - '@redis/json': 1.0.6(@redis/client@1.5.11) - '@redis/search': 1.1.5(@redis/client@1.5.11) - '@redis/time-series': 1.0.5(@redis/client@1.5.11) + '@redis/bloom': 1.2.0(@redis/client@1.5.12) + '@redis/client': 1.5.12 + '@redis/graph': 1.1.1(@redis/client@1.5.12) + '@redis/json': 1.0.6(@redis/client@1.5.12) + '@redis/search': 1.1.6(@redis/client@1.5.12) + '@redis/time-series': 1.0.5(@redis/client@1.5.12) dev: false /reflect.getprototypeof@1.0.4: @@ -3099,7 +3103,7 @@ packages: /rtl-css-js@1.16.1: resolution: {integrity: sha512-lRQgou1mu19e+Ya0LsTvKrVJ5TYUbqCVPAiImX3UfLTenarvPUl1QFdvu5Z3PYmHT9RCcwIfbjRQBntExyj3Zg==} dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.6 dev: false /run-parallel@1.2.0: @@ -3216,11 +3220,6 @@ packages: engines: {node: '>=0.10.0'} dev: false - /sourcemap-codec@1.4.8: - resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} - deprecated: Please use @jridgewell/sourcemap-codec instead - dev: false - /stack-generator@2.0.10: resolution: {integrity: sha512-mwnua/hkqM6pF4k8SnmZ2zfETsRUpWXREfA/goT8SLCV4iOFa4bzOX2nDipWAZFPTjLvQB82f5yaodMVhK0yJQ==} dependencies: @@ -3371,7 +3370,7 @@ packages: chokidar: 3.5.3 didyoumean: 1.2.2 dlv: 1.1.3 - fast-glob: 3.3.1 + fast-glob: 3.3.2 glob-parent: 6.0.2 is-glob: 4.0.3 jiti: 1.21.0 @@ -3383,7 +3382,7 @@ packages: postcss: 8.4.23 postcss-import: 15.1.0(postcss@8.4.23) postcss-js: 4.0.1(postcss@8.4.23) - postcss-load-config: 4.0.1(postcss@8.4.23) + postcss-load-config: 4.0.2(postcss@8.4.23) postcss-nested: 6.0.1(postcss@8.4.23) postcss-selector-parser: 6.0.13 postcss-value-parser: 4.2.0 @@ -3530,13 +3529,13 @@ packages: which-boxed-primitive: 1.0.2 dev: false - /update-browserslist-db@1.0.13(browserslist@4.22.1): + /update-browserslist-db@1.0.13(browserslist@4.22.2): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: - browserslist: 4.22.1 + browserslist: 4.22.2 escalade: 3.1.1 picocolors: 1.0.0 dev: true @@ -3705,8 +3704,8 @@ packages: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} dev: false - /yaml@2.3.3: - resolution: {integrity: sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==} + /yaml@2.3.4: + resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} engines: {node: '>= 14'} /yargs-parser@18.1.3: @@ -3739,8 +3738,8 @@ packages: engines: {node: '>=10'} dev: false - /zustand@4.4.5(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-jgIrBBLKncQW74PA2Lclct3gwD4aPughwGE4FqlXrv3rDqQox7JCn8rwUiFK6ygJcbBAvfTf8fF+ICg7HLD2FQ==} + /zustand@4.4.7(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-QFJWJMdlETcI69paJwhSMJz7PPWjVP8Sjhclxmxmxv/RYI7ZOvR5BHX+ktH0we9gTWQMxcne8q1OY8xxz604gw==} engines: {node: '>=12.7.0'} peerDependencies: '@types/react': '>=16.8' diff --git a/src/pages/api/isVerified.ts b/src/pages/api/isVerified.ts index dc8587d..7bb9286 100644 --- a/src/pages/api/isVerified.ts +++ b/src/pages/api/isVerified.ts @@ -11,19 +11,17 @@ export default async function handler( req: NextApiRequest, res: NextApiResponse ) { - const uuid = req.query.id as string; + const req_uuid = req.query.id as string; const client = await createClient({ url: process.env.REDIS_URL, socket: { tls: true } }) - .on('error', err => console.log('Redis Client Error', err)) + .on('error', err => console.error('Redis Client Error', err)) .connect(); - const credential = await client.get(uuid); - if (credential == "orb") { - res.status(200).send("orb"); - } else if (credential == "device") { - res.status(200).send("lite"); + const cred = await client.get(req_uuid); + if (cred) { + res.status(200).send(cred); } else { res.status(404).send({ code: "not_found", detail: "This credential has not been verified!" }); } -} +} \ No newline at end of file diff --git a/src/pages/api/verify.ts b/src/pages/api/verify.ts index 4380c80..e61c780 100644 --- a/src/pages/api/verify.ts +++ b/src/pages/api/verify.ts @@ -1,5 +1,5 @@ import type { NextApiRequest, NextApiResponse } from "next"; -import { createClient } from 'redis'; +import { createClient } from "redis"; export const config = { api: { @@ -16,46 +16,42 @@ export default function handler( req: NextApiRequest, res: NextApiResponse ) { - const body = req.body; - console.log("Received request to verify credential:\n", req.body); - const verifyEndpoint = `${process.env.NEXT_PUBLIC_WLD_API_BASE_URL}/api/v1/verify/${req.body.app_id}`; - const uuid = req.body.uuid; + const verifyEndpoint = `${process.env.NEXT_PUBLIC_WLD_API_BASE_URL}/api/v1/verify/${process.env.NEXT_PUBLIC_APP_ID}`; + const req_uuid = req.body.signal; const reqBody = { nullifier_hash: req.body.nullifier_hash, merkle_root: req.body.merkle_root, proof: req.body.proof, - credential_type: req.body.credential_type, + verification_level: req.body.verification_level, action: req.body.action, - signal: uuid, + signal: req.body.signal, }; - console.log("Sending request to World ID /verify endpoint:\n", reqBody); fetch(verifyEndpoint, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(reqBody), - }).then((verifyRes) => { - verifyRes.json().then(async (wldResponse) => { - const client = await createClient({ - url: process.env.REDIS_URL, - socket: { tls: true } - }) - .on('error', err => console.log('Redis Client Error', err)) - .connect(); - if (verifyRes.status == 200) { - client.set(uuid, wldResponse.credential_type, { 'EX': 60 * 60 }); - res.status(verifyRes.status).send({ - code: "success", - detail: "This action verified correctly!", - }); - } else { - // This is where you should handle errors from the World ID /verify endpoint. Usually these errors are due to an invalid credential or a credential that has already been used. - // For this example, we'll just return the error code and detail from the World ID /verify endpoint. - res - .status(verifyRes.status) - .send({ code: wldResponse.code, detail: wldResponse.detail }); - } - }); + }).then(async (verifyRes) => { + const response = await verifyRes.json(); + const client = await createClient({ + url: process.env.REDIS_URL, + socket: { tls: true }, + }) + .on("error", (err) => console.error("Redis Client Error", err)) + .connect(); + if (verifyRes.status == 200) { + client.set(req_uuid, req.body.verification_level, { EX: 60 * 15 }); + res.status(200).send({ + code: "success", + detail: "This action verified correctly!", + }); + } else { + // This is where you should handle errors from the World ID /verify endpoint. Usually these errors are due to an invalid credential or a credential that has already been used. + // For this example, we'll just return the error code and detail from the World ID /verify endpoint. + res + .status(verifyRes.status) + .send({ code: response.code, detail: response.detail }); + } }); } diff --git a/src/pages/verify.tsx b/src/pages/verify.tsx index 0394901..cca436f 100644 --- a/src/pages/verify.tsx +++ b/src/pages/verify.tsx @@ -1,4 +1,4 @@ -import { CredentialType, IDKitWidget, useIDKit } from "@worldcoin/idkit"; +import { IDKitWidget, useIDKit } from "@worldcoin/idkit"; import { ISuccessResult, VerificationLevel } from "@worldcoin/idkit"; import type { VerifyReply } from "./api/verify"; import { useRouter } from "next/dist/client/router"; @@ -6,20 +6,19 @@ import { useEffect, useState } from "react"; export default function Home() { const router = useRouter(); - const [app_id, setAppId] = useState("app_" as `app_${string}`); - const [id, setId] = useState(""); + const [server_uuid, setServerUUID] = useState(""); // The server's UUID to use as action + const [req_uuid, setReqUUID] = useState(""); // The UUID of the verification request, used as signal const IDKit = useIDKit(); useEffect(() => { const params = router.query; - setAppId(params.app_id as `app_${string}`); - setId(params.id as string); + setServerUUID(params.serverUUID as string); + setReqUUID(params.reqUUID as string); IDKit.setOpen(true); }, [router.isReady]); - - const onSuccess = (result: ISuccessResult) => { + const onSuccess = () => { window.close(); }; @@ -28,10 +27,9 @@ export default function Home() { merkle_root: result.merkle_root, nullifier_hash: result.nullifier_hash, proof: result.proof, - credential_type: result.verification_level == VerificationLevel.Orb ? CredentialType.Orb : CredentialType.Device, - action: process.env.NEXT_PUBLIC_WLD_ACTION_NAME, - app_id: app_id, - uuid: id, + verification_level: result.verification_level, + action: server_uuid, + signal: req_uuid, }; const res: Response = await fetch("/api/verify", { method: "POST", @@ -42,21 +40,23 @@ export default function Home() { }) const data: VerifyReply = await res.json() if (res.status !== 200) { - throw new Error(data.toString()); // Throw an error if verification fails + throw new Error(`Error code ${res.status} (${data.code}): ${data.detail}` ?? "Unknown error."); // Throw an error if verification fails } }; return (
- {/*

Minecraft World ID

*/} +

Minecraft World ID

{({ open }) =>