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