Compare commits
No commits in common. "v0.1.0-develop.18" and "v0.1.0-develop.17" have entirely different histories.
v0.1.0-dev
...
v0.1.0-dev
|
@ -1,5 +1,3 @@
|
|||
# [0.1.0-develop.18](https://git.lumeweb.com/LumeWeb/publish-kernel-module/compare/v0.1.0-develop.17...v0.1.0-develop.18) (2023-09-04)
|
||||
|
||||
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/publish-kernel-module/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-09-03)
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"name": "@lumeweb/publish-kernel-module",
|
||||
"version": "0.1.0-develop.18",
|
||||
"version": "0.1.0-develop.17",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/publish-kernel-module",
|
||||
"version": "0.1.0-develop.18",
|
||||
"version": "0.1.0-develop.17",
|
||||
"dependencies": {
|
||||
"@lumeweb/libweb": "0.2.0-develop.48",
|
||||
"@lumeweb/libweb": "0.2.0-develop.37",
|
||||
"@scure/bip39": "^1.2.1",
|
||||
"chalk": "^5.2.0",
|
||||
"ed25519-keygen": "^0.4.8",
|
||||
|
@ -1911,11 +1911,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@lumeweb/libportal": {
|
||||
"version": "0.2.0-develop.23",
|
||||
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.23.tgz",
|
||||
"integrity": "sha512-KN7KqFu5I+aYDeOL8hhaw1sjFjof8TrrPRvbdGmlQ7RDgkRbqiOQ8LQx2zPteBJPPGJfOtrnWWygBqy9wjuiaw==",
|
||||
"version": "0.2.0-develop.20",
|
||||
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.20.tgz",
|
||||
"integrity": "sha512-9bjyih7fyXpkcOYSue/jcLufcXQckkp30Ptigg2qFIDJOnxiv3ymRr2aq7rvXspnmTxnaQgwND0nQ0W0YOCnGA==",
|
||||
"dependencies": {
|
||||
"@lumeweb/libs5": "^0.1.0-develop.44",
|
||||
"@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",
|
||||
"detect-node": "^2.1.0",
|
||||
|
@ -1928,9 +1929,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@lumeweb/libs5": {
|
||||
"version": "0.1.0-develop.44",
|
||||
"resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.44.tgz",
|
||||
"integrity": "sha512-BR/pII6v9i556tPBSDYUBszhFvSyQq+/Ptuopk7JIoRSqFzSsXWL0RteBi6v0qQzEffft7kOhaI1dLFOGZvWVQ==",
|
||||
"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==",
|
||||
"dependencies": {
|
||||
"@noble/curves": "^1.1.0",
|
||||
"@noble/hashes": "^1.3.1",
|
||||
|
@ -1951,12 +1952,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@lumeweb/libweb": {
|
||||
"version": "0.2.0-develop.48",
|
||||
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.48.tgz",
|
||||
"integrity": "sha512-4hznd3BrYW+YFLJ8BgGDVrJuexQnKfRRlLPM+KYDFsDwu4lhoGUDonVt0gk5KBAVlUp4x6XJxXc82aYn4rhECQ==",
|
||||
"version": "0.2.0-develop.37",
|
||||
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.37.tgz",
|
||||
"integrity": "sha512-GVAQH6wo1wKGiJ0HTtbgK2kuo+Tzyvv1S9aFgwyA2BGr3HQfAnc8ssoteJrEElWzRMielM9LkZQjFEKJpI6swQ==",
|
||||
"dependencies": {
|
||||
"@lumeweb/community-portals": "^0.1.0-develop.6",
|
||||
"@lumeweb/libportal": "0.2.0-develop.23",
|
||||
"@lumeweb/libportal": "0.2.0-develop.20",
|
||||
"@lumeweb/node-library-preset": "0.2.7",
|
||||
"@noble/curves": "^1.1.0",
|
||||
"@noble/hashes": "^1.3.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/publish-kernel-module",
|
||||
"version": "0.1.0-develop.18",
|
||||
"version": "0.1.0-develop.17",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -24,7 +24,7 @@
|
|||
"lib/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"@lumeweb/libweb": "0.2.0-develop.48",
|
||||
"@lumeweb/libweb": "0.2.0-develop.37",
|
||||
"@scure/bip39": "^1.2.1",
|
||||
"chalk": "^5.2.0",
|
||||
"ed25519-keygen": "^0.4.8",
|
||||
|
|
36
src/index.ts
36
src/index.ts
|
@ -5,8 +5,7 @@ import * as process from "process";
|
|||
import fs from "fs/promises";
|
||||
import path from "path";
|
||||
import {
|
||||
encodeRegistryCid,
|
||||
encodeRegistryValue,
|
||||
concatBytes,
|
||||
equalBytes,
|
||||
hexToBytes,
|
||||
maybeInitDefaultPortals,
|
||||
|
@ -22,15 +21,21 @@ import { HDKey } from "ed25519-keygen/hdkey";
|
|||
|
||||
import {
|
||||
BOOTSTRAP_NODES,
|
||||
CID_HASH_TYPES,
|
||||
CID_TYPES,
|
||||
createKeyPair,
|
||||
createNode,
|
||||
Logger,
|
||||
REGISTRY_TYPES,
|
||||
S5NodeConfig,
|
||||
SignedRegistryEntry,
|
||||
} from "@lumeweb/libs5";
|
||||
|
||||
import { MemoryLevel } from "memory-level";
|
||||
import { base58btc } from "multiformats/bases/base58";
|
||||
import KeyPairEd25519 from "@lumeweb/libs5/lib/ed25519.js";
|
||||
import defer from "p-defer";
|
||||
import { decodeCid, encodeCid } from "@lumeweb/libportal";
|
||||
|
||||
const BIP44_PATH = "m/44'/1627'/0'/0'/0'";
|
||||
|
||||
|
@ -158,6 +163,7 @@ node.services.p2p.once("peerConnected", peerDefer.resolve);
|
|||
|
||||
await peerDefer.promise;
|
||||
{
|
||||
const cidBytes = decodeCid(cid);
|
||||
const key = hdKey as HDKey;
|
||||
|
||||
let revision = 0;
|
||||
|
@ -171,11 +177,14 @@ await peerDefer.promise;
|
|||
revision = ret.revision + 1;
|
||||
}
|
||||
|
||||
let [newEntry, err] = encodeRegistryValue(cid);
|
||||
|
||||
if (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
const newEntry = concatBytes(
|
||||
Uint8Array.from([
|
||||
REGISTRY_TYPES.CID,
|
||||
CID_TYPES.RESOLVER,
|
||||
CID_HASH_TYPES.BLAKE3,
|
||||
]),
|
||||
cidBytes.hash,
|
||||
);
|
||||
|
||||
if (!equalBytes(ret?.data ?? new Uint8Array(), newEntry)) {
|
||||
sre = node.services.registry.signRegistryEntry({
|
||||
|
@ -189,15 +198,12 @@ await peerDefer.promise;
|
|||
sre = ret as SignedRegistryEntry;
|
||||
}
|
||||
|
||||
let resolverCid;
|
||||
[resolverCid, err] = encodeRegistryCid(sre.pk);
|
||||
|
||||
if (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
|
||||
console.log(
|
||||
util.format("%s: %s", chalk.green("Resolver entry"), resolverCid),
|
||||
util.format(
|
||||
"%s: %s",
|
||||
chalk.green("Resolver entry"),
|
||||
encodeCid(sre.pk.slice(1), 0, CID_TYPES.RESOLVER, CID_HASH_TYPES.ED25519),
|
||||
),
|
||||
);
|
||||
await node.stop();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue