mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 13:33:22 +00:00
prepare for upgrade to nos2x that will return full events instead of just the signature.
This commit is contained in:
parent
3e28534a6d
commit
e5fee93933
10
src/pool.js
10
src/pool.js
@ -8,7 +8,15 @@ pool.setPolicy('randomChoice', 3)
|
||||
// this will try to sign either with window.nostr or using a manual prompt
|
||||
export async function signAsynchronously(event) {
|
||||
if (window.nostr) {
|
||||
return window.nostr.signEvent(event)
|
||||
let signatureOrEvent = await window.nostr.signEvent(event)
|
||||
switch (typeof signatureOrEvent) {
|
||||
case 'string':
|
||||
return signatureOrEvent
|
||||
case 'object':
|
||||
return signatureOrEvent.sig
|
||||
default:
|
||||
throw new Error('Failed to sign with Nostr extension.')
|
||||
}
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
Dialog.create({
|
||||
|
Loading…
Reference in New Issue
Block a user