Socket
Socket
Sign inDemoInstall

lnmessage

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lnmessage - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

18

dist/index.js

@@ -130,3 +130,3 @@ import { BehaviorSubject, firstValueFrom, Subject } from 'rxjs';

this.socket.onopen = async () => {
this._log('info', 'WebSocket is connected');
this._log('info', 'WebSocket is connected at ' + new Date().toISOString());
this._log('info', 'Creating Act1 message');

@@ -141,3 +141,3 @@ const msg = this.noise.initiatorAct1(Buffer.from(this.remoteNodePublicKey, 'hex'));

this.socket.onclose = async () => {
this._log('error', 'WebSocket is closed');
this._log('error', 'WebSocket is closed at ' + new Date().toISOString());
this.connectionStatus$.next('disconnected');

@@ -216,5 +216,6 @@ this.connected$.next(false);

catch (err) {
// Terminate on failures as we won't be able to recovery
// Terminate on failures as we won't be able to recover
// since the noise state has rotated nonce and we won't
// be able to any more data without additional errors.
this._log('error', `Noise state has rotated nonce: ${err}`);
this.disconnect();

@@ -392,4 +393,7 @@ }

writer.writeBytes(Buffer.from(reqId, 'hex'));
// Unique request id with prefix, method and id
const detailedReqId = `lnmessage:${method}#${reqId}`;
// write the request
writer.writeBytes(Buffer.from(JSON.stringify({
id: detailedReqId,
rune,

@@ -404,7 +408,9 @@ method,

this.socket.send(message);
this._log('info', 'Message sent and awaiting response');
this._log('info', `Message sent with id ${detailedReqId} and awaiting response`);
const { response } = await firstValueFrom(this._commandoMsgs$.pipe(filter((commandoMsg) => commandoMsg.id === reqId)));
const { result } = response;
const { error } = response;
this._log('info', result ? 'Successful response received' : `Error response received: ${error.message}`);
this._log('info', result
? `Successful response received for ID: ${response.id}`
: `Error response received: ${error.message}`);
if (error)

@@ -420,3 +426,3 @@ throw error;

if (this._logger && this._logger[level]) {
this._logger[level](`[${level.toUpperCase()} - ${new Date().toLocaleTimeString()}]: ${msg}`);
this._logger[level](`[${level.toUpperCase()} - ${new Date().toISOString()}]: ${msg}`);
}

@@ -423,0 +429,0 @@ }

@@ -77,2 +77,10 @@ /// <reference types="node" />

/**
* Chaining key for sending. Initialized to ck in Act 3.
*/
sck: Buffer;
/**
* Chaining key for receiving. Initialized to ck in Act 3.
*/
rck: Buffer;
/**
* Intermediate key 1. Used to encrypt or decrypt the zero-length AEAD

@@ -79,0 +87,0 @@ * payload in the corresponding initiator or receiver act.

@@ -76,2 +76,10 @@ import { Buffer } from 'buffer';

/**
* Chaining key for sending. Initialized to ck in Act 3.
*/
sck;
/**
* Chaining key for receiving. Initialized to ck in Act 3.
*/
rck;
/**
* Intermediate key 1. Used to encrypt or decrypt the zero-length AEAD

@@ -178,2 +186,3 @@ * payload in the corresponding initiator or receiver act.

this.tempK3 = Buffer.from(tempK3.subarray(32));
this.rck = this.sck = this.ck;
// 5. t = encryptWithAD(temp_k3, 0, h, zero)

@@ -351,11 +360,11 @@ const t = ccpEncrypt(this.tempK3, Buffer.alloc(12), this.h, Buffer.alloc(0));

_rotateSendingKeys() {
const result = hkdf(this.sk, 64, this.ck);
const result = hkdf(this.sk, 64, this.sck);
this.sk = result.subarray(32);
this.ck = result.subarray(0, 32);
this.sck = result.subarray(0, 32);
this.sn = Buffer.alloc(12);
}
_rotateRecievingKeys() {
const result = hkdf(this.rk, 64, this.ck);
const result = hkdf(this.rk, 64, this.rck);
this.rk = result.subarray(32);
this.ck = result.subarray(0, 32);
this.rck = result.subarray(0, 32);
this.rn = Buffer.alloc(12);

@@ -362,0 +371,0 @@ }

{
"name": "lnmessage",
"version": "0.2.1",
"version": "0.2.2",
"description": "Talk to Lightning nodes from your browser",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -37,2 +37,4 @@ # lnmessage

wsProxy: 'wss://<WEBSOCKET_PROXY>',
// Optional TCP Socket to connect through (either use wsProxy OR tcpSocket)
tcpSocket: new net.Socket(),
// The IP address of the node

@@ -39,0 +41,0 @@ ip: '35.232.170.67',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc