Package Exports
- @bitos/bnos-core
- @bitos/bnos-core/auth
- @bitos/bnos-core/events
- @bitos/bnos-core/events/kinds
- @bitos/bnos-core/migration
- @bitos/bnos-core/relays
- @bitos/bnos-core/sync
- @bitos/bnos-core/types
Readme
@bitos/bnos-core
Core library for the Bitcoin Network Operations System (BNOS).
@bitos/bnos-core provides fundamental utilities, types, and constants for building applications on top of the Nostr protocol and the BNOS ecosystem.
Installation
You can install the package using npm, yarn, or pnpm:
npm install @bitos/bnos-core
# or
yarn add @bitos/bnos-core
# or
pnpm add @bitos/bnos-coreUsage
Authentication Utilities
The library includes robust utilities for handling Nostr keys and authentication snapshots.
import {
normalizePrivateKey,
publicKeyToNpub,
createAuthSnapshotFromPrivateKey
} from '@bitos/bnos-core';
// Normalize a private key (handles npub, nsec, or hex formats)
const normalizedPrivKey = normalizePrivateKey('nsec1...');
// Convert a hex public key to an npub
const npub = publicKeyToNpub('hex_public_key');
// Create an auth snapshot
const authSnapshot = createAuthSnapshotFromPrivateKey('nsec1...');Nostr Event Kinds
Standard Nostr event kinds and utility functions for identifying them.
import { NOSTR_KINDS, getKindName, isReplaceableKind } from '@bitos/bnos-core';
console.log(NOSTR_KINDS.TEXT_NOTE); // 1
console.log(getKindName(1)); // "TEXT_NOTE"
if (isReplaceableKind(10002)) {
// Handle replaceable event
}Contributing
We welcome contributions! Please see our Contributing Guide for more details.
Acknowledgments
A special thanks to BitDigo for their continued contributions, sponsorship, and support in building the foundational architecture of the Bitcoin Network Operations System (BNOS).
License
This project is licensed under the MIT License - see the LICENSE file for details.