Socket
Socket
Sign inDemoInstall

lnurl-pay

Package Overview
Dependencies
95
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

5

dist/cjs/request-pay-service-params.js

@@ -48,7 +48,10 @@ "use strict";

var metadata;
var metadataHash;
try {
metadata = JSON.parse(data.metadata + '');
metadataHash = (0, utils_1.sha256)(data.metadata + '', 'utf8');
}
catch (_a) {
metadata = [];
metadataHash = (0, utils_1.sha256)('[]', 'utf8');
}

@@ -81,2 +84,3 @@ var image = '';

metadata: metadata,
metadataHash: metadataHash,
identifier: identifier,

@@ -86,3 +90,4 @@ description: description,

commentAllowed: Number(data.commentAllowed) || 0,
rawData: data,
};
};

5

dist/cjs/utils.js

@@ -155,5 +155,6 @@ "use strict";

exports.getJson = getJson;
var sha256 = function (data) {
var sha256 = function (data, encoding) {
if (encoding === void 0) { encoding = 'hex'; }
var sha256 = new sha256_js_1.Sha256();
sha256.update(Buffer.from(data, 'hex'));
sha256.update(Buffer.from(data, encoding));
return Buffer.from(sha256.digestSync()).toString('hex');

@@ -160,0 +161,0 @@ };

7

dist/esm/request-pay-service-params.js
import { __awaiter, __generator } from "tslib";
import { decodeUrlOrAddress, isOnionUrl, checkedToSats, getJson, isUrl, } from './utils';
import { decodeUrlOrAddress, isOnionUrl, checkedToSats, getJson, isUrl, sha256, } from './utils';
var TAG_PAY_REQUEST = 'payRequest';

@@ -44,7 +44,10 @@ export var requestPayServiceParams = function (_a) {

var metadata;
var metadataHash;
try {
metadata = JSON.parse(data.metadata + '');
metadataHash = sha256(data.metadata + '', 'utf8');
}
catch (_a) {
metadata = [];
metadataHash = sha256('[]', 'utf8');
}

@@ -77,2 +80,3 @@ var image = '';

metadata: metadata,
metadataHash: metadataHash,
identifier: identifier,

@@ -82,3 +86,4 @@ description: description,

commentAllowed: Number(data.commentAllowed) || 0,
rawData: data,
};
};

@@ -141,5 +141,6 @@ import { __awaiter, __generator } from "tslib";

};
export var sha256 = function (data) {
export var sha256 = function (data, encoding) {
if (encoding === void 0) { encoding = 'hex'; }
var sha256 = new Sha256();
sha256.update(Buffer.from(data, 'hex'));
sha256.update(Buffer.from(data, encoding));
return Buffer.from(sha256.digestSync()).toString('hex');

@@ -146,0 +147,0 @@ };

declare const satoshisSymbol: unique symbol;
export declare type Satoshis = number & {
export type Satoshis = number & {
[satoshisSymbol]: never;
};
declare type Json = {
type Json = {
[key: string]: any;
};
export declare type LightningAddress = {
export type LightningAddress = {
username: string;
domain: string;
};
export declare type LNURLPaySuccessAction = {
export type LNURLPaySuccessAction = {
tag: string;

@@ -21,7 +21,7 @@ description: string | null;

};
export declare type FetcGetArgs = {
export type FetcGetArgs = {
url: string;
params?: Json;
};
export declare type LnUrlPayServiceArgs = {
export type LnUrlPayServiceArgs = {
lnUrlOrAddress: string;

@@ -31,3 +31,3 @@ onionAllowed?: boolean;

};
export declare type LnUrlPayServiceResponse = {
export type LnUrlPayServiceResponse = {
callback: string;

@@ -39,2 +39,3 @@ fixed: boolean;

metadata: Array<Array<string>>;
metadataHash: string;
identifier: string;

@@ -44,4 +45,7 @@ description: string;

commentAllowed: number;
rawData: {
[key: string]: string | number;
};
};
export declare type LnUrlRequestInvoiceBaseArgs = {
export type LnUrlRequestInvoiceBaseArgs = {
tokens: Satoshis;

@@ -52,9 +56,9 @@ comment?: string;

};
export declare type LnUrlrequestInvoiceWithServiceParamsArgs = LnUrlRequestInvoiceBaseArgs & {
export type LnUrlrequestInvoiceWithServiceParamsArgs = LnUrlRequestInvoiceBaseArgs & {
params: LnUrlPayServiceResponse;
};
export declare type LnUrlRequestInvoiceArgs = LnUrlRequestInvoiceBaseArgs & {
export type LnUrlRequestInvoiceArgs = LnUrlRequestInvoiceBaseArgs & {
lnUrlOrAddress: string;
};
export declare type LnUrlRequestInvoiceResponse = {
export type LnUrlRequestInvoiceResponse = {
params: LnUrlPayServiceResponse;

@@ -61,0 +65,0 @@ invoice: string;

@@ -0,1 +1,2 @@

/// <reference types="node" />
import type { LightningAddress, LNURLPaySuccessAction, Satoshis } from './types';

@@ -78,3 +79,3 @@ /**

}>;
export declare const sha256: (data: string) => string;
export declare const sha256: (data: string, encoding?: BufferEncoding) => string;
export declare const getHashFromInvoice: (invoice: string) => string | null;

@@ -81,0 +82,0 @@ export declare const isValidPreimage: ({ invoice, preimage, }: {

/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>

@@ -32,6 +25,4 @@ * @license MIT

/*! https://mths.be/punycode v1.3.2 by @mathias */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
{
"name": "lnurl-pay",
"version": "2.0.1",
"version": "2.0.2",
"description": "Client library for lnurl-pay and lightning address",

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

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc