supercop.ts

cross-compiled javascript implementation of ed25519 based on supercop-ref10
git clone git://git.finwo.net/lib/supercop.ts
Log | Files | Refs | README | LICENSE

commit 1878e1aafb1aa96b4ba00b78c105b51f0ff9db7e
parent 0fbee6039b1e537e6835659fca79629e5c467005
Author: finwo <finwo@pm.me>
Date:   Tue, 30 May 2023 23:24:37 +0200

Clearer separation between header and description in readme

Diffstat:
MREADME.md | 34++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/README.md b/README.md @@ -47,67 +47,65 @@ This package provides ed25519/ref10 operations from orlp's implementation into J The patching applied is so we can compile it with without relying on emscriptem, but instead go purely for [clang](https://clang.llvm.org/). -## API reference +## API reference / exports -### exports - -#### type PublicKey: Buffer +### type PublicKey: Buffer Represents a public key in a keypair, simply a 32-byte buffer -#### type SecretKey: Buffer +### type SecretKey: Buffer Represents a secret key in a keypair, simply a 64-byte buffer -#### type Seed: Buffer +### type Seed: Buffer Represents a seed to build a keypair from, simply a 32-byte buffer -#### type Signature: Buffer +### type Signature: Buffer Represents a signature you can use to verify a message, simply a 64-byte buffer -#### function isSeed(data: unknown): data is Seed +### function isSeed(data: unknown): data is Seed Returns whether or not a piece of data can be used as a seed -#### function isPublicKey(data: unknown): data is PublicKey +### function isPublicKey(data: unknown): data is PublicKey Returns whether or not a piece of data can be used as a public key -#### function isSignature(data: unknown): data is Signature +### function isSignature(data: unknown): data is Signature Returns whether or not a piece of data can be used as a signature -#### function isSecretKey(data: unknown): data is SecretKey +### function isSecretKey(data: unknown): data is SecretKey Returns whether or not a piece of data can be used as a secret key -#### function createSeed(): Buffer +### function createSeed(): Buffer Uses `Math.random` to generate a new key. Only use this as a last resort, as `crypto.randomBytes(32)` provides better randomization. -#### function createKeyPair(seed: number[] | Seed): Promise<KeyPair> +### function createKeyPair(seed: number[] | Seed): Promise<KeyPair> Build a new KeyPair instance from the given seed. -#### function keyPairFrom({ publicKey: number[] | PublicKey, secretKey?: number[] | SecretKey }): KeyPair +### function keyPairFrom({ publicKey: number[] | PublicKey, secretKey?: number[] | SecretKey }): KeyPair Constructs a new KeyPair instance from the key(s) provided you can use to operate with. -#### function sign(message: string | Buffer, publicKey: number[] | PublicKey, secretKey: number[] | SecretKey): Promise<Signature> +### function sign(message: string | Buffer, publicKey: number[] | PublicKey, secretKey: number[] | SecretKey): Promise<Signature> Sign a message with the given keys, so it can be verified later -#### function verify(signature: number[] | Signature, message: string | Buffer, publicKey: number[] | PublicKey): Promise<boolean> +### function verify(signature: number[] | Signature, message: string | Buffer, publicKey: number[] | PublicKey): Promise<boolean> Verify a message/signature combination using the given public key -#### function keyExchange(theirPublicKey: number[] | PublicKey | undefined, ourSecretKey: number[] | SecretKey): Promise<Buffer> +### function keyExchange(theirPublicKey: number[] | PublicKey | undefined, ourSecretKey: number[] | SecretKey): Promise<Buffer> Generate a shared secret between 2 key pairs to use as seed for a symmetric encryption algorithm -#### class KeyPair +### class KeyPair ```typescript class KeyPair {