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.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) # [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", "name": "@lumeweb/publish-kernel-module",
"version": "0.1.0-develop.19", "version": "0.1.0-develop.20",
"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.19", "version": "0.1.0-develop.20",
"dependencies": { "dependencies": {
"@lumeweb/libweb": "0.2.0-develop.48", "@lumeweb/libweb": "0.2.0-develop.58",
"@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,11 +1911,11 @@
} }
}, },
"node_modules/@lumeweb/libportal": { "node_modules/@lumeweb/libportal": {
"version": "0.2.0-develop.23", "version": "0.2.0-develop.38",
"resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.23.tgz", "resolved": "https://registry.npmjs.org/@lumeweb/libportal/-/libportal-0.2.0-develop.38.tgz",
"integrity": "sha512-KN7KqFu5I+aYDeOL8hhaw1sjFjof8TrrPRvbdGmlQ7RDgkRbqiOQ8LQx2zPteBJPPGJfOtrnWWygBqy9wjuiaw==", "integrity": "sha512-ST6zc6MgXloLbnwbQZh4wGydOr9R3pR4AkPhZjCcn9tdhuMmTMJiEK5SLJ06Tl7dR9n/GX4lMVLlNVNRjvvcmQ==",
"dependencies": { "dependencies": {
"@lumeweb/libs5": "^0.1.0-develop.44", "@lumeweb/libs5": "^0.1.0-develop.59",
"@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",
@ -1928,9 +1928,9 @@
} }
}, },
"node_modules/@lumeweb/libs5": { "node_modules/@lumeweb/libs5": {
"version": "0.1.0-develop.44", "version": "0.1.0-develop.59",
"resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.44.tgz", "resolved": "https://registry.npmjs.org/@lumeweb/libs5/-/libs5-0.1.0-develop.59.tgz",
"integrity": "sha512-BR/pII6v9i556tPBSDYUBszhFvSyQq+/Ptuopk7JIoRSqFzSsXWL0RteBi6v0qQzEffft7kOhaI1dLFOGZvWVQ==", "integrity": "sha512-O/sbv77MrNLQrGYkpXoEV8Pwe3wHoewXRa51ivTGa4GQKbihtmLThcCo6ZnxUQoWNjgx8yUmT5G29pPZqxjcww==",
"dependencies": { "dependencies": {
"@noble/curves": "^1.1.0", "@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1", "@noble/hashes": "^1.3.1",
@ -1942,22 +1942,23 @@
} }
}, },
"node_modules/@lumeweb/libs5/node_modules/multiformats": { "node_modules/@lumeweb/libs5/node_modules/multiformats": {
"version": "12.1.0", "version": "12.1.1",
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.0.tgz", "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-12.1.1.tgz",
"integrity": "sha512-/qTOKKnU8nwcVURjRcS+UN0QYgdS5BPZzY10Aiciu2SqncyCVMGV8KtD83EBFmsuJDsSEmT4sGvzcTkCoMw0sQ==", "integrity": "sha512-GBSToTmri2vJYs8wqcZQ8kB21dCaeTOzHTIAlr8J06C1eL6UbzqURXFZ5Fl0EYm9GAFz1IlYY8SxGOs9G9NJRg==",
"engines": { "engines": {
"node": ">=16.0.0", "node": ">=16.0.0",
"npm": ">=7.0.0" "npm": ">=7.0.0"
} }
}, },
"node_modules/@lumeweb/libweb": { "node_modules/@lumeweb/libweb": {
"version": "0.2.0-develop.48", "version": "0.2.0-develop.58",
"resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.48.tgz", "resolved": "https://registry.npmjs.org/@lumeweb/libweb/-/libweb-0.2.0-develop.58.tgz",
"integrity": "sha512-4hznd3BrYW+YFLJ8BgGDVrJuexQnKfRRlLPM+KYDFsDwu4lhoGUDonVt0gk5KBAVlUp4x6XJxXc82aYn4rhECQ==", "integrity": "sha512-VObSCNXITDdqMIFGaBIOewx59ZEf8FNf0mnVrdKY5LdjDCg+ZLRskGyf8PQYOx30enT9v6yWFlD6Lu7XzjfyGQ==",
"dependencies": { "dependencies": {
"@lumeweb/community-portals": "^0.1.0-develop.6", "@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", "@lumeweb/node-library-preset": "0.2.7",
"@noble/ciphers": "^0.3.0",
"@noble/curves": "^1.1.0", "@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1", "@noble/hashes": "^1.3.1",
"binconv": "^0.2.0" "binconv": "^0.2.0"
@ -1975,6 +1976,14 @@
"semantic-release": "^21.0.5" "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": { "node_modules/@noble/curves": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
@ -19098,9 +19107,9 @@
} }
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "8.13.0", "version": "8.14.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==",
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "@lumeweb/publish-kernel-module", "name": "@lumeweb/publish-kernel-module",
"version": "0.1.0-develop.19", "version": "0.1.0-develop.20",
"type": "module", "type": "module",
"repository": { "repository": {
"type": "git", "type": "git",
@ -24,7 +24,7 @@
"lib/**" "lib/**"
], ],
"dependencies": { "dependencies": {
"@lumeweb/libweb": "0.2.0-develop.48", "@lumeweb/libweb": "0.2.0-develop.58",
"@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",

View File

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