@hyperbitjs/message
v3.0.1
Published

Readme
@hyperbitjs/message

Hyperbit - Message
JavaScript functions for signing and verifying messages.
Installation
npm install @hyperbitjs/messageUsage
Sign a message using a private key
import { rvn } from '@hyperbitjs/chains';
import { sign } from '@hyperbitjs/message';
// Wallet Import Format (WIF) format
const privateKey =
'963523425d5de8ad42320df7ec9ba0e7f15783914da16e0aff93df20c7b668fb';
const message = 'This is an example of a signed message.';
const signature = sign({ message, privateKey, network: rvn.mainnet });
// Expected Result: IIHJVUBhHEnGXun89PyIyoua265DKhACWFxG3LRAJTz+S03huR+vIaWhgJPYDoxAlS/EFN7nqydAfP6n+UBDvdY=Sign a message using a private key WIF
import { rvn } from '@hyperbitjs/chains';
import { sign } from '@hyperbitjs/message';
// Wallet Import Format (WIF) format
const privateKeyWIF = 'T85xhCTbfJnMW4a8qB4ubAFVgshrDdU9jcDmrSgNntTp6YSrub7M';
const message = 'This is an example of a signed message.';
const signature = sign({ message, privateKeyWIF, network: rvn.mainnet });
// Expected Result: IIHJVUBhHEnGXun89PyIyoua265DKhACWFxG3LRAJTz+S03huR+vIaWhgJPYDoxAlS/EFN7nqydAfP6n+UBDvdY=Verify a message
import { verify } from '@hyperbitjs/message';
const address = '<public_address_of_private_key_wif>';
const message = 'This is an example of a signed message.';
const signature = '<generated_signature_from_sign>';
const isValid = verify({ address, message, signature });Full Example
import { Mnemonic } from '@hyperbitjs/mnemonic';
import { sign, verify } from '@hyperbitjs/message';
import { ltc } from '@hyperbitjs/chains';
const mnemonic = new Mnemonic({ network: ltc.main });
const addresses = mnemonic.generateAddresses();
const { address, privateKey } = addresses[0].external;
const network = ltc.main;
const message = 'This is an example of a signed message.';
const signature = sign({
privateKey,
message,
network,
});
const isValid = verify({
message,
address,
signature,
network,
});
console.log('isValid', isValid);
// Expected Output: trueLicense
MIT License
Overview
This project lives at message and is part of the broader multi-project workspace.
Description: No description provided yet.
Purpose
- Deliver the core capability owned by this project.
- Provide stable commands and interfaces for other apps/packages in the workspace.
- Keep implementation details localized so changes stay maintainable.
Architecture Notes
- Type: Project
- Package manager metadata source:
package.json - Runtime entry hints:
dist/index.cjs
Setup
- Install dependencies from this directory:
npm install- Run key scripts as needed (see script table below).
NPM Scripts
| Script | Command |
|---|---|
| build | vite build |
| type-check | tsc --noEmit |
| lint | eslint . --max-warnings 0 |
| lint:fix | eslint . --fix && prettier --write . |
| format | prettier --write . |
| format:check | prettier --check . |
| test | vitest --run |
| test:watch | vitest |
| validate | npm run type-check && npm run lint && npm run test |
| prepublishOnly | npm run build && npm run validate |
Dependencies
Production
@hyperbitjs/chains:file:../chains@hyperbitjs/coinkey:*bitcoinjs-message:*ecpair:*tiny-secp256k1:*
Development
@types/node:^20.10.0@typescript-eslint/eslint-plugin:^7.0.0@typescript-eslint/parser:^7.0.0eslint:^8.56.0prettier:^3.3.3typescript:^5.3.3vite:^5.4.21vitest:^1.6.1
Configuration
- Primary config source:
package.json - No
.env.exampledetected in this directory. - Add project-specific operational notes to
MEMORY_BANK.md.
Development Workflow
- Make changes in focused modules.
- Run the smallest relevant script/test first.
- Run full validation scripts before merging.
- Update this README and memory bank whenever behavior/contracts change.
Testing and Validation
- Prefer script-driven checks from the table above (for example:
test,build,lint). - If this project has no tests yet, add smoke checks and document them in
MEMORY_BANK.md.
LLM Context
When using an LLM coding assistant in this folder, always include:
- Exact target file paths and expected behavior changes.
- Validation command(s) run after edits.
- Runtime/config assumptions (.env, API keys, ports, external services).
Memory Bank
See MEMORY_BANK.md for operational context, commands, and troubleshooting notes.
