Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lightning-digital-entertainment/nodestr
A nip07 provider and polyfill for NodeJS
https://github.com/lightning-digital-entertainment/nodestr
Last synced: 24 days ago
JSON representation
A nip07 provider and polyfill for NodeJS
- Host: GitHub
- URL: https://github.com/lightning-digital-entertainment/nodestr
- Owner: lightning-digital-entertainment
- Created: 2023-10-19T09:44:56.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-19T12:26:54.000Z (about 1 year ago)
- Last Synced: 2024-05-16T08:03:46.407Z (7 months ago)
- Language: TypeScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-nostr - nodestr - A nip07 provider and polyfill for NodeJS (NIP-07 Browser extensions / Client reviews and/or comparisons)
README
# nodestr
A nip07 provider and polyfill for node js.
Depends on the _@nostr-tools_ package.
## Installation
```
npm i nodestr
```## Implementation Roadmap
- [x] signEvent
- [x] getPublicKey
- [ ] encrypt
- [ ] decrypt
- [ ] NIP46 Support## Usage
```js
const { Nip07Provider } = require("nodestr");// Instantiate the NIP07Provider with a ConfigObject and register its methods on the global object.
new Nip07Provider({
secretKeyMethod: "file",
keyFilePath: "/your/path/to/keyfile",
}).register();// Once the provider is registered it will polyfill the global window object with nip07 methods:
window.nostr
.signEvent({
kind: 1,
content: "This is a test",
tags: [],
created_at: Math.floor(Date.now() / 1000),
})
.then((event) => {
console.log(event);
});window.nostr.getPublicKey().then((pubkey) => {
console.log(pubkey);
});
```### Config Object
- secretKeyMethod
- throwaway: create a new key for this process and save it in memory
- file: read a key from a utf-8 encoded text file
- nip46: WIP - Communicate with a remote signer as per NIP-46
- keyFilePath: The path to a local key file (Required when secretKeyMethod is 'file').```ts
type ProviderConfig = {
secretKeyMethod: "throwaway" | "file" | "nip46";
keyFilePath?: string;
};
```