Compare commits
No commits in common. "develop" and "master" have entirely different histories.
|
@ -1,13 +0,0 @@
|
|||
name: Build/Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- develop-*
|
||||
|
||||
jobs:
|
||||
main:
|
||||
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
||||
secrets: inherit
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"preset": [
|
||||
"@lumeweb/presetter-relay-plugin-preset"
|
||||
],
|
||||
"config": {
|
||||
"tsconfig": {
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
53
CHANGELOG.md
53
CHANGELOG.md
|
@ -1,53 +0,0 @@
|
|||
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-09-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* switch mkeyEd25519 to CID_HASH_TYPES ([8780042](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/87800422e3c419f81b0e623f1895648f01ab86bf))
|
||||
|
||||
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-09-01)
|
||||
|
||||
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-09-01)
|
||||
|
||||
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-09-01)
|
||||
|
||||
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-01)
|
||||
|
||||
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-09-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* bad argument nesting ([61f333f](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/61f333feaafa37fe67adc7a7238b3a1b09da322e))
|
||||
* use privateKey not publicKeyRaw ([78bee5c](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/78bee5c47ba87118cca89f46acbea479ba028df0))
|
||||
|
||||
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-09-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* need to ensure we prefix the node id with the key type identifier ([a19c515](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/a19c515dda5f533901d35a3c6ffdd39a82a1fa30))
|
||||
|
||||
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-08-31)
|
||||
|
||||
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* path needs to be plugin ([83cc7f9](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/83cc7f9c1008e00b6cd3b461672444507ffd578e))
|
||||
|
||||
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-08-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ensure db path exists, create if not ([632eb13](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/632eb1351c92825c10681487efc7cfa3f5cebac6))
|
||||
* set default db path ([51618df](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/51618dfaf38c4dc9ad70fc6a76ca11ef37fad0f5))
|
||||
|
||||
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.0.1...v0.1.0-develop.1) (2023-08-31)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Initial version ([4444afa](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/4444afa5fa9ce1f873917324fce8be4393d0dadc))
|
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"name": "@lumeweb/relay-plugin-s5",
|
||||
"version": "0.1.0-develop.11",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "gitea@git.lumeweb.com:LumeWeb/relay-plugin-s5.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lumeweb/presetter-relay-plugin-preset": "^0.1.0-develop.1",
|
||||
"ed25519-keygen": "^0.4.8",
|
||||
"presetter": "^4.1.2"
|
||||
},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"scripts": {
|
||||
"prepare": "presetter bootstrap",
|
||||
"build": "run build",
|
||||
"semantic-release": "semantic-release"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lumeweb/interface-relay": "^0.0.2-develop.3",
|
||||
"@lumeweb/libs5-transport-hyper": "^0.1.0-develop.18",
|
||||
"@types/streamx": "^2.9.1",
|
||||
"streamx": "^2.15.1"
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"core": {
|
||||
"plugins": [
|
||||
"s5"
|
||||
]
|
||||
}
|
||||
}
|
15
pkg/s5.json
15
pkg/s5.json
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"plugin": {
|
||||
"s5": {
|
||||
"db": "/etc/lumeweb/relay/plugins/s5/db",
|
||||
"p2p": {
|
||||
"peers": {
|
||||
"initial": [
|
||||
"wss://z2DWuWNZcdSyZLpXFK2uCU3haaWMXrDAgxzv17sDEMHstZb@s5.garden/s5/p2p",
|
||||
"wss://z2DWuPbL5pweybXnEB618pMnV58ECj2VPDNfVGm3tFqBvjF@s5.ninja/s5/p2p"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
export const PROTOCOL = "lumeweb.service.s5";
|
64
src/index.ts
64
src/index.ts
|
@ -1,64 +0,0 @@
|
|||
import type { PluginAPI } from "@lumeweb/interface-relay";
|
||||
import {
|
||||
S5NodeConfig,
|
||||
createKeyPair,
|
||||
createNode,
|
||||
NodeId,
|
||||
CID_HASH_TYPES,
|
||||
} from "@lumeweb/libs5";
|
||||
import HyperTransportPeer from "@lumeweb/libs5-transport-hyper";
|
||||
import { concatBytes } from "@noble/curves/abstract/utils";
|
||||
import { Level } from "level";
|
||||
|
||||
import { PROTOCOL } from "./constants.js";
|
||||
import * as fs from "fs/promises";
|
||||
|
||||
const plugin = {
|
||||
name: "s5",
|
||||
async plugin(api: PluginAPI) {
|
||||
const dbPath = api.pluginConfig.str("db") as string;
|
||||
|
||||
try {
|
||||
await fs.access(dbPath);
|
||||
} catch {
|
||||
await fs.mkdir(dbPath, { recursive: true });
|
||||
}
|
||||
|
||||
const db = new Level<string, Uint8Array>(dbPath);
|
||||
await db.open();
|
||||
let config = {
|
||||
keyPair: createKeyPair(api.identity.privateKey),
|
||||
db,
|
||||
p2p: {
|
||||
peers: {
|
||||
initial: api.pluginConfig.array("p2p.peers.initial") ?? [],
|
||||
},
|
||||
},
|
||||
} as S5NodeConfig;
|
||||
|
||||
const node = createNode(config);
|
||||
|
||||
await node.start();
|
||||
|
||||
api.swarm.join(api.util.crypto.createHash(PROTOCOL));
|
||||
api.protocols.register(PROTOCOL, async (peer: any, muxer: any) => {
|
||||
const s5peer = new HyperTransportPeer({
|
||||
muxer,
|
||||
peer,
|
||||
protocol: PROTOCOL,
|
||||
});
|
||||
|
||||
s5peer.id = new NodeId(
|
||||
concatBytes(
|
||||
Uint8Array.from([CID_HASH_TYPES.ED25519]),
|
||||
peer.remotePublicKey,
|
||||
),
|
||||
);
|
||||
|
||||
await s5peer.init();
|
||||
node.services.p2p.onNewPeer(s5peer, true);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default plugin;
|
Loading…
Reference in New Issue