kunkun-ext-nostr-nip-19
Version:
This extension helps you encode and decode [Nostr NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md) entities (like npub, nsec, note, nprofile, and nevent). It provides convenient commands that can be triggered from [Kunkun](https://kunkun.
29 lines (25 loc) • 661 B
JavaScript
// unistore
import createStore from 'unistore';
// Initial state
export const initialState = {
input: '',
placeholder: 'Paste something nostric (event JSON, nprofile, npub, nevent etc or hex key or id)',
output: '',
pubKeyHex: false,
privKeyHex: false,
nsec: false,
npub: false,
nprofile: false,
event: false,
seriazlizedEvent: false,
impliedEventId: false,
isSignatureValid: false,
nevent: false,
note: false
};
// Create store with initial state
export const store = createStore(initialState);
// Actions that can be used to update the store
export const storeActions = store => ({
setInput: (state, input) => ({ input })
});