mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-12 18:51:21 +01:00
REF: lnurl class to ts
This commit is contained in:
parent
a61f8fcb29
commit
ff6b412219
2 changed files with 6 additions and 3 deletions
|
@ -3,7 +3,7 @@ import bolt11 from 'bolt11';
|
||||||
import createHash from 'create-hash';
|
import createHash from 'create-hash';
|
||||||
import { createHmac } from 'crypto';
|
import { createHmac } from 'crypto';
|
||||||
import CryptoJS from 'crypto-js';
|
import CryptoJS from 'crypto-js';
|
||||||
// @ts-ignore
|
// @ts-ignore theres no types for secp256k1
|
||||||
import secp256k1 from 'secp256k1';
|
import secp256k1 from 'secp256k1';
|
||||||
import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
|
import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ export default class Lnurl {
|
||||||
private _AsyncStorage: any;
|
private _AsyncStorage: any;
|
||||||
private _preimage: string | false;
|
private _preimage: string | false;
|
||||||
|
|
||||||
constructor(url: string, AsyncStorage?: any) {
|
constructor(url: string | false, AsyncStorage?: any) {
|
||||||
this._lnurl = url;
|
this._lnurl = url || '';
|
||||||
this._lnurlPayServiceBolt11Payload = false;
|
this._lnurlPayServiceBolt11Payload = false;
|
||||||
this._lnurlPayServicePayload = false;
|
this._lnurlPayServicePayload = false;
|
||||||
this._AsyncStorage = AsyncStorage;
|
this._AsyncStorage = AsyncStorage;
|
||||||
|
|
|
@ -43,6 +43,9 @@ const LnurlPaySuccess: React.FC = () => {
|
||||||
switch (successAction.tag) {
|
switch (successAction.tag) {
|
||||||
case 'aes': {
|
case 'aes': {
|
||||||
const preimage = lnurl.getPreimage();
|
const preimage = lnurl.getPreimage();
|
||||||
|
if (!preimage) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
setMessage(Lnurl.decipherAES(successAction.ciphertext, preimage, successAction.iv));
|
setMessage(Lnurl.decipherAES(successAction.ciphertext, preimage, successAction.iv));
|
||||||
setPreamble(successAction.description);
|
setPreamble(successAction.description);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue