Compare commits

..

12 Commits

Author SHA1 Message Date
semantic-release-bot 2add443e4c chore(release): 0.1.0-develop.15 [skip ci]
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-09-11)

### Bug Fixes

* pass the fullBytes of the hash, and return the CID in string form with fromRegistry ([2d61697](2d616979c3))
* use globalThis ([23c2848](23c2848683))
* use globalThis ([b6142a6](b6142a654d))

### Features

* add service worker support ([1524ff5](1524ff5c57))
2023-09-11 09:49:46 +00:00
Derrick Hammer d8d99120ca
Merge remote-tracking branch 'origin/develop' into develop 2023-09-11 05:48:42 -04:00
Derrick Hammer 1524ff5c57
feat: add service worker support 2023-09-11 05:48:33 -04:00
Derrick Hammer 45e6b6d390
dep: add networkRegistry hash 2023-09-11 05:47:57 -04:00
Derrick Hammer 94b32a988b
dep: update ircPeerDiscovery hash 2023-09-11 05:47:40 -04:00
Derrick Hammer 23c2848683
fix: use globalThis 2023-09-11 05:47:09 -04:00
Derrick Hammer bff17fb1e9
dep: update libkernel 2023-09-11 05:46:47 -04:00
Derrick Hammer d90c30676a
refactor: only check for swarm in networkReady 2023-09-11 05:46:31 -04:00
Derrick Hammer 4e13f44b66
dep: add networkRegistry to CORE_MODULES 2023-09-11 05:45:14 -04:00
Derrick Hammer 706a12c480
dep: update ircPeerDiscovery resolver hash 2023-09-11 05:44:57 -04:00
Derrick Hammer 2d616979c3
fix: pass the fullBytes of the hash, and return the CID in string form with fromRegistry 2023-09-11 05:44:29 -04:00
Derrick Hammer b6142a654d
fix: use globalThis 2023-09-11 05:42:29 -04:00
7 changed files with 52 additions and 33 deletions

View File

@ -1,3 +1,17 @@
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-09-11)
### Bug Fixes
* pass the fullBytes of the hash, and return the CID in string form with fromRegistry ([2d61697](https://git.lumeweb.com/LumeWeb/kernel/commit/2d616979c3249c7c0d9c3da1574ce9ca22352405))
* use globalThis ([23c2848](https://git.lumeweb.com/LumeWeb/kernel/commit/23c2848683ab6ce5c8e2b46c04f0b5f5ae7d3234))
* use globalThis ([b6142a6](https://git.lumeweb.com/LumeWeb/kernel/commit/b6142a654d3040baa18bfae7caa2f4db5aa458c0))
### Features
* add service worker support ([1524ff5](https://git.lumeweb.com/LumeWeb/kernel/commit/1524ff5c57df1b7e1c88df52c6c1c0d4851dfc15))
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-09-08)
# [0.1.0-develop.13](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.12...v0.1.0-develop.13) (2023-09-04)

36
npm-shrinkwrap.json generated
View File

@ -1,14 +1,14 @@
{
"name": "@lumeweb/kernel",
"version": "0.1.0-develop.14",
"version": "0.1.0-develop.15",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/kernel",
"version": "0.1.0-develop.14",
"version": "0.1.0-develop.15",
"dependencies": {
"@lumeweb/libkernel": "0.1.0-develop.50"
"@lumeweb/libkernel": "0.1.0-develop.53"
},
"devDependencies": {
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.43",
@ -1690,11 +1690,11 @@
}
},
"node_modules/@lumeweb/libkernel": {
"version": "0.1.0-develop.50",
"resolved": "https://registry.npmjs.org/@lumeweb/libkernel/-/libkernel-0.1.0-develop.50.tgz",
"integrity": "sha512-KfJSdJ/nNIQmx1GenH92JEF80Fz/KzNvQV07wO7VZ2jQGwJhB1tR+ufX9foLxt+ydmVLKbE6A6XaPwrlU+DGVg==",
"version": "0.1.0-develop.53",
"resolved": "https://registry.npmjs.org/@lumeweb/libkernel/-/libkernel-0.1.0-develop.53.tgz",
"integrity": "sha512-iycFPM4YnpHcyit3qlZE5fREtEJXsgEtICMEUUc6xUdT4RJyPJPfGBZ9iqBdaBSRdC4+Vh/R4i+tVBNqUHbuHg==",
"dependencies": {
"@lumeweb/libweb": "0.2.0-develop.55",
"@lumeweb/libweb": "0.2.0-develop.57",
"emittery": "^1.0.1",
"p-defer": "^4.0.0"
}
@ -1711,11 +1711,11 @@
}
},
"node_modules/@lumeweb/libportal": {
"version": "0.2.0-develop.34",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.34.tgz",
"integrity": "sha512-Lr0HpYzt89n7ZmPJBLXD4HrOX1D6325g2S5q0uZwx33o0gBeylUVMXp3PsN3fpaiMELyz06jFkOCtlYzVlFSDQ==",
"version": "0.2.0-develop.36",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.36.tgz",
"integrity": "sha512-ZG1MOD9E9aiiSSRcbW9w9XtrLMMSgogLkjTcjn9NBYAFnh1HLdc0wdparq4Eps8tAEfGDkxSIvkvU4vd/Q2cvA==",
"dependencies": {
"@lumeweb/libs5": "^0.1.0-develop.55",
"@lumeweb/libs5": "^0.1.0-develop.57",
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
"detect-node": "^2.1.0",
@ -1728,9 +1728,9 @@
}
},
"node_modules/@lumeweb/libs5": {
"version": "0.1.0-develop.55",
"resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.55.tgz",
"integrity": "sha512-bUhnmL6tW9XW7A5nSbBp4IZm0TU2Du3wPWecxiSXofXP3GprOxw6bylu7btgZVoh24qGeFVhmqkHBzR63dSEBQ==",
"version": "0.1.0-develop.57",
"resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.57.tgz",
"integrity": "sha512-u1SHXnTCuAE8trLP2ENsaPBjNYC9mQ53BRHNPrbDEavXg2DAADUW4Xyale5TJtLmEjbs4rIhRvkg0BUxMOhaSg==",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
@ -1751,12 +1751,12 @@
}
},
"node_modules/@lumeweb/libweb": {
"version": "0.2.0-develop.55",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.55.tgz",
"integrity": "sha512-5CqsU2KjkNovRj92N9M/dGNu9Z5Tyu6pr8XwrFZQOLPseDebbFY3d+Wp+PV5Z3TqtuXaQ/+j7buR3K3175d37A==",
"version": "0.2.0-develop.57",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.57.tgz",
"integrity": "sha512-bFB+OpeIcriEeyOCrnK7eOFh+fKNu6E2V3kF8orZWbvdkS/aM7Xp9epATMAkRt5pLdo8NMNfczNMnPs1FTsAWg==",
"dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.6",
"@lumeweb/libportal": "0.2.0-develop.34",
"@lumeweb/libportal": "0.2.0-develop.36",
"@lumeweb/node-library-preset": "0.2.7",
"@noble/ciphers": "^0.3.0",
"@noble/curves": "^1.1.0",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/kernel",
"version": "0.1.0-develop.14",
"version": "0.1.0-develop.15",
"type": "module",
"repository": {
"type": "git",
@ -19,6 +19,6 @@
"semantic-release": "semantic-release"
},
"dependencies": {
"@lumeweb/libkernel": "0.1.0-develop.50"
"@lumeweb/libkernel": "0.1.0-develop.53"
}
}

View File

@ -1,21 +1,18 @@
import { internalModuleCall, modules } from "./queries.js";
import { SignedRegistryEntry, CID } from "@lumeweb/libs5";
import { CID, SignedRegistryEntry } from "@lumeweb/libs5";
const CORE_MODULES = {
swarm: "zdiLmwHCC15afFNLYzzT2DVV7m27SrBde7oXHdSzAe95GpFZXzdpatUN6b",
peerDiscoveryRegistry:
"zdiLW9MtAAMssP5vLBgd1FitouiVXzNUYZszFYG44uVKqCPDqUQox9aq1y",
ircPeerDiscovery:
"zdiLZaKjWwXkMU88GNEWf6d5NREHe1Yk4M7eQm1owSC4ezeqFGGuGpfYXR",
"zdiN5eJ3RfHpZHTYorGxBt1GCsrGJYV9GprwVWkj8snGsjWSrptFm8BtQX",
s5: "zdiT6quMF8gh8BhQdXE7CZYhp8S1BxSgsucSS48WuTGdars1noejvak6Qo",
networkRegistry: "zdiVGkiECt8CT7psN5wsQyNHewyRJLjPhAGwYGTRXPyAPXP21bdupzHyaw",
};
export async function networkReady() {
for (const module of [
CORE_MODULES.peerDiscoveryRegistry,
CORE_MODULES.ircPeerDiscovery,
CORE_MODULES.swarm,
]) {
for (const module of [CORE_MODULES.swarm]) {
if (!moduleLoaded(module)) {
return false;
}
@ -32,7 +29,7 @@ function moduleLoaded(module: string) {
export async function resolveModuleRegistryEntry(module: string) {
const cid = CID.decode(module);
const pubkey = cid.hash;
const pubkey = cid.hash.fullBytes;
const signedEntry = (await internalModuleCall(
CORE_MODULES.s5,
@ -40,5 +37,5 @@ export async function resolveModuleRegistryEntry(module: string) {
{ pubkey },
)) as SignedRegistryEntry;
const entry = CID.fromRegistry(signedEntry.data);
return CID.fromRegistry(signedEntry.data).toString();
}

View File

@ -1,5 +1,5 @@
import { hexToBytes } from "@lumeweb/libweb";
export const activeKey = hexToBytes(
window.localStorage.getItem("key") as string,
globalThis.localStorage.getItem("key") as string,
);

View File

@ -45,6 +45,7 @@ interface OpenQuery {
dest: Worker;
nonce: string;
origin: string;
sw?: boolean;
}
export interface OpenQueryResponse {
@ -52,6 +53,7 @@ export interface OpenQueryResponse {
method: string;
data: any;
err?: any;
sw?: boolean;
}
// Define the stateful variables for managing the modules. We track the set of
@ -464,6 +466,7 @@ async function handleModuleCall(
dest: worker,
nonce: event.data.nonce,
origin: event.origin,
sw: event.data.sw,
} as OpenQuery;
// Send the message to the worker to start the query.
@ -667,6 +670,7 @@ function handleModuleResponse(
nonce: sourceNonce,
method: event.data.method,
data: event.data.data,
sw: event.data.sw,
};
// For responses only, set an error and close out the query by deleting it
// from the query map.
@ -701,6 +705,7 @@ function handleQueryUpdate(event: MessageEvent) {
nonce: event.data.nonce,
method: event.data.method,
data: event.data.data,
sw: event.data.sw,
});
}

View File

@ -7,11 +7,14 @@ const DEFAULT_MODULE_REGISTRY = new Map<string, string>(
zdiLW9MtAAMssP5vLBgd1FitouiVXzNUYZszFYG44uVKqCPDqUQox9aq1y:
"zduTMSXg16HNi4ggDz8uko7ZxX7q9yosGBT8MX2ng43epttTEQ3Xi7pr2B",
// ircPeerDiscovery
zdiLZaKjWwXkMU88GNEWf6d5NREHe1Yk4M7eQm1owSC4ezeqFGGuGpfYXR:
zdiN5eJ3RfHpZHTYorGxBt1GCsrGJYV9GprwVWkj8snGsjWSrptFm8BtQX:
"zduGKansawKCn6Uzr9sPKVbVkdJCgUVL1mizy38t7tHvUxfEGQMC14R3EP",
// s5
zdiT6quMF8gh8BhQdXE7CZYhp8S1BxSgsucSS48WuTGdars1noejvak6Qo:
"zduKLoxH3mmw2kHkkV18H2MLy99sA1RmFgarte63ng5WD39FmbeUXtB7iX",
"zduJBS58VjrVmEaisUh1jeuaNQHLt63Zi9j85JDRNDB4Hab5iz9wfzYay5",
// networkRegistry
zdiVGkiECt8CT7psN5wsQyNHewyRJLjPhAGwYGTRXPyAPXP21bdupzHyaw:
"zduJ5pr1MuPbfodPoRaEbQ65AScrAm5YmroChEsT8ACpGp23qoWnTcHp47",
}),
);
const REGISTRY_ITEM_ID = "registry";
@ -20,7 +23,7 @@ Object.freeze(DEFAULT_MODULE_REGISTRY);
export function getSavedRegistryEntry(pubkey: string) {
const savedEntries = new Map<string, string>(
Object.entries(window.localStorage.getItem(REGISTRY_ITEM_ID) ?? {}),
Object.entries(globalThis.localStorage.getItem(REGISTRY_ITEM_ID) ?? {}),
);
if (savedEntries.has(pubkey)) {