Compare commits

..

13 Commits

Author SHA1 Message Date
semantic-release-bot 09438cf112 chore(release): 0.0.2-develop.4 [skip ci]
## [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](5816ab308a))
* keypair needs to be a private extended key ([57496da](57496da5cc))
* need to add browser flag to .presetterrc.json ([2f92782](2f92782995))
* we need to use the wasm libsodium @screamingvoid/sodium-universal ([411d351](411d35154f))
2023-07-05 01:01:17 +00:00
Derrick Hammer 411d35154f
fix: we need to use the wasm libsodium @screamingvoid/sodium-universal 2023-07-04 20:59:51 -04:00
Derrick Hammer 57496da5cc
fix: keypair needs to be a private extended key 2023-07-04 20:59:01 -04:00
Derrick Hammer 9b2387b517
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	npm-shrinkwrap.json
2023-07-04 01:04:25 -04:00
Derrick Hammer bf32cebe93
ci: use custom build process 2023-07-04 01:04:09 -04:00
Derrick Hammer 9958b7cfc2
dep: update deps 2023-07-04 01:02:52 -04:00
Derrick Hammer 1b9e656e86
refactor: load logErr direct from libkernel/module 2023-07-04 00:59:01 -04:00
Derrick Hammer 3b2cf557dc
dep: update @lumeweb/hyperswarm-web 2023-07-02 17:46:23 -04:00
Derrick Hammer 5816ab308a
fix: add patch-package to postinstall 2023-07-02 17:40:48 -04:00
Derrick Hammer 2f92782995
fix: need to add browser flag to .presetterrc.json 2023-07-02 17:30:28 -04:00
Derrick Hammer 2e86ce5ffa
dep: update @lumeweb/presetter-kernel-module-preset 2023-07-02 17:30:04 -04:00
Derrick Hammer a0ba6dd6c7
dep: update @lumeweb/presetter-kernel-module-preset 2023-07-02 17:13:17 -04:00
Derrick Hammer 1a9f593a7c
dep: update deps 2023-07-02 17:04:35 -04:00
6 changed files with 7949 additions and 252 deletions

View File

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

View File

@ -1,3 +1,13 @@
## [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,16 +10,18 @@
}, },
"scripts": { "scripts": {
"prepare": "presetter bootstrap", "prepare": "presetter bootstrap",
"build": "run build", "build": "shx touch nop.js; 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.5", "@lumeweb/hyperswarm-web": "0.0.2-develop.7",
"@lumeweb/libkernel": "^0.1.0-develop.7", "@lumeweb/libkernel": "^0.1.0-develop.13",
"@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",
@ -29,10 +31,13 @@
"protomux": "^3.5.0" "protomux": "^3.5.0"
}, },
"devDependencies": { "devDependencies": {
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.20", "@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.29",
"@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.3", "version": "0.0.2-develop.4",
"readme": "ERROR: No README data found!" "readme": "ERROR: No README data found!"
} }

66
rollup.config.ts Normal file
View File

@ -0,0 +1,66 @@
// @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,16 +6,17 @@ 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;
@ -88,13 +89,9 @@ 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: {
seed: { key: aq.callerInput.rootKey,
publicKey: ed25519.getPublicKey(aq.callerInput.rootKey),
secretKey: b4a.concat([aq.callerInput.rootKey, pubkey]),
},
}, },
} as ActiveQuery); } as ActiveQuery);
@ -109,7 +106,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: privateKey, secretKey: concatBytes(privateKey, ed25519.getPublicKey(privateKey)),
}, },
}); });
const id = getSwarmId(); const id = getSwarmId();