Compare commits

..

No commits in common. "v0.0.2-develop.4" and "v0.0.2-develop.3" have entirely different histories.

6 changed files with 252 additions and 7949 deletions

View File

@ -3,7 +3,6 @@
"@lumeweb/presetter-kernel-module-preset" "@lumeweb/presetter-kernel-module-preset"
], ],
"config": { "config": {
"official": true, "official": true
"browser": true
} }
} }

View File

@ -1,13 +1,3 @@
## [0.0.2-develop.4](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.3...v0.0.2-develop.4) (2023-07-05)
### Bug Fixes
* add patch-package to postinstall ([5816ab3](https://git.lumeweb.com/LumeWeb/kernel-swarm/commit/5816ab308ada8f489d4f01d6110bf2dd14092412))
* keypair needs to be a private extended key ([57496da](https://git.lumeweb.com/LumeWeb/kernel-swarm/commit/57496da5cc4c0aa4c0fd941d45d32ae4ed798d36))
* need to add browser flag to .presetterrc.json ([2f92782](https://git.lumeweb.com/LumeWeb/kernel-swarm/commit/2f92782995af6a15719325e482a077e87a7b6b6e))
* we need to use the wasm libsodium @screamingvoid/sodium-universal ([411d351](https://git.lumeweb.com/LumeWeb/kernel-swarm/commit/411d35154f6a3176a9ee8c2033ac3ea2877d6be9))
## [0.0.2-develop.3](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.2...v0.0.2-develop.3) (2023-07-01) ## [0.0.2-develop.3](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.2...v0.0.2-develop.3) (2023-07-01)
## [0.0.2-develop.2](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.1...v0.0.2-develop.2) (2023-07-01) ## [0.0.2-develop.2](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.1...v0.0.2-develop.2) (2023-07-01)

8094
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,18 +10,16 @@
}, },
"scripts": { "scripts": {
"prepare": "presetter bootstrap", "prepare": "presetter bootstrap",
"build": "shx touch nop.js; run build", "build": "run build",
"semantic-release": "semantic-release", "semantic-release": "semantic-release"
"postinstall": "patch-package"
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@lumeweb/hyperswarm-web": "0.0.2-develop.7", "@lumeweb/hyperswarm-web": "0.0.2-develop.5",
"@lumeweb/libkernel": "^0.1.0-develop.13", "@lumeweb/libkernel": "^0.1.0-develop.7",
"@lumeweb/rpc": "0.0.2-develop.1", "@lumeweb/rpc": "0.0.2-develop.1",
"@noble/curves": "^1.1.0", "@noble/curves": "^1.1.0",
"@peculiar/webcrypto": "^1.4.3", "@peculiar/webcrypto": "^1.4.3",
"@screamingvoid/sodium-universal": "^0.1.1",
"async-mutex": "^0.4.0", "async-mutex": "^0.4.0",
"b4a": "^1.6.4", "b4a": "^1.6.4",
"eventemitter2": "^6.4.9", "eventemitter2": "^6.4.9",
@ -31,13 +29,10 @@
"protomux": "^3.5.0" "protomux": "^3.5.0"
}, },
"devDependencies": { "devDependencies": {
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.29", "@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.20",
"@rollup/plugin-alias": "^5.0.0",
"@types/b4a": "^1.6.0", "@types/b4a": "^1.6.0",
"crypto-browserify": "^3.12.0",
"patch-package": "^7.0.0",
"presetter": "*" "presetter": "*"
}, },
"version": "0.0.2-develop.4", "version": "0.0.2-develop.3",
"readme": "ERROR: No README data found!" "readme": "ERROR: No README data found!"
} }

View File

@ -1,66 +0,0 @@
// @ts-nocheck
import * as import0 from "@rollup/plugin-json";
import * as import1 from "@rollup/plugin-node-resolve";
import * as import2 from "@rollup/plugin-commonjs";
import * as import3 from "@rollup/plugin-graphql";
import * as import4 from "@rollup/plugin-image";
import * as import5 from "@rollup/plugin-yaml";
import * as import6 from "rollup-plugin-postcss";
import * as import7 from "rollup-plugin-visualizer";
import * as import8 from "@rollup/plugin-wasm";
import * as import9 from "@rollup/plugin-alias";
const customResolver = import1.default({
extensions: [".js"],
browser: true,
});
export default {
input: "build/index.js",
output: [
{
file: "lib/index.js",
format: "cjs",
sourcemap: false,
inlineDynamicImports: true,
},
],
plugins: [
import0.default(...([] as const)),
import9.default({
entries: {
"crypto": "crypto-browserify",
"sodium-universal": "@screamingvoid/sodium-universal",
},
customResolver,
}),
import9.default({
entries: {
"node-fetch": "./nop.js",
"stream": "./nop.js",
"formdata-polyfill/formdata-to-blob.js": "./nop.js",
},
}),
import1.default(
...([
{
browser: true,
preferBuiltins: false,
dedupe: [
"@lumeweb/libkernel",
"@lumeweb/libweb",
"@lumeweb/libportal",
],
},
] as const),
),
import2.default(
...([{ extensions: [".js", ".jsx", ".ts", ".tsx"] }] as const),
),
import3.default(...([] as const)),
import4.default(...([] as const)),
import5.default(...([] as const)),
import6.default(...([{ inject: { insertAt: "top" } }] as const)),
import7.visualizer(...([] as const)),
import8.default(...([{ targetEnv: "auto-inline" }] as const)),
],
};

View File

@ -6,17 +6,16 @@ import {
getKey, getKey,
handleMessage, handleMessage,
handlePresentKey as handlePresentKeyModule, handlePresentKey as handlePresentKeyModule,
logErr,
} from "@lumeweb/libkernel/module"; } from "@lumeweb/libkernel/module";
import { Buffer } from "buffer"; import { Buffer } from "buffer";
import { ed25519 } from "@noble/curves/ed25519"; import { ed25519 } from "@noble/curves/ed25519";
import b4a from "b4a"; import b4a from "b4a";
import { pubKeyToIpv6 } from "./addr.js"; import { pubKeyToIpv6 } from "./addr.js";
import { EventEmitter2 as EventEmitter } from "eventemitter2"; import { EventEmitter2 as EventEmitter } from "eventemitter2";
import { logErr } from "@lumeweb/libkernel";
// @ts-ignore // @ts-ignore
import Protomux from "protomux"; import Protomux from "protomux";
import defer, { DeferredPromise } from "p-defer"; import defer, { DeferredPromise } from "p-defer";
import { concatBytes } from "@lumeweb/libkernel";
const MAX_PEER_LISTENERS = 20; const MAX_PEER_LISTENERS = 20;
@ -89,9 +88,13 @@ addHandler("createProtomuxMessage", handleCreateProtomuxMessage, {
addHandler("createSwarm", handleCreateSwarm); addHandler("createSwarm", handleCreateSwarm);
async function handlePresentKey(aq: ActiveQuery) { async function handlePresentKey(aq: ActiveQuery) {
const pubkey = ed25519.getPublicKey(aq.callerInput.rootKey);
handlePresentKeyModule({ handlePresentKeyModule({
callerInput: { callerInput: {
key: aq.callerInput.rootKey, seed: {
publicKey: ed25519.getPublicKey(aq.callerInput.rootKey),
secretKey: b4a.concat([aq.callerInput.rootKey, pubkey]),
},
}, },
} as ActiveQuery); } as ActiveQuery);
@ -106,7 +109,7 @@ async function createSwarm(): Promise<number> {
const swarmInstance = new Hyperswarm({ const swarmInstance = new Hyperswarm({
keyPair: { keyPair: {
publicKey: ed25519.getPublicKey(privateKey), publicKey: ed25519.getPublicKey(privateKey),
secretKey: concatBytes(privateKey, ed25519.getPublicKey(privateKey)), secretKey: privateKey,
}, },
}); });
const id = getSwarmId(); const id = getSwarmId();