Compare commits
No commits in common. "v0.0.2-develop.2" and "v0.0.2-develop.1" have entirely different histories.
v0.0.2-dev
...
v0.0.2-dev
|
@ -1,3 +1 @@
|
|||
## [0.0.2-develop.2](https://git.lumeweb.com/LumeWeb/peer-discovery-irc/compare/v0.0.2-develop.1...v0.0.2-develop.2) (2023-07-03)
|
||||
|
||||
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/peer-discovery-irc/compare/v0.0.1...v0.0.2-develop.1) (2023-07-01)
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
{
|
||||
"name": "@lumeweb/peer-discovery-irc",
|
||||
"version": "0.0.2-develop.2",
|
||||
"version": "0.0.2-develop.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/peer-discovery-irc",
|
||||
"version": "0.0.2-develop.2",
|
||||
"version": "0.0.2-develop.1",
|
||||
"dependencies": {
|
||||
"@ctrl/irc": "^2.1.1",
|
||||
"@lumeweb/libpeerdiscovery": "^0.1.0-develop.1",
|
||||
"@noble/curves": "^1.1.0",
|
||||
"@noble/hashes": "^1.3.1",
|
||||
"b4a": "^1.6.4",
|
||||
"json-stringify-deterministic": "^1.0.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/peer-discovery-irc",
|
||||
"version": "0.0.2-develop.2",
|
||||
"version": "0.0.2-develop.1",
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
@ -22,6 +22,7 @@
|
|||
"@lumeweb/libpeerdiscovery": "^0.1.0-develop.1",
|
||||
"@noble/curves": "^1.1.0",
|
||||
"@noble/hashes": "^1.3.1",
|
||||
"b4a": "^1.6.4",
|
||||
"json-stringify-deterministic": "^1.0.8"
|
||||
},
|
||||
"files": [
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import type { Peer } from "@lumeweb/libpeerdiscovery";
|
||||
import { IrcClient } from "@ctrl/irc";
|
||||
import jsonStringify from "json-stringify-deterministic";
|
||||
import b4a from "b4a";
|
||||
import { ed25519 } from "@noble/curves/ed25519";
|
||||
import { ripemd160 } from "@noble/hashes/ripemd160";
|
||||
import { sha256 } from "@noble/hashes/sha256";
|
||||
import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
|
||||
import { bytesToHex } from "@noble/hashes/utils";
|
||||
|
||||
const hash160 = (data: Uint8Array) => ripemd160(sha256(data));
|
||||
|
||||
|
@ -37,7 +38,7 @@ export default async (
|
|||
client.once("join", resolve);
|
||||
});
|
||||
|
||||
client.say("#lumeweb", bytesToHex(pubkey));
|
||||
client.say("#lumeweb", b4a.toBuffer(pubkey).toString("hex"));
|
||||
|
||||
return new Promise<Peer>((resolve, reject) => {
|
||||
client.on("pm", async (from: string, text: string) => {
|
||||
|
@ -57,8 +58,8 @@ export default async (
|
|||
const verifyPayload = jsonStringify(verifyData);
|
||||
if (
|
||||
!ed25519.verify(
|
||||
hexToBytes(json.signature as string),
|
||||
hexToBytes(verifyPayload),
|
||||
b4a.from(json.signature, "hex"),
|
||||
b4a.from(verifyPayload),
|
||||
pubkey,
|
||||
)
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue