import { type NonceValidator } from "./NonceValidator.js"; import { type CounterPartyDataOptions } from "./protocol/CounterPartyData.js"; import { type Currency } from "./protocol/Currency.js"; import { type Invoice, type InvoiceCurrency } from "./protocol/Invoice.js"; import { type KycStatus } from "./protocol/KycStatus.js"; import { type LnurlpRequest } from "./protocol/LnurlpRequest.js"; import { LnurlpResponse } from "./protocol/LnurlpResponse.js"; import { type PayeeData } from "./protocol/PayeeData.js"; import { type PayerData } from "./protocol/PayerData.js"; import { PayReqResponse } from "./protocol/PayReqResponse.js"; import { PayRequest } from "./protocol/PayRequest.js"; import { type PostTransactionCallback, type UtxoWithAmount } from "./protocol/PostTransactionCallback.js"; import { PubKeyResponse } from "./protocol/PubKeyResponse.js"; import { type SettlementInfo, type SettlementOption } from "./protocol/Settlement.js"; import { type PublicKeyCache } from "./PublicKeyCache.js"; import type UmaInvoiceCreator from "./UmaInvoiceCreator.js"; export declare function parseLnurlpRequest(url: URL): LnurlpRequest; export declare function isUmaLnurlpQuery(url: URL): boolean; export declare function generateNonce(): string; type FetchPublicKeyForVaspArgs = { cache: PublicKeyCache; vaspDomain: string; }; /** * FetchPublicKeyForVasp fetches the public key for another VASP. * If the public key is not in the cache, it will be fetched from the VASP's domain. * The public key will be cached for future use. * * @param cache The PublicKeyCache cache to use. You can use the InMemoryPublicKeyCache class, or implement your own * persistent cache with any storage type. * @param vaspDomain The domain of the VASP to fetch the public key for. * @returns */ export declare function fetchPublicKeyForVasp({ cache, vaspDomain, }: FetchPublicKeyForVaspArgs): Promise; type GetPubKeyResponseArgs = { /** * The chain of signing certificates in PEM format. The order of the certificates * should be from the leaf to the root. Used to verify signatures from a vasp. */ signingCertChainPem: string; /** * The chain of encryption certificates in PEM format. The order of the certificates * should be from the leaf to the root. Used to encrypt TR info sent to a VASP. */ encryptionCertChainPem: string; /** Seconds since epoch at which these pub keys must be refreshed. They can be safely cached until this expiration (or forever if null). */ expirationTimestamp?: number; }; /** * Creates a pub key response. */ export declare function getPubKeyResponse({ signingCertChainPem, encryptionCertChainPem, expirationTimestamp, }: GetPubKeyResponseArgs): PubKeyResponse; type GetSignedLnurlpRequestUrlArgs = { isSubjectToTravelRule: boolean; receiverAddress: string; senderVaspDomain: string; signingPrivateKey: Uint8Array; umaVersionOverride?: string | undefined; }; /** * Creates a signed uma request URL. */ export declare function getSignedLnurlpRequestUrl({ isSubjectToTravelRule, receiverAddress, senderVaspDomain, signingPrivateKey, umaVersionOverride, }: GetSignedLnurlpRequestUrlArgs): Promise; export declare function verifyUmaLnurlpQuerySignature(query: LnurlpRequest, otherVaspPubKeyResponse: PubKeyResponse, nonceValidator: NonceValidator): Promise; /** * Verifies the backing signatures on an UMA Lnurlp query. You may optionally call this function after * verifyUmaLnurlpQuerySignature to verify signatures from backing VASPs. * * @param query The signed query to verify * @param fetchPublicKeysForVasp Function to fetch public keys for a VASP domain * @returns true if all backing signatures are valid, false otherwise */ export declare function verifyUmaLnurlpQueryBackingSignatures(query: LnurlpRequest, cache: PublicKeyCache): Promise; export declare function verifyUmaInvoiceSignature(invoice: Invoice, publicKey: Uint8Array): Promise; export declare function isValidUmaAddress(umaAddress: string): boolean; export declare function getVaspDomainFromUmaAddress(umaAddress: string): string; type GetPayRequestArgs = { /** The public key of the receiver that will be used to encrypt the travel rule information. */ receiverEncryptionPubKey: Uint8Array; /** The private key of the VASP that is sending the payment. This will be used to sign the request. */ sendingVaspPrivateKey: Uint8Array; /** The code of the currency that the receiver will receive for this payment. */ receivingCurrencyCode: string; /** The amount of the payment in the smallest unit of the specified currency (i.e. cents for USD). */ amount: number; /** * Whether the amount field is specified in the smallest unit of the receiving currency (if * is_amount_in_receiving_currency is True), or in the smallest unit of the settlement asset (if false). */ isAmountInReceivingCurrency: boolean; /** The identifier of the sender. For example, $alice@vasp1.com */ payerIdentifier: string; /** The name of the sender (optional). Deprecated. Use payerData instead. */ payerName?: string | undefined; /** The email of the sender (optional). Deprecated. Use payerData instead. */ payerEmail?: string | undefined; /** The travel rule information. This will be encrypted before sending to the receiver. */ trInfo?: string | undefined; /** * An optional standardized format of the travel rule information (e.g. IVMS). Null indicates raw json or a custom format. * This field is formatted as @ (e.g. ivms@101.2023). Version is optional. */ travelRuleFormat?: string | undefined; /** Whether the sender is a KYC'd customer of the sending VASP. */ payerKycStatus: KycStatus; /** The list of UTXOs of the sender's channels that might be used to fund the payment. */ payerUtxos?: string[] | undefined; /** * If known, the public key of the sender's node. If supported by the receiving VASP's compliance provider, * this will be used to pre-screen the sender's UTXOs for compliance purposes. */ payerNodePubKey?: string | undefined; /** * The URL that the receiver will call to send UTXOs of the channel that the receiver used to receive the * payment once it completes. */ utxoCallback?: string | undefined; /** * The data requested by the sending VASP about the receiver. */ requestedPayeeData?: CounterPartyDataOptions | undefined; /** * A comment that the sender would like to include with the payment. This can only be included * if the receiver included the `commentAllowed` field in the lnurlp response. The length of * the comment must be less than or equal to the value of `commentAllowed`. */ comment?: string | undefined; /** * The major version of UMA used for this request. If non-UMA, this version is still relevant * for which LUD-21 spec to follow. For the older LUD-21 spec, this should be 0. For the newer * LUD-21 spec, this should be 1. */ umaMajorVersion: number; /** * associated invoice id, for PayRequest version1+ */ invoiceUUID?: string | undefined; /** * The data that the sender must send to the receiver to identify themselves. This should * include the mandatory fields requested by the receiver in the `LnurlpResponse` */ payerData?: PayerData | undefined; /** * The settlement layer and asset that the sender wants to use for this payment. * If not specified, the payment will be settled on Lightning using BTC. */ settlement?: SettlementInfo | undefined; }; /** * Creates a signed uma pay request. */ export declare function getPayRequest({ amount, receivingCurrencyCode, isAmountInReceivingCurrency, payerEmail, payerIdentifier, payerKycStatus, payerName, payerNodePubKey, payerUtxos, receiverEncryptionPubKey, sendingVaspPrivateKey, trInfo, travelRuleFormat, utxoCallback, requestedPayeeData, comment, umaMajorVersion, invoiceUUID, payerData, settlement, }: GetPayRequestArgs): Promise; type PayRequestResponseArgs = { /** The uma pay request. */ request: PayRequest; /** * The metadata that will be added to the invoice's metadata hash field. Note that this should not include the * extra payer data. That will be appended automatically. */ metadata: string; /** UmaInvoiceCreator that calls createUmaInvoice using your provider. */ invoiceCreator: UmaInvoiceCreator; /** * Milli-satoshis per the smallest unit of the specified currency. This rate is committed to by the receiving * VASP until the invoice expires. */ conversionRate: number | undefined; /** The code of the currency that the receiver will receive for this payment. */ receivingCurrencyCode: string | undefined; /** * Number of digits after the decimal point for the receiving currency. For example, in USD, by * convention, there are 2 digits for cents - $5.95. In this case, `decimals` would be 2. This should align with * the currency's `decimals` field in the LNURLP response. It is included here for convenience. See * [UMAD-04](https://github.com/uma-universal-money-address/protocol/blob/main/umad-04-lnurlp-response.md) for * details, edge cases, and examples. */ receivingCurrencyDecimals: number | undefined; /** The list of UTXOs of the receiver's channels that might be used to fund the payment. */ receiverChannelUtxos: string[] | undefined; /** * The fees charged (in millisats) by the receiving VASP to convert to the target currency. This is separate from * the conversion rate. */ receiverFeesMillisats: number | undefined; /** * If known, the public key of the receiver's node. If supported by the sending VASP's compliance provider, this * will be used to pre-screen the receiver's UTXOs for compliance purposes. */ receiverNodePubKey?: string | undefined; /** * The URL that the receiving VASP will call to send UTXOs of the channel that the receiver used to receive the * payment once it completes. */ utxoCallback?: string | undefined; /** * The data requested by the sending VASP about the receiver. */ payeeData?: PayeeData | undefined; /** The private key of the VASP that is receiving the payment. This will be used to sign the request. */ receivingVaspPrivateKey: Uint8Array | undefined; /** The identifier of the receiver. For example, $bob@vasp2.com */ payeeIdentifier: string | undefined; /** * This field may be used by a WALLET to decide whether the initial LNURL link will * be stored locally for later reuse or erased. If disposable is null, it should be * interpreted as true, so if SERVICE intends its LNURL links to be stored it must * return `disposable: false`. UMA should always return `disposable: false`. See LUD-11. */ disposable?: boolean | undefined; /** * Defines a struct which can be stored and shown to the user on payment success. See LUD-09. */ successAction?: { [key: string]: string; } | undefined; }; export declare function getPayReqResponse({ request, conversionRate, receivingCurrencyCode, receivingCurrencyDecimals, invoiceCreator, metadata, receiverChannelUtxos, receiverFeesMillisats, receiverNodePubKey, utxoCallback, payeeData, receivingVaspPrivateKey, payeeIdentifier, disposable, successAction, }: PayRequestResponseArgs): Promise; type PayReqResponseForSettlementLayerArgs = { /** The uma pay request. */ request: PayRequest; /** * The metadata that will be added to the invoice's metadata hash field. Note that this should not include the * extra payer data. That will be appended automatically. */ metadata: string; /** UmaInvoiceCreator that calls createInvoiceForSettlementLayer using your provider. */ invoiceCreator: UmaInvoiceCreator; /** * The conversion rate - how many of the smallest units of the settlement asset equal one unit of the receiving currency. * For example: * - Lightning/BTC: If 1 USD cent = 34,150 millisatoshis, then multiplier = 34150 * - Spark USDC: If 1 USD cent = 100 token units, then multiplier = 100 */ conversionRate: number | undefined; /** The code of the currency that the receiver will receive for this payment. */ receivingCurrencyCode: string | undefined; /** * Number of digits after the decimal point for the receiving currency. For example, in USD, by * convention, there are 2 digits for cents - $5.95. In this case, `decimals` would be 2. This should align with * the currency's `decimals` field in the LNURLP response. It is included here for convenience. See * [UMAD-04](https://github.com/uma-universal-money-address/protocol/blob/main/umad-04-lnurlp-response.md) for * details, edge cases, and examples. */ receivingCurrencyDecimals: number | undefined; /** * The fees charged (in the smallest unit of the settlement asset, ie. msats for Lightning) by the receiving VASP * to convert to the target currency. This is separate from the conversion rate. */ receiverFees: number | undefined; /** * If known, the public key of the receiver's node. If supported by the sending VASP's compliance provider, this * will be used to pre-screen the receiver's UTXOs for compliance purposes. Only applicable to Lightning. */ receiverNodePubKey?: string | undefined; /** * The URL that the receiving VASP will call to send UTXOs of the channel that the receiver used to receive the * payment once it completes. */ utxoCallback?: string | undefined; /** * The data requested by the sending VASP about the receiver. */ payeeData?: PayeeData | undefined; /** The private key of the VASP that is receiving the payment. This will be used to sign the request. */ receivingVaspPrivateKey: Uint8Array | undefined; /** The identifier of the receiver. For example, $bob@vasp2.com */ payeeIdentifier: string | undefined; /** * This field may be used by a WALLET to decide whether the initial LNURL link will * be stored locally for later reuse or erased. If disposable is null, it should be * interpreted as true, so if SERVICE intends its LNURL links to be stored it must * return `disposable: false`. UMA should always return `disposable: false`. See LUD-11. */ disposable?: boolean | undefined; /** * Defines a struct which can be stored and shown to the user on payment success. See LUD-09. */ successAction?: { [key: string]: string; } | undefined; }; export declare function getPayReqResponseForSettlementLayer({ request, conversionRate, receivingCurrencyCode, receivingCurrencyDecimals, invoiceCreator, metadata, receiverFees, receiverNodePubKey, utxoCallback, payeeData, receivingVaspPrivateKey, payeeIdentifier, disposable, successAction, }: PayReqResponseForSettlementLayerArgs): Promise; type GetSignedLnurlpResponseArgs = { request: LnurlpRequest; callback: string; encodedMetadata: string; minSendableSats: number; maxSendableSats: number; privateKeyBytes?: Uint8Array | undefined; requiresTravelRuleInfo?: boolean | undefined; payerDataOptions?: CounterPartyDataOptions | undefined; currencyOptions?: Currency[] | undefined; receiverKycStatus?: KycStatus | undefined; commentCharsAllowed?: number | undefined; nostrPubkey?: string | undefined; settlementOptions?: SettlementOption[] | undefined; }; export declare function getLnurlpResponse({ request, privateKeyBytes, requiresTravelRuleInfo, callback, encodedMetadata, minSendableSats, maxSendableSats, payerDataOptions, currencyOptions, receiverKycStatus, commentCharsAllowed, nostrPubkey, settlementOptions, }: GetSignedLnurlpResponseArgs): Promise; type PostTransactionCallbackArgs = { /** UTXOs of the channels of the VASP initiating the callback. */ utxos: UtxoWithAmount[]; /** Domain name of the VASP sending the callback. Used to fetch keys for signature validation. */ vaspDomain: string; /** The private signing key of the VASP that is sending the callback. This will be used to sign the request. */ signingPrivateKey: Uint8Array; }; export declare function getPostTransactionCallback({ utxos, vaspDomain, signingPrivateKey, }: PostTransactionCallbackArgs): Promise; export declare function verifyUmaLnurlpResponseSignature(response: LnurlpResponse, otherVaspPubKeyResponse: PubKeyResponse, nonceValidator: NonceValidator): Promise; /** * Verifies the backing signatures on an UMA Lnurlp response. You may optionally call this function after * verifyUmaLnurlpResponseSignature to verify signatures from backing VASPs. * * @param response The signed response to verify * @param cache The PublicKeyCache to use for fetching VASP public keys * @returns true if all backing signatures are valid, false otherwise */ export declare function verifyUmaLnurlpResponseBackingSignatures(response: LnurlpResponse, cache: PublicKeyCache): Promise; export declare function verifyPayReqSignature(query: PayRequest, otherVaspPubKeyResponse: PubKeyResponse, nonceValidator: NonceValidator): Promise; /** * Verifies the backing signatures on a PayRequest. You may optionally call this function after * verifyPayReqSignature to verify signatures from backing VASPs. * * @param query The signed PayRequest to verify * @param cache The PublicKeyCache to use for fetching VASP public keys * @returns true if all backing signatures are valid, false otherwise */ export declare function verifyPayReqBackingSignatures(query: PayRequest, cache: PublicKeyCache): Promise; export declare function verifyPayReqResponseSignature(response: PayReqResponse, payerIdentifier: string, payeeIdentifier: string, otherVaspPubKeyResponse: PubKeyResponse, nonceValidator: NonceValidator): Promise; /** * Verifies the backing signatures on a PayReqResponse. You may optionally call this function after * verifyPayReqResponseSignature to verify signatures from backing VASPs. * * @param response The signed PayReqResponse to verify * @param payerIdentifier The identifier of the sender (e.g. $alice@vasp1.com) * @param payeeIdentifier The identifier of the receiver * @param cache Cache for storing VASP public keys * @returns true if all backing signatures are valid, false otherwise */ export declare function verifyPayReqResponseBackingSignatures(response: PayReqResponse, payerIdentifier: string, payeeIdentifier: string, cache: PublicKeyCache): Promise; export declare function verifyPostTransactionCallbackSignature(callback: PostTransactionCallback, otherVaspPubKeyResponse: PubKeyResponse, nonceValidator: NonceValidator): Promise; export declare function createUmaInvoice({ receiverUma, invoiceUUID, amount, receivingCurrency, expiration, isSubjectToTravelRule, requiredPayerData, commentCharsAllowed, senderUma, invoiceLimit, kycStatus, callback, }: { receiverUma: string; invoiceUUID: string; amount: number; receivingCurrency: InvoiceCurrency; expiration: number; isSubjectToTravelRule: boolean; requiredPayerData: CounterPartyDataOptions | undefined; commentCharsAllowed: number | undefined; senderUma: string | undefined; invoiceLimit: number | undefined; kycStatus: KycStatus | undefined; callback: string; }, privateKeyBytes: Uint8Array): Promise; export {};