From 8f52389b4d88c2f4e7e327e28f907149304453ce Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Tue, 30 Apr 2024 15:51:23 +0200 Subject: [PATCH 1/8] polyfills are correctly resolved now, but some crypto polyfill is unimplemented --- nuxt.config.ts | 31 +++++++++++++++++++++++++++---- package.json | 4 ++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 9ba2fb7..d37fd2c 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,8 +1,6 @@ import { defineNuxtConfig } from 'nuxt/config' -// Add polyfills: https://github.com/nuxt/nuxt/pull/25028 -import { Buffer } from 'node:buffer' -import process from 'node:process' +import 'node:crypto'; export default defineNuxtConfig({ app: { @@ -61,7 +59,7 @@ export default defineNuxtConfig({ externalVue: false, }, routeRules: { - '/': { ssr: false }, + '/': { ssr: true }, }, imports: { autoImport: false, @@ -73,7 +71,32 @@ export default defineNuxtConfig({ defaultImport: 'component', global: false, }, + ssr: true, vite: { + define: { + process: {}, + global: 'globalThis', + }, + // This is not ideal and should work via `unenv` directly.. + resolve: { + alias: { + crypto: './node_modules/unenv/runtime/node/crypto/node.cjs', + // assert: './node_modules/unenv/runtime/mock/proxy.cjs', + http: './node_modules/unenv/runtime/node/http/index.cjs', + buffer: './node_modules/unenv/runtime/node/buffer/index.cjs', + os: './node_modules/unenv/runtime/mock/proxy.cjs', + url: './node_modules/unenv/runtime/node/url/index.cjs', + zlib: './node_modules/unenv/runtime/mock/proxy.cjs', + 'process/': './node_modules/unenv/runtime/mock/proxy.cjs', + process: './node_modules/unenv/runtime/mock/proxy.cjs', + stream: './node_modules/unenv/runtime/mock/proxy.cjs', + _stream_duplex: './node_modules/unenv/runtime/mock/proxy.cjs', + _stream_passthrough: './node_modules/unenv/runtime/mock/proxy.cjs', + _stream_readable: './node_modules/unenv/runtime/mock/proxy.cjs', + _stream_writable: './node_modules/unenv/runtime/mock/proxy.cjs', + _stream_transform: './node_modules/unenv/runtime/mock/proxy.cjs', + }, + }, css: { preprocessorOptions: { scss: { diff --git a/package.json b/package.json index 8ad6dbb..d993123 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,12 @@ "nuxt": "^3.11.2", "postcss": "^8.4.38", "tailwindcss": "^3.4.3", - "unenv": "^1.9.0", "vite": "^5.2.10", "vue": "^3.4.26", "vue-router": "^4.3.2" }, "dependencies": { - "@encointer/worker-api": "^0.12.4", + "@encointer/worker-api": "^0.12.5-alpha.0", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@material-tailwind/html": "^2.2.2", "@nuxt/content": "^2.12.1", @@ -50,6 +49,7 @@ "nuxt-svgo": "^4.0.0", "pinia": "^2.1.7", "sass": "^1.75.0", + "unenv": "^1.9.0", "vue3-form-wizard": "^0.2.3" } } From 4ff8643375982f9ebf6f45bea85e0ee4bc744f4e Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Tue, 30 Apr 2024 16:51:17 +0200 Subject: [PATCH 2/8] bump encointer-js --- package.json | 2 +- yarn.lock | 46 +++++++++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index d993123..a031fc8 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "vue-router": "^4.3.2" }, "dependencies": { - "@encointer/worker-api": "^0.12.5-alpha.0", + "@encointer/worker-api": "^0.12.5-alpha.1", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@material-tailwind/html": "^2.2.2", "@nuxt/content": "^2.12.1", diff --git a/yarn.lock b/yarn.lock index 0cd8a2a..3df0edf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -485,32 +485,32 @@ __metadata: languageName: node linkType: hard -"@encointer/node-api@npm:^0.12.4": - version: 0.12.4 - resolution: "@encointer/node-api@npm:0.12.4" +"@encointer/node-api@npm:^0.12.5-alpha.1": + version: 0.12.5-alpha.1 + resolution: "@encointer/node-api@npm:0.12.5-alpha.1" dependencies: - "@encointer/types": "npm:^0.12.4" + "@encointer/types": "npm:^0.12.5-alpha.1" "@polkadot/api": "npm:^10.9.1" tslib: "npm:^2.5.3" - checksum: 10c0/7a9c15edfb49b757ebb7ca6341a0e1d533dd48834242db9da8a1f77091d380f4966b0aa8d53f2c27b2b96716c5e49e39e083f403b22e4072d80f8c799b94a181 + checksum: 10c0/e629010b6bc707eb8263119940786f962adcff74afc418e76406f1dbbe0244c35a3701e4787ffd07fae86e14d856374d5d1752a3323982acd06da4a951142371 languageName: node linkType: hard -"@encointer/types@npm:^0.12.4": - version: 0.12.4 - resolution: "@encointer/types@npm:0.12.4" +"@encointer/types@npm:^0.12.5-alpha.1": + version: 0.12.5-alpha.1 + resolution: "@encointer/types@npm:0.12.5-alpha.1" dependencies: "@polkadot/api": "npm:^10.9.1" "@polkadot/types": "npm:^10.9.1" "@polkadot/types-codec": "npm:^10.9.1" "@polkadot/util": "npm:^12.3.2" - checksum: 10c0/2263d64e704257c4ceb018dd84ad8133c04f4f1ce3dfe6490cfdbb84f9b50fda35303bc073010a85ef10f050c0ea0d0c1800ef80587e680d6501ad710e3cd158 + checksum: 10c0/cb1a0bff1051a9c6bedd2de16d86f7e04ab94fff65895b1a6ebc6ff403f6dd7bc19f49bfa0c8100baae1f0bc0af1528c0578efe80e306477434619e37aa386b0 languageName: node linkType: hard -"@encointer/util@npm:^0.12.4": - version: 0.12.4 - resolution: "@encointer/util@npm:0.12.4" +"@encointer/util@npm:^0.12.5-alpha.1": + version: 0.12.5-alpha.1 + resolution: "@encointer/util@npm:0.12.5-alpha.1" dependencies: "@babel/runtime": "npm:^7.18.9" "@polkadot/util": "npm:^12.3.2" @@ -518,18 +518,18 @@ __metadata: "@types/bn.js": "npm:^5.1.1" assert: "npm:^2.0.0" bn.js: "npm:^5.2.1" - checksum: 10c0/d3e1981d9990ff4ca3e86c9b44b69c3634d5c045fea48bfe6eeed56c6a51ad77543abb3bd6d057a8e8b3c5ded05ddccd852a390ae3a2b550a5a5528537500786 + checksum: 10c0/f035e548b67265d95f15c6237686654a4191a3db08a7a77694f91ab17e588d8b2afe210269000fd9186673d9373d76e452c845257823cd2432bc38d80301c4af languageName: node linkType: hard -"@encointer/worker-api@npm:^0.12.4": - version: 0.12.4 - resolution: "@encointer/worker-api@npm:0.12.4" +"@encointer/worker-api@npm:^0.12.5-alpha.1": + version: 0.12.5-alpha.1 + resolution: "@encointer/worker-api@npm:0.12.5-alpha.1" dependencies: - "@encointer/node-api": "npm:^0.12.4" - "@encointer/types": "npm:^0.12.4" - "@encointer/util": "npm:^0.12.4" - "@learntheropes/node-rsa": "npm:^1.1.3" + "@encointer/node-api": "npm:^0.12.5-alpha.1" + "@encointer/types": "npm:^0.12.5-alpha.1" + "@encointer/util": "npm:^0.12.5-alpha.1" + "@learntheropes/node-rsa": "npm:~1.1.3" "@polkadot/api": "npm:^10.9.1" "@polkadot/keyring": "npm:^12.3.2" "@polkadot/types": "npm:^10.9.1" @@ -542,7 +542,7 @@ __metadata: websocket-as-promised: "npm:^2.0.1" peerDependencies: "@polkadot/x-randomvalues": ^12.3.2 - checksum: 10c0/e720c1fbdb4f6467e48b0bbbda1649c26fe68639e8e19ab3007f87ee75ea009d0becf75f5644cb3b3ac1e8ae1dc8957174994957239cf387ec59ae2ec9a25905 + checksum: 10c0/1144351c081006d2d27b4f84c61fe0fc9591e660e21eeb0ffb3234a6bd708a5b62924e2e7c5ad08740b0e89541f526f6e7693aee68bcc664b0d7098ffb7c9aca languageName: node linkType: hard @@ -912,7 +912,7 @@ __metadata: languageName: node linkType: hard -"@learntheropes/node-rsa@npm:^1.1.3": +"@learntheropes/node-rsa@npm:~1.1.3": version: 1.1.3 resolution: "@learntheropes/node-rsa@npm:1.1.3" dependencies: @@ -8588,7 +8588,7 @@ __metadata: version: 0.0.0-use.local resolution: "nuxt-app@workspace:." dependencies: - "@encointer/worker-api": "npm:^0.12.4" + "@encointer/worker-api": "npm:^0.12.5-alpha.1" "@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3" "@material-tailwind/html": "npm:^2.2.2" "@nuxt/content": "npm:^2.12.1" From 4488241c7401213bef39dc4efb199155d75bb295 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Tue, 30 Apr 2024 22:12:37 +0200 Subject: [PATCH 3/8] bump encointer-js fix assert transform error --- nuxt.config.ts | 2 +- package.json | 2 +- yarn.lock | 42 +++++++++++++++++++++--------------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index d37fd2c..dfe3ad3 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -81,7 +81,7 @@ export default defineNuxtConfig({ resolve: { alias: { crypto: './node_modules/unenv/runtime/node/crypto/node.cjs', - // assert: './node_modules/unenv/runtime/mock/proxy.cjs', + assert: './node_modules/unenv/runtime/mock/proxy.cjs', http: './node_modules/unenv/runtime/node/http/index.cjs', buffer: './node_modules/unenv/runtime/node/buffer/index.cjs', os: './node_modules/unenv/runtime/mock/proxy.cjs', diff --git a/package.json b/package.json index a031fc8..d009921 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "vue-router": "^4.3.2" }, "dependencies": { - "@encointer/worker-api": "^0.12.5-alpha.1", + "@encointer/worker-api": "^0.12.5-alpha.4", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@material-tailwind/html": "^2.2.2", "@nuxt/content": "^2.12.1", diff --git a/yarn.lock b/yarn.lock index 3df0edf..dcec4b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -485,32 +485,32 @@ __metadata: languageName: node linkType: hard -"@encointer/node-api@npm:^0.12.5-alpha.1": - version: 0.12.5-alpha.1 - resolution: "@encointer/node-api@npm:0.12.5-alpha.1" +"@encointer/node-api@npm:^0.12.5-alpha.4": + version: 0.12.5-alpha.4 + resolution: "@encointer/node-api@npm:0.12.5-alpha.4" dependencies: - "@encointer/types": "npm:^0.12.5-alpha.1" + "@encointer/types": "npm:^0.12.5-alpha.4" "@polkadot/api": "npm:^10.9.1" tslib: "npm:^2.5.3" - checksum: 10c0/e629010b6bc707eb8263119940786f962adcff74afc418e76406f1dbbe0244c35a3701e4787ffd07fae86e14d856374d5d1752a3323982acd06da4a951142371 + checksum: 10c0/f623da640795621ddd568655bfd1712d085a0d0f94cbc5a03022f157a3e9489406012a9a760b9cc73ef3c9da875d955df5593b47edccb89dd0ea8401389a13f1 languageName: node linkType: hard -"@encointer/types@npm:^0.12.5-alpha.1": - version: 0.12.5-alpha.1 - resolution: "@encointer/types@npm:0.12.5-alpha.1" +"@encointer/types@npm:^0.12.5-alpha.4": + version: 0.12.5-alpha.4 + resolution: "@encointer/types@npm:0.12.5-alpha.4" dependencies: "@polkadot/api": "npm:^10.9.1" "@polkadot/types": "npm:^10.9.1" "@polkadot/types-codec": "npm:^10.9.1" "@polkadot/util": "npm:^12.3.2" - checksum: 10c0/cb1a0bff1051a9c6bedd2de16d86f7e04ab94fff65895b1a6ebc6ff403f6dd7bc19f49bfa0c8100baae1f0bc0af1528c0578efe80e306477434619e37aa386b0 + checksum: 10c0/5ab3cceecb6efefdcb922c325b160de4592601bdfa93d887975df4b230f895f391e0545bb36a1a8ead9ec4814f79606f51a0755bbf51ce6273fe18bf1470436f languageName: node linkType: hard -"@encointer/util@npm:^0.12.5-alpha.1": - version: 0.12.5-alpha.1 - resolution: "@encointer/util@npm:0.12.5-alpha.1" +"@encointer/util@npm:^0.12.5-alpha.4": + version: 0.12.5-alpha.4 + resolution: "@encointer/util@npm:0.12.5-alpha.4" dependencies: "@babel/runtime": "npm:^7.18.9" "@polkadot/util": "npm:^12.3.2" @@ -518,17 +518,17 @@ __metadata: "@types/bn.js": "npm:^5.1.1" assert: "npm:^2.0.0" bn.js: "npm:^5.2.1" - checksum: 10c0/f035e548b67265d95f15c6237686654a4191a3db08a7a77694f91ab17e588d8b2afe210269000fd9186673d9373d76e452c845257823cd2432bc38d80301c4af + checksum: 10c0/a2038788f0ad86b5e46198e132a05e8f7faa88aaf0a3ae4c58a5dd9f1e6fd40dbcb625df069732d47b86fc819405fbd5efd66d46101c34767fc4ee0a57585c43 languageName: node linkType: hard -"@encointer/worker-api@npm:^0.12.5-alpha.1": - version: 0.12.5-alpha.1 - resolution: "@encointer/worker-api@npm:0.12.5-alpha.1" +"@encointer/worker-api@npm:^0.12.5-alpha.4": + version: 0.12.5-alpha.4 + resolution: "@encointer/worker-api@npm:0.12.5-alpha.4" dependencies: - "@encointer/node-api": "npm:^0.12.5-alpha.1" - "@encointer/types": "npm:^0.12.5-alpha.1" - "@encointer/util": "npm:^0.12.5-alpha.1" + "@encointer/node-api": "npm:^0.12.5-alpha.4" + "@encointer/types": "npm:^0.12.5-alpha.4" + "@encointer/util": "npm:^0.12.5-alpha.4" "@learntheropes/node-rsa": "npm:~1.1.3" "@polkadot/api": "npm:^10.9.1" "@polkadot/keyring": "npm:^12.3.2" @@ -542,7 +542,7 @@ __metadata: websocket-as-promised: "npm:^2.0.1" peerDependencies: "@polkadot/x-randomvalues": ^12.3.2 - checksum: 10c0/1144351c081006d2d27b4f84c61fe0fc9591e660e21eeb0ffb3234a6bd708a5b62924e2e7c5ad08740b0e89541f526f6e7693aee68bcc664b0d7098ffb7c9aca + checksum: 10c0/0ed5484e841ab9e879072eafcc4e0571a999bea28268bd7da05cddfd729829afb02800af236769d72085de1af43a5bc5a107f5c944e951b4fe71fe52ce3c7b62 languageName: node linkType: hard @@ -8588,7 +8588,7 @@ __metadata: version: 0.0.0-use.local resolution: "nuxt-app@workspace:." dependencies: - "@encointer/worker-api": "npm:^0.12.5-alpha.1" + "@encointer/worker-api": "npm:^0.12.5-alpha.4" "@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3" "@material-tailwind/html": "npm:^2.2.2" "@nuxt/content": "npm:^2.12.1" From 3c1400fca73908ef74c8b1a78d96b18bfb4d8a12 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Tue, 30 Apr 2024 22:34:47 +0200 Subject: [PATCH 4/8] set ssr: false in nuxt.config --- nuxt.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index dfe3ad3..e48c173 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -71,13 +71,13 @@ export default defineNuxtConfig({ defaultImport: 'component', global: false, }, - ssr: true, + ssr: false, vite: { define: { process: {}, global: 'globalThis', }, - // This is not ideal and should work via `unenv` directly.. + // This is not ideal and should work via `unenv` directly. resolve: { alias: { crypto: './node_modules/unenv/runtime/node/crypto/node.cjs', From e1aed1bb0170cb098126c38af240a926de0a499c Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 1 May 2024 14:54:02 +0200 Subject: [PATCH 5/8] remove polyfills try with encointer-js' webcrypto approach --- nuxt.config.ts | 26 +--------- package.json | 3 +- yarn.lock | 133 ++++++++++++++++++++++++++++++++++--------------- 3 files changed, 95 insertions(+), 67 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index e48c173..cc928e3 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -59,7 +59,7 @@ export default defineNuxtConfig({ externalVue: false, }, routeRules: { - '/': { ssr: true }, + '/': { ssr: false }, }, imports: { autoImport: false, @@ -73,30 +73,6 @@ export default defineNuxtConfig({ }, ssr: false, vite: { - define: { - process: {}, - global: 'globalThis', - }, - // This is not ideal and should work via `unenv` directly. - resolve: { - alias: { - crypto: './node_modules/unenv/runtime/node/crypto/node.cjs', - assert: './node_modules/unenv/runtime/mock/proxy.cjs', - http: './node_modules/unenv/runtime/node/http/index.cjs', - buffer: './node_modules/unenv/runtime/node/buffer/index.cjs', - os: './node_modules/unenv/runtime/mock/proxy.cjs', - url: './node_modules/unenv/runtime/node/url/index.cjs', - zlib: './node_modules/unenv/runtime/mock/proxy.cjs', - 'process/': './node_modules/unenv/runtime/mock/proxy.cjs', - process: './node_modules/unenv/runtime/mock/proxy.cjs', - stream: './node_modules/unenv/runtime/mock/proxy.cjs', - _stream_duplex: './node_modules/unenv/runtime/mock/proxy.cjs', - _stream_passthrough: './node_modules/unenv/runtime/mock/proxy.cjs', - _stream_readable: './node_modules/unenv/runtime/mock/proxy.cjs', - _stream_writable: './node_modules/unenv/runtime/mock/proxy.cjs', - _stream_transform: './node_modules/unenv/runtime/mock/proxy.cjs', - }, - }, css: { preprocessorOptions: { scss: { diff --git a/package.json b/package.json index d009921..dbb9352 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "vue-router": "^4.3.2" }, "dependencies": { - "@encointer/worker-api": "^0.12.5-alpha.4", + "@encointer/worker-api": "^0.12.5-alpha.8", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@material-tailwind/html": "^2.2.2", "@nuxt/content": "^2.12.1", @@ -49,7 +49,6 @@ "nuxt-svgo": "^4.0.0", "pinia": "^2.1.7", "sass": "^1.75.0", - "unenv": "^1.9.0", "vue3-form-wizard": "^0.2.3" } } diff --git a/yarn.lock b/yarn.lock index dcec4b9..ff512c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -485,32 +485,32 @@ __metadata: languageName: node linkType: hard -"@encointer/node-api@npm:^0.12.5-alpha.4": - version: 0.12.5-alpha.4 - resolution: "@encointer/node-api@npm:0.12.5-alpha.4" +"@encointer/node-api@npm:^0.12.5-alpha.8": + version: 0.12.5-alpha.8 + resolution: "@encointer/node-api@npm:0.12.5-alpha.8" dependencies: - "@encointer/types": "npm:^0.12.5-alpha.4" + "@encointer/types": "npm:^0.12.5-alpha.8" "@polkadot/api": "npm:^10.9.1" tslib: "npm:^2.5.3" - checksum: 10c0/f623da640795621ddd568655bfd1712d085a0d0f94cbc5a03022f157a3e9489406012a9a760b9cc73ef3c9da875d955df5593b47edccb89dd0ea8401389a13f1 + checksum: 10c0/463baf09401913755d6917e698aea6bb128671ed3d699bf8ba351e8510fd31b1e2e52daed33969e4dfac65f2bfc68b9ec972085cdad03cae19b10edefdaa320c languageName: node linkType: hard -"@encointer/types@npm:^0.12.5-alpha.4": - version: 0.12.5-alpha.4 - resolution: "@encointer/types@npm:0.12.5-alpha.4" +"@encointer/types@npm:^0.12.5-alpha.8": + version: 0.12.5-alpha.8 + resolution: "@encointer/types@npm:0.12.5-alpha.8" dependencies: "@polkadot/api": "npm:^10.9.1" "@polkadot/types": "npm:^10.9.1" "@polkadot/types-codec": "npm:^10.9.1" "@polkadot/util": "npm:^12.3.2" - checksum: 10c0/5ab3cceecb6efefdcb922c325b160de4592601bdfa93d887975df4b230f895f391e0545bb36a1a8ead9ec4814f79606f51a0755bbf51ce6273fe18bf1470436f + checksum: 10c0/079a6ed4da6c670a63e8497d491c11d97fddd820c6fab91bcf82a9aa570df460a4361be4b2f2a2c9b194895fbe09e3e84a0b16810fc2871113f5aaf8e970f757 languageName: node linkType: hard -"@encointer/util@npm:^0.12.5-alpha.4": - version: 0.12.5-alpha.4 - resolution: "@encointer/util@npm:0.12.5-alpha.4" +"@encointer/util@npm:^0.12.5-alpha.8": + version: 0.12.5-alpha.8 + resolution: "@encointer/util@npm:0.12.5-alpha.8" dependencies: "@babel/runtime": "npm:^7.18.9" "@polkadot/util": "npm:^12.3.2" @@ -518,18 +518,18 @@ __metadata: "@types/bn.js": "npm:^5.1.1" assert: "npm:^2.0.0" bn.js: "npm:^5.2.1" - checksum: 10c0/a2038788f0ad86b5e46198e132a05e8f7faa88aaf0a3ae4c58a5dd9f1e6fd40dbcb625df069732d47b86fc819405fbd5efd66d46101c34767fc4ee0a57585c43 + checksum: 10c0/84cdf5a2c7453faa0ac8fbb7737e8681d7f6970d4245983d846328e465a28e664b8e53a0d40d78a262820874b7a816355585c1714f224e6f793c07a0c7a55549 languageName: node linkType: hard -"@encointer/worker-api@npm:^0.12.5-alpha.4": - version: 0.12.5-alpha.4 - resolution: "@encointer/worker-api@npm:0.12.5-alpha.4" +"@encointer/worker-api@npm:^0.12.5-alpha.8": + version: 0.12.5-alpha.8 + resolution: "@encointer/worker-api@npm:0.12.5-alpha.8" dependencies: - "@encointer/node-api": "npm:^0.12.5-alpha.4" - "@encointer/types": "npm:^0.12.5-alpha.4" - "@encointer/util": "npm:^0.12.5-alpha.4" - "@learntheropes/node-rsa": "npm:~1.1.3" + "@encointer/node-api": "npm:^0.12.5-alpha.8" + "@encointer/types": "npm:^0.12.5-alpha.8" + "@encointer/util": "npm:^0.12.5-alpha.8" + "@peculiar/webcrypto": "npm:^1.4.6" "@polkadot/api": "npm:^10.9.1" "@polkadot/keyring": "npm:^12.3.2" "@polkadot/types": "npm:^10.9.1" @@ -542,7 +542,7 @@ __metadata: websocket-as-promised: "npm:^2.0.1" peerDependencies: "@polkadot/x-randomvalues": ^12.3.2 - checksum: 10c0/0ed5484e841ab9e879072eafcc4e0571a999bea28268bd7da05cddfd729829afb02800af236769d72085de1af43a5bc5a107f5c944e951b4fe71fe52ce3c7b62 + checksum: 10c0/d37e831e91fd09d30a21d6b0914d4a20987a056365b795970b5053449c10524c32e56e49d03475d3d2879102c7635b6b3115f0472ea0a860c3226e4793d488ff languageName: node linkType: hard @@ -912,16 +912,6 @@ __metadata: languageName: node linkType: hard -"@learntheropes/node-rsa@npm:~1.1.3": - version: 1.1.3 - resolution: "@learntheropes/node-rsa@npm:1.1.3" - dependencies: - asn1: "npm:^0.2.4" - buffer: "npm:^6.0.3" - checksum: 10c0/d96d934ae9e76e9d46d609a10dfddc5a28cadf3a757ac4284b91f6cc6939420660aff70ee3eaffc3bf90cfbab9110388a6604f32ce96c765ebaa36de42b5ac03 - languageName: node - linkType: hard - "@mapbox/node-pre-gyp@npm:^1.0.5": version: 1.0.11 resolution: "@mapbox/node-pre-gyp@npm:1.0.11" @@ -1648,6 +1638,39 @@ __metadata: languageName: node linkType: hard +"@peculiar/asn1-schema@npm:^2.3.8": + version: 2.3.8 + resolution: "@peculiar/asn1-schema@npm:2.3.8" + dependencies: + asn1js: "npm:^3.0.5" + pvtsutils: "npm:^1.3.5" + tslib: "npm:^2.6.2" + checksum: 10c0/65f16b2a7eb91365b6dac47730ffcad4617ef04b821e0a4286c379ac7283588b0a6744032ee686e0914a0886c2a055108ed945b9c4d22821a3b123640b61f3b2 + languageName: node + linkType: hard + +"@peculiar/json-schema@npm:^1.1.12": + version: 1.1.12 + resolution: "@peculiar/json-schema@npm:1.1.12" + dependencies: + tslib: "npm:^2.0.0" + checksum: 10c0/202132c66dcc6b6aca5d0af971c015be2e163da2f7f992910783c5d39c8a7db59b6ec4f4ce419459a1f954b7e1d17b6b253f0e60072c1b3d254079f4eaebc311 + languageName: node + linkType: hard + +"@peculiar/webcrypto@npm:^1.4.6": + version: 1.4.6 + resolution: "@peculiar/webcrypto@npm:1.4.6" + dependencies: + "@peculiar/asn1-schema": "npm:^2.3.8" + "@peculiar/json-schema": "npm:^1.1.12" + pvtsutils: "npm:^1.3.5" + tslib: "npm:^2.6.2" + webcrypto-core: "npm:^1.7.9" + checksum: 10c0/b9c80b1a0a3e3ebbf045bd5167fe99ec4a83b170e9aa15a5952a9138afc278210d772306dcc57101d9407c3f9c70dbf6bfb4d8b3f20996ad35c650bb0fe6a90c + languageName: node + linkType: hard + "@pinia/nuxt@npm:^0.5.1": version: 0.5.1 resolution: "@pinia/nuxt@npm:0.5.1" @@ -3522,12 +3545,14 @@ __metadata: languageName: node linkType: hard -"asn1@npm:^0.2.4": - version: 0.2.6 - resolution: "asn1@npm:0.2.6" +"asn1js@npm:^3.0.1, asn1js@npm:^3.0.5": + version: 3.0.5 + resolution: "asn1js@npm:3.0.5" dependencies: - safer-buffer: "npm:~2.1.0" - checksum: 10c0/00c8a06c37e548762306bcb1488388d2f76c74c36f70c803f0c081a01d3bdf26090fc088cd812afc5e56a6d49e33765d451a5f8a68ab9c2b087eba65d2e980e0 + pvtsutils: "npm:^1.3.2" + pvutils: "npm:^1.1.3" + tslib: "npm:^2.4.0" + checksum: 10c0/bb8eaf4040c8f49dd475566874986f5976b81bae65a6b5526e2208a13cdca323e69ce297bcd435fdda3eb6933defe888e71974d705b6fcb14f2734a907f8aed4 languageName: node linkType: hard @@ -8588,7 +8613,7 @@ __metadata: version: 0.0.0-use.local resolution: "nuxt-app@workspace:." dependencies: - "@encointer/worker-api": "npm:^0.12.5-alpha.4" + "@encointer/worker-api": "npm:^0.12.5-alpha.8" "@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3" "@material-tailwind/html": "npm:^2.2.2" "@nuxt/content": "npm:^2.12.1" @@ -8622,7 +8647,6 @@ __metadata: postcss: "npm:^8.4.38" sass: "npm:^1.75.0" tailwindcss: "npm:^3.4.3" - unenv: "npm:^1.9.0" vite: "npm:^5.2.10" vue: "npm:^3.4.26" vue-router: "npm:^4.3.2" @@ -9696,6 +9720,22 @@ __metadata: languageName: node linkType: hard +"pvtsutils@npm:^1.3.2, pvtsutils@npm:^1.3.5": + version: 1.3.5 + resolution: "pvtsutils@npm:1.3.5" + dependencies: + tslib: "npm:^2.6.1" + checksum: 10c0/d425aed316907e0b447a459bfb97c55d22270c3cfdba5a07ec90da0737b0e40f4f1771a444636f85bb6a453de90ff8c6b5f4f6ddba7597977166af49974b4534 + languageName: node + linkType: hard + +"pvutils@npm:^1.1.3": + version: 1.1.3 + resolution: "pvutils@npm:1.1.3" + checksum: 10c0/23489e6b3c76b6afb6964a20f891d6bef092939f401c78bba186b2bfcdc7a13904a0af0a78f7933346510f8c1228d5ab02d3c80e968fd84d3c76ff98d8ec9aac + languageName: node + linkType: hard + "queue-microtask@npm:^1.2.2": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -10238,7 +10278,7 @@ __metadata: languageName: node linkType: hard -"safer-buffer@npm:>= 2.1.2 < 3.0.0, safer-buffer@npm:~2.1.0": +"safer-buffer@npm:>= 2.1.2 < 3.0.0": version: 2.1.2 resolution: "safer-buffer@npm:2.1.2" checksum: 10c0/7e3c8b2e88a1841c9671094bbaeebd94448111dd90a81a1f606f3f67708a6ec57763b3b47f06da09fc6054193e0e6709e77325415dc8422b04497a8070fa02d4 @@ -11157,7 +11197,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.1.0, tslib@npm:^2.5.3, tslib@npm:^2.6.2": +"tslib@npm:^2.0.0, tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.5.3, tslib@npm:^2.6.1, tslib@npm:^2.6.2": version: 2.6.2 resolution: "tslib@npm:2.6.2" checksum: 10c0/e03a8a4271152c8b26604ed45535954c0a45296e32445b4b87f8a5abdb2421f40b59b4ca437c4346af0f28179780d604094eb64546bee2019d903d01c6c19bdb @@ -12092,6 +12132,19 @@ __metadata: languageName: node linkType: hard +"webcrypto-core@npm:^1.7.9": + version: 1.7.9 + resolution: "webcrypto-core@npm:1.7.9" + dependencies: + "@peculiar/asn1-schema": "npm:^2.3.8" + "@peculiar/json-schema": "npm:^1.1.12" + asn1js: "npm:^3.0.1" + pvtsutils: "npm:^1.3.5" + tslib: "npm:^2.6.2" + checksum: 10c0/29075c0fd6afdd11473dcf98623b929fae6a0861a54725af109df824e3c55c00580103a2f934baabff52d588e9c6c3892db80346061fd835c55e0a83264c19f5 + languageName: node + linkType: hard + "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" From cae34bf08e406a7e2eaaf0b3d6c5ca82f669d51f Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Thu, 2 May 2024 11:50:30 +0200 Subject: [PATCH 6/8] bump encointer-js; fix crypto issue --- package.json | 2 +- yarn.lock | 42 +++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index dbb9352..e65e0d2 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "vue-router": "^4.3.2" }, "dependencies": { - "@encointer/worker-api": "^0.12.5-alpha.8", + "@encointer/worker-api": "^0.12.5", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@material-tailwind/html": "^2.2.2", "@nuxt/content": "^2.12.1", diff --git a/yarn.lock b/yarn.lock index ff512c3..89204ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -485,32 +485,32 @@ __metadata: languageName: node linkType: hard -"@encointer/node-api@npm:^0.12.5-alpha.8": - version: 0.12.5-alpha.8 - resolution: "@encointer/node-api@npm:0.12.5-alpha.8" +"@encointer/node-api@npm:^0.12.5": + version: 0.12.5 + resolution: "@encointer/node-api@npm:0.12.5" dependencies: - "@encointer/types": "npm:^0.12.5-alpha.8" + "@encointer/types": "npm:^0.12.5" "@polkadot/api": "npm:^10.9.1" tslib: "npm:^2.5.3" - checksum: 10c0/463baf09401913755d6917e698aea6bb128671ed3d699bf8ba351e8510fd31b1e2e52daed33969e4dfac65f2bfc68b9ec972085cdad03cae19b10edefdaa320c + checksum: 10c0/6b37a8d14e41c0ea6fe4a412577ef6b1cd9821456af7ebc8a5ee1696cbde8d6b946fe6cb3c55382ca7b535f277f1576e3e783007fb09e53722fd9db98f7db953 languageName: node linkType: hard -"@encointer/types@npm:^0.12.5-alpha.8": - version: 0.12.5-alpha.8 - resolution: "@encointer/types@npm:0.12.5-alpha.8" +"@encointer/types@npm:^0.12.5": + version: 0.12.5 + resolution: "@encointer/types@npm:0.12.5" dependencies: "@polkadot/api": "npm:^10.9.1" "@polkadot/types": "npm:^10.9.1" "@polkadot/types-codec": "npm:^10.9.1" "@polkadot/util": "npm:^12.3.2" - checksum: 10c0/079a6ed4da6c670a63e8497d491c11d97fddd820c6fab91bcf82a9aa570df460a4361be4b2f2a2c9b194895fbe09e3e84a0b16810fc2871113f5aaf8e970f757 + checksum: 10c0/f6459bf8894e3b8ff410a5e9548fec96da9ea5203858f911e0b49dd67b2bdab0d71d571a1f6d868dea7f4c70e2a115a008717746e789bf9e7fd3f23e89a82751 languageName: node linkType: hard -"@encointer/util@npm:^0.12.5-alpha.8": - version: 0.12.5-alpha.8 - resolution: "@encointer/util@npm:0.12.5-alpha.8" +"@encointer/util@npm:^0.12.5": + version: 0.12.5 + resolution: "@encointer/util@npm:0.12.5" dependencies: "@babel/runtime": "npm:^7.18.9" "@polkadot/util": "npm:^12.3.2" @@ -518,17 +518,17 @@ __metadata: "@types/bn.js": "npm:^5.1.1" assert: "npm:^2.0.0" bn.js: "npm:^5.2.1" - checksum: 10c0/84cdf5a2c7453faa0ac8fbb7737e8681d7f6970d4245983d846328e465a28e664b8e53a0d40d78a262820874b7a816355585c1714f224e6f793c07a0c7a55549 + checksum: 10c0/c7a7d5ae3c246e67963361c85b3658211271185096e0051f9af02165cede144d0310c86197e6dd1cfee1068f4786323b9e7b5724a8929981dab7f1f26c9789d0 languageName: node linkType: hard -"@encointer/worker-api@npm:^0.12.5-alpha.8": - version: 0.12.5-alpha.8 - resolution: "@encointer/worker-api@npm:0.12.5-alpha.8" +"@encointer/worker-api@npm:^0.12.5": + version: 0.12.5 + resolution: "@encointer/worker-api@npm:0.12.5" dependencies: - "@encointer/node-api": "npm:^0.12.5-alpha.8" - "@encointer/types": "npm:^0.12.5-alpha.8" - "@encointer/util": "npm:^0.12.5-alpha.8" + "@encointer/node-api": "npm:^0.12.5" + "@encointer/types": "npm:^0.12.5" + "@encointer/util": "npm:^0.12.5" "@peculiar/webcrypto": "npm:^1.4.6" "@polkadot/api": "npm:^10.9.1" "@polkadot/keyring": "npm:^12.3.2" @@ -542,7 +542,7 @@ __metadata: websocket-as-promised: "npm:^2.0.1" peerDependencies: "@polkadot/x-randomvalues": ^12.3.2 - checksum: 10c0/d37e831e91fd09d30a21d6b0914d4a20987a056365b795970b5053449c10524c32e56e49d03475d3d2879102c7635b6b3115f0472ea0a860c3226e4793d488ff + checksum: 10c0/55a2c92f1cc989094a5ae5406505c89233cb94c7e3e126a54d60678fb3c6de5300b81bffca1e30a4f026f9e21037816eb847d2cea1aaed5b9a70532da5366746 languageName: node linkType: hard @@ -8613,7 +8613,7 @@ __metadata: version: 0.0.0-use.local resolution: "nuxt-app@workspace:." dependencies: - "@encointer/worker-api": "npm:^0.12.5-alpha.8" + "@encointer/worker-api": "npm:^0.12.5" "@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3" "@material-tailwind/html": "npm:^2.2.2" "@nuxt/content": "npm:^2.12.1" From 6289ad02e39838d810d5a409041ab356a4f03032 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Thu, 2 May 2024 11:51:41 +0200 Subject: [PATCH 7/8] [Readme] add note about webcrypto api --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b29d729..edfa622 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more. +## Note +The `@encointer/worker-api` uses the browser's built-in `webcrypto` api. This library is only available in secure +secure contexts. Hence, in local development you must use `localhost`. `webcrypto` is undefined on `127.0.0.1` and +`0.0.0.0`. + ## Setup Make sure to install the dependencies: From 9dc8d3181e611ca92573a4e3dad65786c4f21c4a Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Thu, 2 May 2024 11:56:46 +0200 Subject: [PATCH 8/8] remove unnecessary changes in nuxt config --- nuxt.config.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index cc928e3..975d44f 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,7 +1,5 @@ import { defineNuxtConfig } from 'nuxt/config' -import 'node:crypto'; - export default defineNuxtConfig({ app: { head: { @@ -71,7 +69,6 @@ export default defineNuxtConfig({ defaultImport: 'component', global: false, }, - ssr: false, vite: { css: { preprocessorOptions: {