diff --git a/.changeset/eight-masks-mix.md b/.changeset/eight-masks-mix.md new file mode 100644 index 000000000..cef44fce0 --- /dev/null +++ b/.changeset/eight-masks-mix.md @@ -0,0 +1,5 @@ +--- +'@blockchain-lab-um/dapp': patch +--- + +Fixes crash when address is not a string. diff --git a/packages/dapp/package.json b/packages/dapp/package.json index d98445549..c28950dbf 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -36,6 +36,7 @@ "@vercel/og": "^0.5.20", "clsx": "^2.0.0", "did-jwt-vc": "^3.2.13", + "ethers": "^6.9.0", "file-saver": "^2.0.5", "googleapis": "^128.0.0", "headless-stepper": "^1.9.1", diff --git a/packages/dapp/src/components/CredentialDisplay/FormatedPanel.tsx b/packages/dapp/src/components/CredentialDisplay/FormatedPanel.tsx index 38ba8330a..e277e73b7 100644 --- a/packages/dapp/src/components/CredentialDisplay/FormatedPanel.tsx +++ b/packages/dapp/src/components/CredentialDisplay/FormatedPanel.tsx @@ -6,6 +6,7 @@ import { import { DocumentDuplicateIcon } from '@heroicons/react/24/outline'; import { VerifiableCredential } from '@veramo/core'; import clsx from 'clsx'; +import { isAddress } from 'ethers/address'; import { useTranslations } from 'next-intl'; import Tooltip from '@/components/Tooltip'; @@ -93,7 +94,9 @@ const CredentialSubject = ({ {(() => { if (key === 'id') return ; - if (key === 'address') return ; + if (key === 'address' && isAddress(value)) { + return ; + } const isObject = !( typeof value === 'string' || typeof value === 'number' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18ab152f1..ab3990582 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -434,6 +434,9 @@ importers: did-jwt-vc: specifier: ^3.2.13 version: 3.2.13 + ethers: + specifier: ^6.9.0 + version: 6.9.0 file-saver: specifier: ^2.0.5 version: 2.0.5 @@ -3456,10 +3459,10 @@ packages: '@commitlint/execute-rule': 18.1.0 '@commitlint/resolve-extends': 18.1.0 '@commitlint/types': 18.1.0 - '@types/node': 18.18.6 + '@types/node': 18.18.7 chalk: 4.1.2 cosmiconfig: 8.3.6(typescript@5.2.2) - cosmiconfig-typescript-loader: 5.0.0(@types/node@18.18.6)(cosmiconfig@8.3.6)(typescript@5.2.2) + cosmiconfig-typescript-loader: 5.0.0(@types/node@18.18.7)(cosmiconfig@8.3.6)(typescript@5.2.2) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 @@ -6181,7 +6184,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -6227,7 +6230,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 18.18.6 + '@types/node': 18.18.7 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -6259,7 +6262,7 @@ packages: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.20 - '@types/node': 18.18.6 + '@types/node': 18.18.7 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -6368,7 +6371,7 @@ packages: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.5 '@types/istanbul-reports': 3.0.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 '@types/yargs': 17.0.29 chalk: 4.1.2 @@ -8904,13 +8907,13 @@ packages: /@types/bn.js@5.1.1: resolution: {integrity: sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==} dependencies: - '@types/node': 18.18.6 + '@types/node': 18.18.7 dev: false /@types/bn.js@5.1.3: resolution: {integrity: sha512-wT1B4iIO82ecXkdN6waCK8Ou7E71WU+mP1osDA5Q8c6Ur+ozU2vIKUIhSpUr6uE5L2YHocKS1Z2jG2fBC1YVeg==} dependencies: - '@types/node': 20.8.8 + '@types/node': 18.18.7 /@types/body-parser@1.19.4: resolution: {integrity: sha512-N7UDG0/xiPQa2D/XrVJXjkWbpqHCd2sBaB32ggRF2l83RhPfamgKGF8gwwqyksS95qUS5ZYF9aF+lLPRlwI2UA==} @@ -9001,7 +9004,7 @@ packages: /@types/graceful-fs@4.1.8: resolution: {integrity: sha512-NhRH7YzWq8WiNKVavKPBmtLYZHxNY19Hh+az28O/phfp68CF45pMFud+ZzJ8ewnxnC5smIdF3dqFeiSUQ5I+pw==} dependencies: - '@types/node': 18.18.6 + '@types/node': 18.18.7 dev: true /@types/hast@2.3.5: @@ -9124,11 +9127,6 @@ packages: dependencies: undici-types: 5.26.5 - /@types/node@20.8.8: - resolution: {integrity: sha512-YRsdVxq6OaLfmR9Hy816IMp33xOBjfyOgUd77ehqg96CFywxAPbDbXvAsuN2KVg2HOT8Eh6uAfU+l4WffwPVrQ==} - dependencies: - undici-types: 5.25.3 - /@types/node@20.8.9: resolution: {integrity: sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==} dependencies: @@ -9153,7 +9151,7 @@ packages: /@types/pbkdf2@3.1.0: resolution: {integrity: sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==} dependencies: - '@types/node': 20.8.9 + '@types/node': 18.18.7 /@types/prismjs@1.26.0: resolution: {integrity: sha512-ZTaqn/qSqUuAq1YwvOFQfVW1AR/oQJlLSZVustdjwI+GZ8kr0MSHBj0tsXPW1EqHubx50gtBEjbPGsdZwQwCjQ==} @@ -9211,7 +9209,7 @@ packages: /@types/sax@1.2.4: resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} dependencies: - '@types/node': 18.18.6 + '@types/node': 18.18.7 dev: false /@types/scheduler@0.16.5: @@ -12288,7 +12286,7 @@ packages: /core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - /cosmiconfig-typescript-loader@5.0.0(@types/node@18.18.6)(cosmiconfig@8.3.6)(typescript@5.2.2): + /cosmiconfig-typescript-loader@5.0.0(@types/node@18.18.7)(cosmiconfig@8.3.6)(typescript@5.2.2): resolution: {integrity: sha512-+8cK7jRAReYkMwMiG+bxhcNKiHJDM6bR9FD/nGBXOWdMLuYawjF5cGrtLilJ+LGd3ZjCXnJjR5DkfWPoIVlqJA==} engines: {node: '>=v16'} peerDependencies: @@ -12296,7 +12294,7 @@ packages: cosmiconfig: '>=8.2' typescript: '>=4' dependencies: - '@types/node': 18.18.6 + '@types/node': 18.18.7 cosmiconfig: 8.3.6(typescript@5.2.2) jiti: 1.20.0 typescript: 5.2.2 @@ -14273,6 +14271,22 @@ packages: - utf-8-validate dev: false + /ethers@6.9.0: + resolution: {integrity: sha512-pmfNyQzc2mseLe91FnT2vmNaTt8dDzhxZ/xItAV7uGsF4dI4ek2ufMu3rAkgQETL/TIs0GS5A+U05g9QyWnv3Q==} + engines: {node: '>=14.0.0'} + dependencies: + '@adraffy/ens-normalize': 1.10.0 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@types/node': 18.15.13 + aes-js: 4.0.0-beta.5 + tslib: 2.4.0 + ws: 8.5.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /ethjs-unit@0.1.6: resolution: {integrity: sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==} engines: {node: '>=6.5.0', npm: '>=3'} @@ -16845,7 +16859,7 @@ packages: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.1 @@ -16942,7 +16956,7 @@ packages: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -16969,7 +16983,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.8 - '@types/node': 18.18.6 + '@types/node': 18.18.7 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -17019,7 +17033,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 jest-util: 29.7.0 /jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -17068,7 +17082,7 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -17163,7 +17177,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 chalk: 4.1.2 ci-info: 3.8.0 graceful-fs: 4.2.11 @@ -17175,7 +17189,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 18.18.6 + '@types/node': 18.18.7 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -17228,7 +17242,7 @@ packages: resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 18.18.6 + '@types/node': 18.18.7 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -24050,9 +24064,6 @@ packages: resolution: {integrity: sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==} dev: false - /undici-types@5.25.3: - resolution: {integrity: sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==} - /undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}