0.2.0 • Published 1 year ago

@joyid/nostr v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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.2.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago