feat: add support for creating a resolver CID for the app if APP_SEED is not false

This commit is contained in:
Derrick Hammer 2023-09-02 07:27:41 -04:00
parent 458a809c1d
commit b03234e38e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 401 additions and 17 deletions

302
npm-shrinkwrap.json generated
View File

@ -8,11 +8,15 @@
"name": "@lumeweb/publish-webapp", "name": "@lumeweb/publish-webapp",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@lumeweb/libweb": "0.2.0-develop.31", "@lumeweb/libweb": "0.2.0-develop.36",
"@scure/bip39": "^1.2.1",
"array-from-async": "^3.0.0", "array-from-async": "^3.0.0",
"chalk": "^5.3.0", "chalk": "^5.3.0",
"ed25519-keygen": "^0.4.8",
"memory-level": "^1.0.0",
"mime": "^3.0.0", "mime": "^3.0.0",
"msgpackr": "^1.9.7", "msgpackr": "^1.9.7",
"p-defer": "^4.0.0",
"p-queue": "^7.3.4", "p-queue": "^7.3.4",
"prompts": "^2.4.2" "prompts": "^2.4.2"
}, },
@ -1798,10 +1802,11 @@
} }
}, },
"node_modules/@lumeweb/libportal": { "node_modules/@lumeweb/libportal": {
"version": "0.2.0-develop.17", "version": "0.2.0-develop.20",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.17.tgz", "resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.20.tgz",
"integrity": "sha512-V8ac4NvRNCeE87rXNi9GX4J+ueztIWofBWMs24bmxWxrA46XOXC1Gm475IlAp4mSkyyUmy3vnnwQ4nYOi1U8Ew==", "integrity": "sha512-9bjyih7fyXpkcOYSue/jcLufcXQckkp30Ptigg2qFIDJOnxiv3ymRr2aq7rvXspnmTxnaQgwND0nQ0W0YOCnGA==",
"dependencies": { "dependencies": {
"@lumeweb/libs5": "^0.1.0-develop.43",
"@lumeweb/node-library-preset": "git+https://git.lumeweb.com/LumeWeb/node-library-preset.git", "@lumeweb/node-library-preset": "git+https://git.lumeweb.com/LumeWeb/node-library-preset.git",
"@noble/curves": "^1.1.0", "@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1", "@noble/hashes": "^1.3.1",
@ -1814,13 +1819,36 @@
"web-streams-polyfill": "^3.2.1" "web-streams-polyfill": "^3.2.1"
} }
}, },
"node_modules/@lumeweb/libs5": {
"version": "0.1.0-develop.43",
"resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.43.tgz",
"integrity": "sha512-kUGuT4kK9YVggqyMUj+pPY7okAFKxzACZTlA4BBBsgxAGIdr+iZLQwMfDlwzE4bdxndS52g1XM39Xv3K2xA/lQ==",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
"detect-node": "^2.1.0",
"level": "^8.0.0",
"multiformats": "^12.0.1",
"p-defer": "^4.0.0",
"ws": "^8.13.0"
}
},
"node_modules/@lumeweb/libs5/node_modules/multiformats": {
"version": "12.1.0",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.0.tgz",
"integrity": "sha512-/qTOKKnU8nwcVURjRcS+UN0QYgdS5BPZzY10Aiciu2SqncyCVMGV8KtD83EBFmsuJDsSEmT4sGvzcTkCoMw0sQ==",
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@lumeweb/libweb": { "node_modules/@lumeweb/libweb": {
"version": "0.2.0-develop.31", "version": "0.2.0-develop.36",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.31.tgz", "resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.36.tgz",
"integrity": "sha512-8xBsxRK5AIRVnHWqBshe1mpKisUTf70bAG39KT8Q6E8hRVdq6veAVB09hdblQLGFlQxyPNPtloyrcf0ydnMQ2g==", "integrity": "sha512-17jj7UnKDwYMBmpquVOJmLVuKlRGOUfJDD+iWYOqle8gEekA5EwBIskB3NqFL99iw8dDax/MyqQUr5kSi4GyIQ==",
"dependencies": { "dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.6", "@lumeweb/community-portals": "^0.1.0-develop.6",
"@lumeweb/libportal": "0.2.0-develop.17", "@lumeweb/libportal": "0.2.0-develop.20",
"@lumeweb/node-library-preset": "0.2.7", "@lumeweb/node-library-preset": "0.2.7",
"@noble/curves": "^1.1.0", "@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1", "@noble/hashes": "^1.3.1",
@ -1912,20 +1940,20 @@
] ]
}, },
"node_modules/@noble/curves": { "node_modules/@noble/curves": {
"version": "1.1.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
"integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
"dependencies": { "dependencies": {
"@noble/hashes": "1.3.1" "@noble/hashes": "1.3.2"
}, },
"funding": { "funding": {
"url": "https://paulmillr.com/funding/" "url": "https://paulmillr.com/funding/"
} }
}, },
"node_modules/@noble/hashes": { "node_modules/@noble/hashes": {
"version": "1.3.1", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
"integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
"engines": { "engines": {
"node": ">= 16" "node": ">= 16"
}, },
@ -2536,6 +2564,26 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/@scure/base": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz",
"integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==",
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@scure/bip39": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz",
"integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==",
"dependencies": {
"@noble/hashes": "~1.3.0",
"@scure/base": "~1.1.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@semantic-release/changelog": { "node_modules/@semantic-release/changelog": {
"version": "6.0.3", "version": "6.0.3",
"resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-6.0.3.tgz", "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-6.0.3.tgz",
@ -3620,6 +3668,23 @@
"node": ">=6.5" "node": ">=6.5"
} }
}, },
"node_modules/abstract-level": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz",
"integrity": "sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA==",
"dependencies": {
"buffer": "^6.0.3",
"catering": "^2.1.0",
"is-buffer": "^2.0.5",
"level-supports": "^4.0.0",
"level-transcoder": "^1.0.1",
"module-error": "^1.0.1",
"queue-microtask": "^1.2.3"
},
"engines": {
"node": ">=12"
}
},
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.10.0", "version": "8.10.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
@ -4142,6 +4207,17 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/browser-level": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/browser-level/-/browser-level-1.0.1.tgz",
"integrity": "sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ==",
"dependencies": {
"abstract-level": "^1.0.2",
"catering": "^2.1.1",
"module-error": "^1.0.2",
"run-parallel-limit": "^1.1.0"
}
},
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.21.10", "version": "4.21.10",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz",
@ -4479,6 +4555,14 @@
"cdl": "bin/cdl.js" "cdl": "bin/cdl.js"
} }
}, },
"node_modules/catering": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz",
"integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==",
"engines": {
"node": ">=6"
}
},
"node_modules/chalk": { "node_modules/chalk": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
@ -4566,6 +4650,22 @@
"integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==",
"peer": true "peer": true
}, },
"node_modules/classic-level": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/classic-level/-/classic-level-1.3.0.tgz",
"integrity": "sha512-iwFAJQYtqRTRM0F6L8h4JCt00ZSGdOyqh7yVrhhjrOpFhmBjNlRUey64MCiyo6UmQHMJ+No3c81nujPv+n9yrg==",
"hasInstallScript": true,
"dependencies": {
"abstract-level": "^1.0.2",
"catering": "^2.1.0",
"module-error": "^1.0.1",
"napi-macros": "^2.2.2",
"node-gyp-build": "^4.3.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/clean-stack": { "node_modules/clean-stack": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
@ -5914,6 +6014,23 @@
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
}, },
"node_modules/ed25519-keygen": {
"version": "0.4.8",
"resolved": "https://registry.npmjs.org/ed25519-keygen/-/ed25519-keygen-0.4.8.tgz",
"integrity": "sha512-rsdNLL15/MmdGZ+I5f7/lVBk1+lZmd/Cw60QEuR5X6gebyBgBImCSLRk2J/REaoRvWwpWuaeOu5Y2Y9deyWNmA==",
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"dependencies": {
"@noble/curves": "~1.2.0",
"@noble/hashes": "~1.3.2",
"@scure/base": "~1.1.2",
"micro-packed": "^0.3.2"
}
},
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.491", "version": "1.4.491",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.491.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.491.tgz",
@ -7095,6 +7212,11 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/functional-red-black-tree": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g=="
},
"node_modules/functions-have-names": { "node_modules/functions-have-names": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz",
@ -8157,6 +8279,28 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/is-buffer": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"engines": {
"node": ">=4"
}
},
"node_modules/is-builtin-module": { "node_modules/is-builtin-module": {
"version": "3.2.1", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz",
@ -9597,6 +9741,42 @@
"url": "https://github.com/chalk/strip-ansi?sponsor=1" "url": "https://github.com/chalk/strip-ansi?sponsor=1"
} }
}, },
"node_modules/level": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz",
"integrity": "sha512-ypf0jjAk2BWI33yzEaaotpq7fkOPALKAgDBxggO6Q9HGX2MRXn0wbP1Jn/tJv1gtL867+YOjOB49WaUF3UoJNQ==",
"dependencies": {
"browser-level": "^1.0.1",
"classic-level": "^1.2.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/level"
}
},
"node_modules/level-supports": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz",
"integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==",
"engines": {
"node": ">=12"
}
},
"node_modules/level-transcoder": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz",
"integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==",
"dependencies": {
"buffer": "^6.0.3",
"module-error": "^1.0.1"
},
"engines": {
"node": ">=12"
}
},
"node_modules/leven": { "node_modules/leven": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
@ -10179,6 +10359,19 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/memory-level": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/memory-level/-/memory-level-1.0.0.tgz",
"integrity": "sha512-UXzwewuWeHBz5krr7EvehKcmLFNoXxGcvuYhC41tRnkrTbJohtS7kVn9akmgirtRygg+f7Yjsfi8Uu5SGSQ4Og==",
"dependencies": {
"abstract-level": "^1.0.0",
"functional-red-black-tree": "^1.0.1",
"module-error": "^1.0.1"
},
"engines": {
"node": ">=12"
}
},
"node_modules/meow": { "node_modules/meow": {
"version": "8.1.2", "version": "8.1.2",
"resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz",
@ -10394,6 +10587,20 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/micro-packed": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/micro-packed/-/micro-packed-0.3.2.tgz",
"integrity": "sha512-D1Bq0/lVOzdxhnX5vylCxZpdw5LylH7Vd81py0DfRsKUP36XYpwvy8ZIsECVo3UfnoROn8pdKqkOzL7Cd82sGA==",
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"dependencies": {
"@scure/base": "~1.1.1"
}
},
"node_modules/micromatch": { "node_modules/micromatch": {
"version": "4.0.5", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
@ -10669,6 +10876,14 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/module-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz",
"integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==",
"engines": {
"node": ">=10"
}
},
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -10730,6 +10945,11 @@
"url": "https://github.com/sponsors/raouldeheer" "url": "https://github.com/sponsors/raouldeheer"
} }
}, },
"node_modules/napi-macros": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz",
"integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g=="
},
"node_modules/natural-compare": { "node_modules/natural-compare": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@ -10827,6 +11047,16 @@
"node": "^12.13 || ^14.13 || >=16" "node": "^12.13 || ^14.13 || >=16"
} }
}, },
"node_modules/node-gyp-build": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz",
"integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==",
"bin": {
"node-gyp-build": "bin.js",
"node-gyp-build-optional": "optional.js",
"node-gyp-build-test": "build-test.js"
}
},
"node_modules/node-gyp-build-optional-packages": { "node_modules/node-gyp-build-optional-packages": {
"version": "5.0.7", "version": "5.0.7",
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz", "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz",
@ -15689,6 +15919,28 @@
"queue-microtask": "^1.2.2" "queue-microtask": "^1.2.2"
} }
}, },
"node_modules/run-parallel-limit": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz",
"integrity": "sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"dependencies": {
"queue-microtask": "^1.2.2"
}
},
"node_modules/safe-array-concat": { "node_modules/safe-array-concat": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz",
@ -18409,6 +18661,26 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/ws": {
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/xtend": { "node_modules/xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

View File

@ -22,11 +22,15 @@
"semantic-release": "semantic-release" "semantic-release": "semantic-release"
}, },
"dependencies": { "dependencies": {
"@lumeweb/libweb": "0.2.0-develop.31", "@lumeweb/libweb": "0.2.0-develop.36",
"@scure/bip39": "^1.2.1",
"array-from-async": "^3.0.0", "array-from-async": "^3.0.0",
"chalk": "^5.3.0", "chalk": "^5.3.0",
"ed25519-keygen": "^0.4.8",
"memory-level": "^1.0.0",
"mime": "^3.0.0", "mime": "^3.0.0",
"msgpackr": "^1.9.7", "msgpackr": "^1.9.7",
"p-defer": "^4.0.0",
"p-queue": "^7.3.4", "p-queue": "^7.3.4",
"prompts": "^2.4.2" "prompts": "^2.4.2"
}, },

