22 lines
661 B
Ruby
22 lines
661 B
Ruby
module NostrRememberCookieHelper
|
|
def set_remembered_nostr_session(user:, user_pubkey:, remote_signer_pubkey:)
|
|
get nostr_connect_path
|
|
signer_session = NostrSignerSession.order(:id).last
|
|
signer_session.update!(
|
|
status: "verified",
|
|
user_pubkey: user_pubkey,
|
|
remote_signer_pubkey: remote_signer_pubkey,
|
|
verified_at: Time.current
|
|
)
|
|
|
|
allow(LdapManager::FetchUserByNostrKey).to receive(:call)
|
|
.with(pubkey: user_pubkey)
|
|
.and_return(user)
|
|
|
|
get nostr_connect_status_path, as: :json
|
|
raise "Could not remember the remote signer" unless response.status == 200
|
|
|
|
logout
|
|
signer_session.reload
|
|
end
|
|
end |