mirror of
https://github.com/fiatjaf/nak.git
synced 2025-12-11 01:48:50 +00:00
initial version with basic event utils.
This commit is contained in:
27
handlers/EventSigning.jsx
Normal file
27
handlers/EventSigning.jsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from 'react'
|
||||
import {getEventHash, serializeEvent} from 'nostr-tools'
|
||||
|
||||
import Item from '../components/item'
|
||||
|
||||
export default function EventSigning({value}) {
|
||||
let evt = JSON.parse(value)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Item label="serialized event">{serializeEvent(evt)}</Item>
|
||||
<Item label="event id" hint="sha256 hash of serialized">
|
||||
{getEventHash(evt)}
|
||||
</Item>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
EventSigning.match = value => {
|
||||
try {
|
||||
let evt = JSON.parse(value)
|
||||
return evt.kind && evt.content && evt.tags
|
||||
} catch (err) {
|
||||
/**/
|
||||
}
|
||||
return false
|
||||
}
|
||||
28
handlers/Nothing.jsx
Normal file
28
handlers/Nothing.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from 'react'
|
||||
|
||||
export default function Nothing() {
|
||||
return (
|
||||
<>
|
||||
you can paste
|
||||
<ul>
|
||||
<li>an unsigned event to be hashed and signed</li>
|
||||
<li>a signed event to have its signature checked</li>
|
||||
<li>a nostr relay URL to be inspected</li>
|
||||
<li>a nostr event id we'll try to fetch</li>
|
||||
<li>a nip05 identifier to be checked</li>
|
||||
<li>
|
||||
contribute a new function:{' '}
|
||||
<a
|
||||
target="_blank"
|
||||
style={{color: 'inherit'}}
|
||||
href="https://github.com/fiatjaf/nostr-utils-web"
|
||||
>
|
||||
_______
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Nothing.match = () => true
|
||||
Reference in New Issue
Block a user