Compare commits

..

5 Commits

4 changed files with 54 additions and 37 deletions

View File

@ -1,3 +1,5 @@
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/publish-kernel-module/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-09-11)
# [0.1.0-develop.19](https://git.lumeweb.com/LumeWeb/publish-kernel-module/compare/v0.1.0-develop.18...v0.1.0-develop.19) (2023-09-04)
# [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)

49
npm-shrinkwrap.json generated
View File

@ -1,14 +1,14 @@
{
"name": "@lumeweb/publish-kernel-module",
"version": "0.1.0-develop.19",
"version": "0.1.0-develop.20",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/publish-kernel-module",
"version": "0.1.0-develop.19",
"version": "0.1.0-develop.20",
"dependencies": {
"@lumeweb/libweb": "0.2.0-develop.48",
"@lumeweb/libweb": "0.2.0-develop.58",
"@scure/bip39": "^1.2.1",
"chalk": "^5.2.0",
"ed25519-keygen": "^0.4.8",
@ -1911,11 +1911,11 @@
}
},
"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.38",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.38.tgz",
"integrity": "sha512-ST6zc6MgXloLbnwbQZh4wGydOr9R3pR4AkPhZjCcn9tdhuMmTMJiEK5SLJ06Tl7dR9n/GX4lMVLlNVNRjvvcmQ==",
"dependencies": {
"@lumeweb/libs5": "^0.1.0-develop.44",
"@lumeweb/libs5": "^0.1.0-develop.59",
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
"detect-node": "^2.1.0",
@ -1928,9 +1928,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.59",
"resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.59.tgz",
"integrity": "sha512-O/sbv77MrNLQrGYkpXoEV8Pwe3wHoewXRa51ivTGa4GQKbihtmLThcCo6ZnxUQoWNjgx8yUmT5G29pPZqxjcww==",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
@ -1942,22 +1942,23 @@
}
},
"node_modules/@lumeweb/libs5/node_modules/multiformats": {
"version": "12.1.0",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.0.tgz",
"integrity": "sha512-/qTOKKnU8nwcVURjRcS+UN0QYgdS5BPZzY10Aiciu2SqncyCVMGV8KtD83EBFmsuJDsSEmT4sGvzcTkCoMw0sQ==",
"version": "12.1.1",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.1.tgz",
"integrity": "sha512-GBSToTmri2vJYs8wqcZQ8kB21dCaeTOzHTIAlr8J06C1eL6UbzqURXFZ5Fl0EYm9GAFz1IlYY8SxGOs9G9NJRg==",
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"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.58",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.58.tgz",
"integrity": "sha512-VObSCNXITDdqMIFGaBIOewx59ZEf8FNf0mnVrdKY5LdjDCg+ZLRskGyf8PQYOx30enT9v6yWFlD6Lu7XzjfyGQ==",
"dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.6",
"@lumeweb/libportal": "0.2.0-develop.23",
"@lumeweb/libportal": "0.2.0-develop.38",
"@lumeweb/node-library-preset": "0.2.7",
"@noble/ciphers": "^0.3.0",
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",
"binconv": "^0.2.0"
@ -1975,6 +1976,14 @@
"semantic-release": "^21.0.5"
}
},
"node_modules/@noble/ciphers": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.3.0.tgz",
"integrity": "sha512-ldbrnOjmNRwFdXcTM6uXDcxpMIFrbzAWNnpBPp4oTJTFF0XByGD6vf45WrehZGXRQTRVV+Zm8YP+EgEf+e4cWA==",
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@noble/curves": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
@ -19098,9 +19107,9 @@
}
},
"node_modules/ws": {
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"version": "8.14.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz",
"integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==",
"engines": {
"node": ">=10.0.0"
},

View File

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

View File

@ -5,8 +5,6 @@ import * as process from "process";
import fs from "fs/promises";
import path from "path";
import {
encodeRegistryCid,
encodeRegistryValue,
equalBytes,
hexToBytes,
maybeInitDefaultPortals,
@ -22,6 +20,7 @@ import { HDKey } from "ed25519-keygen/hdkey";
import {
BOOTSTRAP_NODES,
CID,
createKeyPair,
createNode,
S5NodeConfig,
@ -108,13 +107,16 @@ maybeInitDefaultPortals();
const fd = await fs.open(file as string);
const [cid, err] = await uploadObject(
let cid;
try {
cid = await uploadObject(
fd.createReadStream(),
BigInt((await fd.stat()).size),
);
if (err) {
console.error("Failed to publish: ", err);
} catch (e) {
console.error("Failed to publish: ", e.message);
process.exit();
}
console.log(
@ -174,10 +176,12 @@ await peerDefer.promise;
revision = ret.revision + 1;
}
let [newEntry, err] = encodeRegistryValue(cid);
if (err) {
throw new Error(err);
let newEntry;
try {
newEntry = CID.decode(cid).toRegistryEntry();
} catch (e) {
console.error("Failed to publish: ", e.message);
process.exit();
}
if (!equalBytes(ret?.data ?? new Uint8Array(), newEntry)) {
@ -193,10 +197,12 @@ await peerDefer.promise;
}
let resolverCid;
[resolverCid, err] = encodeRegistryCid(sre.pk);
if (err) {
throw new Error(err);
try {
resolverCid = CID.fromRegistryPublicKey(sre.pk);
} catch (e) {
console.error("Failed to publish: ", e.message);
process.exit();
}
console.log(