Skip to content

Commit 5257be4

Browse files
committed
docs: enhance documentation and package metadata
- Added comprehensive JSDoc documentation - Set up TypeDoc with markdown plugin - Created GitHub Actions workflow for documentation - Updated README with installation and documentation links - Fixed lint issues - Bumped version to 0.2.3 - Added correct repository URLs
1 parent 93ce045 commit 5257be4

21 files changed

+1032
-36
lines changed

.github/workflows/documentation.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Use Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Generate documentation
25+
run: npm run docs
26+
27+
- name: Deploy to GitHub Pages
28+
if: github.ref == 'refs/heads/main'
29+
uses: peaceiris/actions-gh-pages@v3
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
publish_dir: ./docs
33+
user_name: 'github-actions[bot]'
34+
user_email: 'github-actions[bot]@users.noreply.github.com'
35+
commit_message: 'docs: update documentation'

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ This library handles cryptographic keys and seed phrases that are critical for s
1313

1414
Developers using this library must inform their users about the critical nature of managing seed phrases, `nsec`, and hex keys. It is the user's responsibility to securely store and manage these keys. The library and its authors disclaim any responsibility or liability for lost keys, seed phrases, or data resulting from mismanagement.
1515

16+
## Installation
17+
18+
You can install the package using npm:
19+
20+
```bash
21+
npm install nostr-nsec-seedphrase
22+
```
23+
24+
Or using yarn:
25+
26+
```bash
27+
yarn add nostr-nsec-seedphrase
28+
```
29+
30+
The package is available on [npmjs.com/package/nostr-nsec-seedphrase](https://www.npmjs.com/package/nostr-nsec-seedphrase)
31+
32+
## Documentation
33+
34+
Full API documentation is available at [https://humanjavaenterprises.github.io/nostr-nsec-seedphrase](https://humanjavaenterprises.github.io/nostr-nsec-seedphrase)
35+
1636
## Features
1737

1838
- Generate secure BIP39 mnemonics for Nostr key pairs
@@ -22,12 +42,6 @@ Developers using this library must inform their users about the critical nature
2242
- Secure key management utilities
2343
- Extensive testing and documentation
2444

25-
## Installation
26-
27-
```bash
28-
npm install @humanjavaenterprises/nostr-nsec-seedphrase
29-
```
30-
3145
## Usage
3246

3347
### Basic Key Generation
@@ -41,7 +55,7 @@ import {
4155
hexToNsec,
4256
validateSeedPhrase,
4357
seedPhraseToKeyPair
44-
} from '@humanjavaenterprises/nostr-nsec-seedphrase';
58+
} from 'nostr-nsec-seedphrase';
4559

4660
// Generate new keys with seed phrase
4761
const keyPair = generateKeyPairWithSeed();

docs/.nojekyll

Whitespace-only changes.

docs/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
**nostr-nsec-seedphrase v0.2.2**
2+
3+
***
4+
5+
# nostr-nsec-seedphrase v0.2.2
6+
7+
## File
8+
9+
Core functionality for Nostr key management with seed phrases
10+
11+
## Interfaces
12+
13+
- [KeyPair](interfaces/KeyPair.md)
14+
- [KeyPairWithSeed](interfaces/KeyPairWithSeed.md)
15+
16+
## Functions
17+
18+
- [fromHex](functions/fromHex.md)
19+
- [generateKeyPairWithSeed](functions/generateKeyPairWithSeed.md)
20+
- [generateSeedPhrase](functions/generateSeedPhrase.md)
21+
- [hexToNpub](functions/hexToNpub.md)
22+
- [hexToNsec](functions/hexToNsec.md)
23+
- [npubToHex](functions/npubToHex.md)
24+
- [nsecToHex](functions/nsecToHex.md)
25+
- [seedPhraseToEntropy](functions/seedPhraseToEntropy.md)
26+
- [seedPhraseToKeyPair](functions/seedPhraseToKeyPair.md)
27+
- [validateSeedPhrase](functions/validateSeedPhrase.md)

docs/functions/fromHex.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[**nostr-nsec-seedphrase v0.2.2**](../README.md)
2+
3+
***
4+
5+
[nostr-nsec-seedphrase](../README.md) / fromHex
6+
7+
# Function: fromHex()
8+
9+
> **fromHex**(`privateKeyHex`): [`KeyPair`](../interfaces/KeyPair.md)
10+
11+
Creates a key pair from a hex-encoded private key
12+
13+
## Parameters
14+
15+
### privateKeyHex
16+
17+
`string`
18+
19+
The hex-encoded private key
20+
21+
## Returns
22+
23+
[`KeyPair`](../interfaces/KeyPair.md)
24+
25+
A key pair containing hex and bech32 format keys
26+
27+
## Function
28+
29+
fromHex
30+
31+
## Throws
32+
33+
If the private key is invalid
34+
35+
## Example
36+
37+
```typescript
38+
const keyPair = fromHex('7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f');
39+
console.log(keyPair);
40+
// {
41+
// privateKey: '7f7f7f...',
42+
// publicKey: 'ab340...',
43+
// nsec: 'nsec1...',
44+
// npub: 'npub1...'
45+
// }
46+
```
47+
48+
## Defined in
49+
50+
[index.ts:186](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase/blob/93ce0459b0d186fc37eff33fe1af09c64ebbf5bf/src/index.ts#L186)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[**nostr-nsec-seedphrase v0.2.2**](../README.md)
2+
3+
***
4+
5+
[nostr-nsec-seedphrase](../README.md) / generateKeyPairWithSeed
6+
7+
# Function: generateKeyPairWithSeed()
8+
9+
> **generateKeyPairWithSeed**(): [`KeyPairWithSeed`](../interfaces/KeyPairWithSeed.md)
10+
11+
Generates a new Nostr key pair with a corresponding seed phrase
12+
13+
## Returns
14+
15+
[`KeyPairWithSeed`](../interfaces/KeyPairWithSeed.md)
16+
17+
A key pair with hex and bech32 format keys, plus the seed phrase
18+
19+
## Function
20+
21+
generateKeyPairWithSeed
22+
23+
## Example
24+
25+
```typescript
26+
const keyPairWithSeed = generateKeyPairWithSeed();
27+
console.log(keyPairWithSeed);
28+
// {
29+
// privateKey: '7f7f7f...',
30+
// publicKey: 'ab340...',
31+
// nsec: 'nsec1...',
32+
// npub: 'npub1...',
33+
// seedPhrase: 'witch collapse...'
34+
// }
35+
```
36+
37+
## Defined in
38+
39+
[index.ts:140](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase/blob/93ce0459b0d186fc37eff33fe1af09c64ebbf5bf/src/index.ts#L140)

docs/functions/generateSeedPhrase.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[**nostr-nsec-seedphrase v0.2.2**](../README.md)
2+
3+
***
4+
5+
[nostr-nsec-seedphrase](../README.md) / generateSeedPhrase
6+
7+
# Function: generateSeedPhrase()
8+
9+
> **generateSeedPhrase**(): `string`
10+
11+
Generates a new BIP39 mnemonic seed phrase using secure random entropy
12+
13+
## Returns
14+
15+
`string`
16+
17+
A BIP39 compliant mnemonic seed phrase
18+
19+
## Function
20+
21+
generateSeedPhrase
22+
23+
## Example
24+
25+
```typescript
26+
const seedPhrase = generateSeedPhrase();
27+
console.log(seedPhrase);
28+
// 'witch collapse practice feed shame open despair creek road again ice least'
29+
```
30+
31+
## Defined in
32+
33+
[index.ts:47](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase/blob/93ce0459b0d186fc37eff33fe1af09c64ebbf5bf/src/index.ts#L47)

docs/functions/hexToNpub.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[**nostr-nsec-seedphrase v0.2.2**](../README.md)
2+
3+
***
4+
5+
[nostr-nsec-seedphrase](../README.md) / hexToNpub
6+
7+
# Function: hexToNpub()
8+
9+
> **hexToNpub**(`publicKeyHex`): `string`
10+
11+
Converts a hex public key to bech32 'npub' format
12+
13+
## Parameters
14+
15+
### publicKeyHex
16+
17+
`string`
18+
19+
The hex-encoded public key
20+
21+
## Returns
22+
23+
`string`
24+
25+
The bech32 'npub' encoded public key
26+
27+
## Function
28+
29+
hexToNpub
30+
31+
## Throws
32+
33+
If the public key is invalid
34+
35+
## Example
36+
37+
```typescript
38+
const npub = hexToNpub('ab340...');
39+
console.log(npub); // 'npub1...'
40+
```
41+
42+
## Defined in
43+
44+
[index.ts:268](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase/blob/93ce0459b0d186fc37eff33fe1af09c64ebbf5bf/src/index.ts#L268)

docs/functions/hexToNsec.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[**nostr-nsec-seedphrase v0.2.2**](../README.md)
2+
3+
***
4+
5+
[nostr-nsec-seedphrase](../README.md) / hexToNsec
6+
7+
# Function: hexToNsec()
8+
9+
> **hexToNsec**(`privateKeyHex`): `string`
10+
11+
Converts a hex private key to bech32 'nsec' format
12+
13+
## Parameters
14+
15+
### privateKeyHex
16+
17+
`string`
18+
19+
The hex-encoded private key
20+
21+
## Returns
22+
23+
`string`
24+
25+
The bech32 'nsec' encoded private key
26+
27+
## Function
28+
29+
hexToNsec
30+
31+
## Throws
32+
33+
If the private key is invalid
34+
35+
## Example
36+
37+
```typescript
38+
const nsec = hexToNsec('7f7f7f...');
39+
console.log(nsec); // 'nsec1...'
40+
```
41+
42+
## Defined in
43+
44+
[index.ts:288](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase/blob/93ce0459b0d186fc37eff33fe1af09c64ebbf5bf/src/index.ts#L288)

docs/functions/npubToHex.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[**nostr-nsec-seedphrase v0.2.2**](../README.md)
2+
3+
***
4+
5+
[nostr-nsec-seedphrase](../README.md) / npubToHex
6+
7+
# Function: npubToHex()
8+
9+
> **npubToHex**(`npub`): `string`
10+
11+
Converts a bech32 'npub' public key to its hex representation
12+
13+
## Parameters
14+
15+
### npub
16+
17+
`string`
18+
19+
The bech32 'npub' encoded public key
20+
21+
## Returns
22+
23+
`string`
24+
25+
The hex-encoded public key
26+
27+
## Function
28+
29+
npubToHex
30+
31+
## Throws
32+
33+
If the npub is invalid
34+
35+
## Example
36+
37+
```typescript
38+
const hex = npubToHex('npub1...');
39+
console.log(hex); // 'ab340...'
40+
```
41+
42+
## Defined in
43+
44+
[index.ts:244](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase/blob/93ce0459b0d186fc37eff33fe1af09c64ebbf5bf/src/index.ts#L244)

0 commit comments

Comments
 (0)