0.1.2 • Published 7 months ago

@joyid/nostr v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

@joyid/nostr

Installation

npm install @joyid/nostr

Usage

NIP-07

import { nostr } from '@joyid/nostr'

The nostr variable implements NIP-07 and can be used to interact with the Nostr protocol. Following are the methods available on the nostr variable:

nostr.getPublicKey(): Promise<string>

Returns the public key of the authenticated user.

nostr.signEvent(event: UnsignEvent): Promise<event>

Signs an event with the private key of the authenticated user. Note that You must first call getPublicKey() once before you can use the authorized nostr account to call signEvent(). Alternatively, you can pass pubkey as event.pubkey to skip the getPublicKey() call.

NIP-04

NIP-04 is under development and not yet implemented.

Config

import { initConfig } from '@joyid/nostr'

// in your app entry file
initConfig({
  // your app name
  name: 'Nostr demo',
  // your app logo,
  logo: 'https://fav.farm/🆔',
  // optional, default to 'https://poc.joyid.dev'
  // joyidAppURL: 'https://poc.joyid.dev',
})

logout()

Logs out the authenticated user.

import { logout } from '@joyid/nostr'

function logoutOnClick() {
  logout()
}
0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

9 months ago