View File

@ -1,11 +1,24 @@
import { encodeCid } from "@lumeweb/libportal";
import {
BOOTSTRAP_NODES,
CID_HASH_TYPES,
CID_TYPES,
createKeyPair,
createNode,
REGISTRY_TYPES,
S5NodeConfig,
} from "@lumeweb/libs5";
import KeyPairEd25519 from "@lumeweb/libs5/lib/ed25519.js";
import fs from "fs/promises"; import fs from "fs/promises";
import { MemoryLevel } from "memory-level";
import { base58btc } from "multiformats/bases/base58";
import path from "path"; import path from "path";
import * as process from "process"; import * as process from "process";
import fromAsync from "array-from-async"; import fromAsync from "array-from-async";
import * as util from "util"; import * as util from "util";
import { import {
concatBytes,
hexToBytes, hexToBytes,
loginActivePortals, loginActivePortals,
maybeInitDefaultPortals, maybeInitDefaultPortals,
@ -19,9 +32,15 @@ import mime from "mime";
import { pack } from "msgpackr"; import { pack } from "msgpackr";
import PQueue from "p-queue"; import PQueue from "p-queue";
import prompts from "prompts"; import prompts from "prompts";
import * as bip39 from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
import { HDKey } from "ed25519-keygen/hdkey";
import defer from "p-defer";
import type { WebAppMetadata } from "#types.js"; import type { WebAppMetadata } from "#types.js";
const BIP44_PATH = "m/44'/1627'/0'/0'/0'";
let key = process.env.PORTAL_PRIVATE_KEY; let key = process.env.PORTAL_PRIVATE_KEY;
let dir = process.env.DIR; let dir = process.env.DIR;
const parallelUploads = parseInt(process.env.PARALLEL_UPLOADS ?? "0", 10) || 10; const parallelUploads = parseInt(process.env.PARALLEL_UPLOADS ?? "0", 10) || 10;
@ -44,6 +63,22 @@ if (!dir) {
})) as unknown as string; })) as unknown as string;
} }
let seed = process.env.APP_SEED;
if (!seed && seed === undefined) {
// @ts-ignore
seed = await prompts.prompts.password({
name: "module_seed",
message: "Enter your app seed",
validate: (prev) => prev && bip39.validateMnemonic(prev, wordlist),
});
}
const hdKey = seed
? HDKey.fromMasterSeed(await bip39.mnemonicToSeed(seed as string)).derive(
BIP44_PATH,
)
: false;
dir = path.resolve(dir) + "/"; dir = path.resolve(dir) + "/";
setActivePortalMasterKey(hexToBytes(key as string)); setActivePortalMasterKey(hexToBytes(key as string));
@ -99,6 +134,79 @@ console.log(
util.format("%s: %s", chalk.green("Web App successfully published"), cid), util.format("%s: %s", chalk.green("Web App successfully published"), cid),
); );
if (!hdKey) {
process.exit(0);
}
const db = new MemoryLevel<string, Uint8Array>({
storeEncoding: "view",
valueEncoding: "buffer",
});
await db.open();
let config = {
keyPair: createKeyPair(),
db,
p2p: {
peers: {
initial: [...BOOTSTRAP_NODES],
},
},
logger: {
info: (s: string) => {},
verbose: (s: string) => {},
warn: (s: string) => {},
error: (s: string) => {},
catched: (e: any, context?: string | null) => {},
},
} as S5NodeConfig;
const node = createNode(config);
await node.start();
const peerDefer = defer();
node.services.p2p.once("peerConnected", peerDefer.resolve);
await peerDefer.promise;
{
const cidBytes = base58btc.decode(cid);
const key = hdKey as HDKey;
let revision = 0;
const ret = await node.services.registry.get(
new KeyPairEd25519(key.privateKey).publicKey,
);
if (ret) {
revision = ret.revision + 1;
}
const sre = node.services.registry.signRegistryEntry({
kp: new KeyPairEd25519((hdKey as HDKey).privateKey),
data: concatBytes(
Uint8Array.from([
REGISTRY_TYPES.CID,
CID_TYPES.RESOLVER,
CID_HASH_TYPES.BLAKE3,
]),
cidBytes,
),
revision,
});
await node.services.registry.set(sre);
console.log(
util.format(
"%s: %s",
chalk.green("Resolver entry"),
encodeCid(cidBytes, 0, CID_TYPES.RESOLVER, CID_HASH_TYPES.ED25519),
),
);
await node.stop();
}
async function processFile(filePath: string) { async function processFile(filePath: string) {
const fd = await fs.open(filePath); const fd = await fs.open(filePath);
const size = (await fd.stat()).size; const size = (await fd.stat()).size;