Add keysend support for Lightning Address

Allow keysend payments to user addresses. Useful for Podcasting 2.0/v4v.
This commit is contained in:
Râu Cao
2023-02-19 17:45:27 +08:00
parent 84337c3a7d
commit c7fe1bc3bc
4 changed files with 41 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
class LnurlpayController < ApplicationController
before_action :check_feature_enabled
before_action :find_user_by_address
MIN_SATS = 10
@@ -17,6 +18,20 @@ class LnurlpayController < ApplicationController
}
end
def keysend
http_status :not_found unless Setting.lndhub_keysend_enabled?
render json: {
status: "OK",
tag: "keysend",
pubkey: Setting.lndhub_public_key,
customData: [{
customKey: "696969",
customValue: @user.ln_account
}]
}
end
def invoice
amount = params[:amount].to_i / 1000 # msats
address = params[:address]
@@ -72,4 +87,9 @@ class LnurlpayController < ApplicationController
comment.length <= MAX_COMMENT_CHARS
end
private
def check_feature_enabled
http_status :not_found if !Setting.lndhub_enabled?
end
end