mirror of
https://github.com/tcsenpai/falconTS.git
synced 2025-06-03 02:00:08 +00:00
updated some readmes
This commit is contained in:
parent
4398166b49
commit
18203feb00
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
bun.lockb
|
bun.lockb
|
||||||
|
bun.lock
|
||||||
yarn.lock
|
yarn.lock
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
71
README.md
71
README.md
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
A TypeScript implementation of the Falcon signature scheme with a custom mnemonic implementation for key management.
|
A TypeScript implementation of the Falcon signature scheme with a custom mnemonic implementation for key management.
|
||||||
|
|
||||||
|
This project is based on: https://github.com/pqcsf/falcon-sign-js
|
||||||
|
|
||||||
|
The only purpose of this project is to provide an easy-to-use Typescript module that allows the Falcon implementation of the above repository to be used in TS projects with types included and with some utilities.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This project provides a TypeScript implementation of the Falcon signature scheme, along with a custom mnemonic implementation for generating, storing, and recovering Falcon keys using human-readable phrases.
|
This project provides a TypeScript implementation of the Falcon signature scheme, along with a custom mnemonic implementation for generating, storing, and recovering Falcon keys using human-readable phrases.
|
||||||
@ -13,9 +17,12 @@ This project provides a TypeScript implementation of the Falcon signature scheme
|
|||||||
- Key generation, signing, and verification
|
- Key generation, signing, and verification
|
||||||
- Mnemonic phrase generation and validation
|
- Mnemonic phrase generation and validation
|
||||||
- Key recovery from mnemonic phrases
|
- Key recovery from mnemonic phrases
|
||||||
|
- Hex and Base64 encoding/decoding utilities
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
This will install https://github.com/pqcsf/falcon-sign-js.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
@ -25,7 +32,7 @@ npm install
|
|||||||
### Basic Falcon Usage
|
### Basic Falcon Usage
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Falcon } from './src/falcon';
|
import { Falcon } from './src';
|
||||||
|
|
||||||
// Create a Falcon instance
|
// Create a Falcon instance
|
||||||
const falcon = new Falcon();
|
const falcon = new Falcon();
|
||||||
@ -81,13 +88,61 @@ await recoveredFalcon.genkey(recoveredSeed);
|
|||||||
const recoveredKeypair = await recoveredFalcon.getKeypair();
|
const recoveredKeypair = await recoveredFalcon.getKeypair();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Hex and Base64 Encoding
|
||||||
|
|
||||||
|
The Falcon class provides utilities for working with hex and base64 encoded keys and signatures:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Falcon } from './src/falcon';
|
||||||
|
|
||||||
|
// Create a Falcon instance
|
||||||
|
const falcon = new Falcon();
|
||||||
|
await falcon.init();
|
||||||
|
|
||||||
|
// Generate a key pair
|
||||||
|
await falcon.genkey();
|
||||||
|
|
||||||
|
// Get keys in hex format
|
||||||
|
const publicKeyHex = await falcon.getPublicKeyHex();
|
||||||
|
const privateKeyHex = await falcon.getPrivateKeyHex();
|
||||||
|
|
||||||
|
// Get keys in base64 format
|
||||||
|
const publicKeyBase64 = await falcon.getPublicKeyBase64();
|
||||||
|
const privateKeyBase64 = await falcon.getPrivateKeyBase64();
|
||||||
|
|
||||||
|
// Sign a message and get the signature in hex
|
||||||
|
const message = 'Hello, Falcon!';
|
||||||
|
const signatureHex = await falcon.signHex(message);
|
||||||
|
|
||||||
|
// Verify a hex signature
|
||||||
|
const isValid = await falcon.verifyHex(message, signatureHex);
|
||||||
|
|
||||||
|
// Sign a message and get the signature in base64
|
||||||
|
const signatureBase64 = await falcon.signBase64(message);
|
||||||
|
|
||||||
|
// Verify a base64 signature
|
||||||
|
const isValidBase64 = await falcon.verifyBase64(message, signatureBase64);
|
||||||
|
|
||||||
|
// Create a public key from a private key in hex format
|
||||||
|
const derivedPublicKeyHex = await falcon.publicKeyCreateHex(privateKeyHex);
|
||||||
|
|
||||||
|
// Set a private key from hex format
|
||||||
|
const newPublicKeyHex = await falcon.setPrivateKeyHex(privateKeyHex);
|
||||||
|
|
||||||
|
// Create a public key from a private key in base64 format
|
||||||
|
const derivedPublicKeyBase64 = await falcon.publicKeyCreateBase64(privateKeyBase64);
|
||||||
|
|
||||||
|
// Set a private key from base64 format
|
||||||
|
const newPublicKeyBase64 = await falcon.setPrivateKeyBase64(privateKeyBase64);
|
||||||
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Run the examples to see the mnemonic implementation in action:
|
Run the examples to see the mnemonic implementation in action:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run the basic example
|
# Run the basic example
|
||||||
npx ts-node src/example.ts
|
npx ts-node example.ts
|
||||||
|
|
||||||
# Run the mnemonic example
|
# Run the mnemonic example
|
||||||
npx ts-node mnemonic_example.ts
|
npx ts-node mnemonic_example.ts
|
||||||
@ -110,6 +165,18 @@ The implementation includes the following functions:
|
|||||||
- `validateMnemonic(mnemonic: string): boolean` - Validates a mnemonic phrase
|
- `validateMnemonic(mnemonic: string): boolean` - Validates a mnemonic phrase
|
||||||
- `generateMnemonic(): string` - Generates a random mnemonic phrase
|
- `generateMnemonic(): string` - Generates a random mnemonic phrase
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Run the test suite using:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
This project is a TypeScript wrapper around the [falcon-sign-js](https://github.com/pqcsf/falcon-sign-js) library, which provides the core Falcon signature implementation. We've added TypeScript types, a custom mnemonic implementation, and additional utilities to make it easier to use in TypeScript projects.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "falcon-ts",
|
"name": "falcon-ts",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "A TypeScript implementation of the Falcon signature scheme with a custom mnemonic implementation",
|
"description": "A TypeScript wrapper around the Falcon signature scheme with a custom mnemonic implementation",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user