mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 09:09:08 -04:00
28 lines
559 B
JavaScript
28 lines
559 B
JavaScript
import React from 'react'
|
|
import useBooleanState from 'use-boolean-state'
|
|
|
|
import {getPublicKey} from 'nostr-tools'
|
|
|
|
import Item from '../components/item'
|
|
|
|
export default function KeyHandling({value}) {
|
|
let privateKey = value
|
|
let publicKey = getPublicKey(privateKey)
|
|
|
|
return (
|
|
<>
|
|
<Item label="private key">{privateKey}</Item>
|
|
<Item label="public key">{publicKey}</Item>
|
|
</>
|
|
)
|
|
}
|
|
|
|
KeyHandling.match = value => {
|
|
try {
|
|
if (value.toLowerCase().match(/^[a-f0-9]{64}$/)) return true
|
|
} catch (err) {
|
|
/**/
|
|
}
|
|
return false
|
|
}
|