Compare commits

...

7 Commits

4 changed files with 33 additions and 38 deletions

View File

@ -1,3 +1,5 @@
# [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)

29
npm-shrinkwrap.json generated
View File

@ -1,14 +1,14 @@
{
"name": "@lumeweb/publish-kernel-module",
"version": "0.1.0-develop.17",
"version": "0.1.0-develop.18",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/publish-kernel-module",
"version": "0.1.0-develop.17",
"version": "0.1.0-develop.18",
"dependencies": {
"@lumeweb/libweb": "0.2.0-develop.37",
"@lumeweb/libweb": "0.2.0-develop.48",
"@scure/bip39": "^1.2.1",
"chalk": "^5.2.0",
"ed25519-keygen": "^0.4.8",
@ -1911,12 +1911,11 @@
}
},
"node_modules/@lumeweb/libportal": {
"version": "0.2.0-develop.20",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.20.tgz",
"integrity": "sha512-9bjyih7fyXpkcOYSue/jcLufcXQckkp30Ptigg2qFIDJOnxiv3ymRr2aq7rvXspnmTxnaQgwND0nQ0W0YOCnGA==",
"version": "0.2.0-develop.23",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.23.tgz",
"integrity": "sha512-KN7KqFu5I+aYDeOL8hhaw1sjFjof8TrrPRvbdGmlQ7RDgkRbqiOQ8LQx2zPteBJPPGJfOtrnWWygBqy9wjuiaw==",
"dependencies": {
"@lumeweb/libs5": "^0.1.0-develop.43",
"@lumeweb/node-library-preset": "git+https://git.lumeweb.com/LumeWeb/node-library-preset.git",
"@lumeweb/libs5": "^0.1.0-develop.44",
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
"detect-node": "^2.1.0",
@ -1929,9 +1928,9 @@
}
},
"node_modules/@lumeweb/libs5": {
"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==",
"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==",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
@ -1952,12 +1951,12 @@
}
},
"node_modules/@lumeweb/libweb": {
"version": "0.2.0-develop.37",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.37.tgz",
"integrity": "sha512-GVAQH6wo1wKGiJ0HTtbgK2kuo+Tzyvv1S9aFgwyA2BGr3HQfAnc8ssoteJrEElWzRMielM9LkZQjFEKJpI6swQ==",
"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==",
"dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.6",
"@lumeweb/libportal": "0.2.0-develop.20",
"@lumeweb/libportal": "0.2.0-develop.23",
"@lumeweb/node-library-preset": "0.2.7",
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/publish-kernel-module",
"version": "0.1.0-develop.17",
"version": "0.1.0-develop.18",
"type": "module",
"repository": {
"type": "git",
@ -24,7 +24,7 @@
"lib/**"
],
"dependencies": {
"@lumeweb/libweb": "0.2.0-develop.37",
"@lumeweb/libweb": "0.2.0-develop.48",
"@scure/bip39": "^1.2.1",
"chalk": "^5.2.0",
"ed25519-keygen": "^0.4.8",

View File

@ -5,7 +5,8 @@ import * as process from "process";
import fs from "fs/promises";
import path from "path";
import {
concatBytes,
encodeRegistryCid,
encodeRegistryValue,
equalBytes,
hexToBytes,
maybeInitDefaultPortals,
@ -21,21 +22,15 @@ 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'";
@ -163,7 +158,6 @@ node.services.p2p.once("peerConnected", peerDefer.resolve);
await peerDefer.promise;
{
const cidBytes = decodeCid(cid);
const key = hdKey as HDKey;
let revision = 0;
@ -177,14 +171,11 @@ await peerDefer.promise;
revision = ret.revision + 1;
}
const newEntry = concatBytes(
Uint8Array.from([
REGISTRY_TYPES.CID,
CID_TYPES.RESOLVER,
CID_HASH_TYPES.BLAKE3,
]),
cidBytes.hash,
);
let [newEntry, err] = encodeRegistryValue(cid);
if (err) {
throw new Error(err);
}
if (!equalBytes(ret?.data ?? new Uint8Array(), newEntry)) {
sre = node.services.registry.signRegistryEntry({
@ -198,12 +189,15 @@ 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"),
encodeCid(sre.pk.slice(1), 0, CID_TYPES.RESOLVER, CID_HASH_TYPES.ED25519),
),
util.format("%s: %s", chalk.green("Resolver entry"), resolverCid),
);
await node.stop();
}