Compare commits

..

No commits in common. "v0.1.0-develop.6" and "v0.1.0-develop.5" have entirely different histories.

4 changed files with 55 additions and 54 deletions

View File

@ -1,5 +1,3 @@
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-09-02)
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-09-01)

67
npm-shrinkwrap.json generated
View File

@ -1,16 +1,17 @@
{
"name": "@lumeweb/kernel",
"version": "0.1.0-develop.6",
"version": "0.1.0-develop.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/kernel",
"version": "0.1.0-develop.6",
"version": "0.1.0-develop.5",
"dependencies": {
"@lumeweb/libkernel": "0.1.0-develop.38"
"@lumeweb/libkernel": "0.1.0-develop.35"
},
"devDependencies": {
"@lumeweb/libs5": "^0.1.0-develop.25",
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.43",
"binconv": "^0.2.0",
"presetter": "*",
@ -1690,11 +1691,11 @@
}
},
"node_modules/@lumeweb/libkernel": {
"version": "0.1.0-develop.38",
"resolved": "https://registry.npmjs.org/@lumeweb/libkernel/-/libkernel-0.1.0-develop.38.tgz",
"integrity": "sha512-kzaUoIY1tIqX8x0PQU/q7Jj+O7SCvZxCZsc5BtCKbYyUym8ws19DLW1WcI3penhRJBUnjGZ4nxnSybBNP1bjfg==",
"version": "0.1.0-develop.35",
"resolved": "https://registry.npmjs.org/@lumeweb/libkernel/-/libkernel-0.1.0-develop.35.tgz",
"integrity": "sha512-/K2Yrcjus8NnJ9z+EdwqLHM3EPegESPcgFL2TW1qCpNzN57LeGBv7z4uuoFpZRbnrxuQDq45YmEySvk8lBOoTQ==",
"dependencies": {
"@lumeweb/libweb": "0.2.0-develop.38",
"@lumeweb/libweb": "0.2.0-develop.30",
"emittery": "^1.0.1",
"p-defer": "^4.0.0"
}
@ -1711,11 +1712,10 @@
}
},
"node_modules/@lumeweb/libportal": {
"version": "0.2.0-develop.20",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.20.tgz",
"integrity": "sha512-9bjyih7fyXpkcOYSue/jcLufcXQckkp30Ptigg2qFIDJOnxiv3ymRr2aq7rvXspnmTxnaQgwND0nQ0W0YOCnGA==",
"version": "0.2.0-develop.17",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.17.tgz",
"integrity": "sha512-V8ac4NvRNCeE87rXNi9GX4J+ueztIWofBWMs24bmxWxrA46XOXC1Gm475IlAp4mSkyyUmy3vnnwQ4nYOi1U8Ew==",
"dependencies": {
"@lumeweb/libs5": "^0.1.0-develop.43",
"@lumeweb/node-library-preset": "git+https://git.lumeweb.com/LumeWeb/node-library-preset.git",
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
@ -1729,9 +1729,10 @@
}
},
"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==",
"version": "0.1.0-develop.25",
"resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.25.tgz",
"integrity": "sha512-kqvMrAU3fZLFwAqVwv0btu7dx0wBN/XkCGV9LivCoUz2DIT0T63W1Xv4LinpqDIZmbiXNmYt0CVQAhfe53b2UA==",
"dev": true,
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
@ -1746,18 +1747,19 @@
"version": "12.1.0",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.0.tgz",
"integrity": "sha512-/qTOKKnU8nwcVURjRcS+UN0QYgdS5BPZzY10Aiciu2SqncyCVMGV8KtD83EBFmsuJDsSEmT4sGvzcTkCoMw0sQ==",
"dev": true,
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@lumeweb/libweb": {
"version": "0.2.0-develop.38",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.38.tgz",
"integrity": "sha512-Tuhf7TIe40oYKBQHKGf05hl+GMvBtYfpsZu6CdQL60reNquTZhG34j7TpEFsjuZG4qdj0jb3ryJ7UgSLq57qFw==",
"version": "0.2.0-develop.30",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.30.tgz",
"integrity": "sha512-6T/yhjk/2KYiJ4gjVQwHDFcjOlzz/EosZPbpkpAdUDW+yuFW0XiGKh7nQWyjVuk8C2zDawNh3jTRTz/FRiSFhg==",
"dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.6",
"@lumeweb/libportal": "0.2.0-develop.20",
"@lumeweb/libportal": "0.2.0-develop.17",
"@lumeweb/node-library-preset": "0.2.7",
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
@ -1791,20 +1793,20 @@
}
},
"node_modules/@noble/curves": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
"integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz",
"integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==",
"dependencies": {
"@noble/hashes": "1.3.2"
"@noble/hashes": "1.3.1"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@noble/hashes": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
"integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz",
"integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==",
"engines": {
"node": ">= 16"
},
@ -3497,6 +3499,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz",
"integrity": "sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA==",
"dev": true,
"dependencies": {
"buffer": "^6.0.3",
"catering": "^2.1.0",
@ -4047,6 +4050,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/browser-level/-/browser-level-1.0.1.tgz",
"integrity": "sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ==",
"dev": true,
"dependencies": {
"abstract-level": "^1.0.2",
"catering": "^2.1.1",
@ -4502,6 +4506,7 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz",
"integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==",
"dev": true,
"engines": {
"node": ">=6"
}
@ -4612,6 +4617,7 @@
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/classic-level/-/classic-level-1.3.0.tgz",
"integrity": "sha512-iwFAJQYtqRTRM0F6L8h4JCt00ZSGdOyqh7yVrhhjrOpFhmBjNlRUey64MCiyo6UmQHMJ+No3c81nujPv+n9yrg==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
"abstract-level": "^1.0.2",
@ -8361,6 +8367,7 @@
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
"dev": true,
"funding": [
{
"type": "github",
@ -9696,6 +9703,7 @@
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz",
"integrity": "sha512-ypf0jjAk2BWI33yzEaaotpq7fkOPALKAgDBxggO6Q9HGX2MRXn0wbP1Jn/tJv1gtL867+YOjOB49WaUF3UoJNQ==",
"dev": true,
"dependencies": {
"browser-level": "^1.0.1",
"classic-level": "^1.2.0"
@ -9712,6 +9720,7 @@
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz",
"integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==",
"dev": true,
"engines": {
"node": ">=12"
}
@ -9720,6 +9729,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz",
"integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==",
"dev": true,
"dependencies": {
"buffer": "^6.0.3",
"module-error": "^1.0.1"
@ -10976,6 +10986,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz",
"integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==",
"dev": true,
"engines": {
"node": ">=10"
}
@ -11033,7 +11044,8 @@
"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=="
"integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==",
"dev": true
},
"node_modules/natural-compare": {
"version": "1.4.0",
@ -11136,6 +11148,7 @@
"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==",
"dev": true,
"bin": {
"node-gyp-build": "bin.js",
"node-gyp-build-optional": "optional.js",
@ -16419,6 +16432,7 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz",
"integrity": "sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==",
"dev": true,
"funding": [
{
"type": "github",
@ -19604,6 +19618,7 @@
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"dev": true,
"engines": {
"node": ">=10.0.0"
},

View File

@ -1,12 +1,13 @@
{
"name": "@lumeweb/kernel",
"version": "0.1.0-develop.6",
"version": "0.1.0-develop.5",
"type": "module",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/kernel.git"
},
"devDependencies": {
"@lumeweb/libs5": "^0.1.0-develop.25",
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.43",
"binconv": "^0.2.0",
"presetter": "*",
@ -19,6 +20,6 @@
"semantic-release": "semantic-release"
},
"dependencies": {
"@lumeweb/libkernel": "0.1.0-develop.38"
"@lumeweb/libkernel": "0.1.0-develop.35"
}
}

View File

@ -11,13 +11,11 @@ import {
sha512,
} from "@lumeweb/libkernel";
import {
CID,
decodeCid,
deriveChildKey,
downloadSmallObject,
hexToBytes,
verifyCid,
} from "@lumeweb/libweb";
import { CID_TYPES, CID_HASH_TYPES } from "@lumeweb/libs5";
import type { moduleQuery, presentKeyData } from "@lumeweb/libkernel/module";
import { readableStreamToUint8Array } from "binconv";
import { getSavedRegistryEntry } from "./registry.js";
@ -324,32 +322,21 @@ async function handleModuleCall(
return;
}
let validCid = false;
let isResolver = false;
if (
typeof event.data.data.module === "string" &&
verifyCid(event.data.data.module)
) {
const decodedCid = decodeCid(event.data.data.module);
if (!decodedCid[1]) {
const { type, hashType } = decodedCid[0];
if (type === CID_TYPES.RAW && hashType === CID_HASH_TYPES.BLAKE3) {
validCid = true;
}
if (type === CID_TYPES.RESOLVER && hashType === CID_HASH_TYPES.ED25519) {
validCid = true;
isResolver = true;
}
}
}
let isRegistryEntry = false;
try {
isRegistryEntry = hexToBytes(event.data.data.module)?.length === 32;
} catch {}
if (!validCid) {
if (
typeof event.data.data.module !== "string" ||
(!verifyCid(event.data.data.module) && !isRegistryEntry)
) {
logErr("moduleCall", "received moduleCall with malformed module");
respondErr(
event,
messagePortal,
isWorker,
"'module' field in moduleCall is expected to be a raw CID or a resolver CID",
"'module' field in moduleCall is expected to be a base58 encoded blake3 hash + filesize or a registry entry pubkey",
);
return;
}
@ -407,7 +394,7 @@ async function handleModuleCall(
let moduleDomain = event.data.data.module; // Can change with overrides.
let finalModule = moduleDomain; // Can change with overrides.
if (isResolver) {
if (isRegistryEntry) {
const registryFail = () => {
logErr("moduleCall", "received moduleCall with no known registry entry");
respondErr(