mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-26 18:52:52 +00:00
* Revert "Add tsline file" This reverts commita0f8c9acc3. * Revert "Rename .d.ts file per guidelines" This reverts commit7eb6f76ab5. * Revert "Add types for ZeroMQ.js, derived from the 'zmq' type definitions" This reverts commitd5d3cd0fca. * Add new types for the ed25519 NPM package
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
// Type definitions for ed25519 0.0
|
|
// Project: https://github.com/dazoe/ed25519
|
|
// Definitions by: Erik Mavrinac <https://github.com/erikma>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
// Main site: https://ed25519.cr.yp.to/
|
|
// Manually generated and maintained because the package is a
|
|
// veneer on an underlying C library; auto-generation won't work.
|
|
// The JavaScript-C interface is well described at
|
|
// https://github.com/dazoe/ed25519/blob/master/src/ed25519.cc
|
|
|
|
/// <reference types="node" />
|
|
|
|
/** The key material returned from a call to MakeKeypair(). */
|
|
export interface CurveKeyPair {
|
|
/**
|
|
* A Buffer containing the public portion of the Curve25519 key.
|
|
*/
|
|
publicKey: Buffer;
|
|
|
|
/**
|
|
* A Buffer containing the private, secret portion of the Curve25519 key.
|
|
*/
|
|
privateKey: Buffer;
|
|
}
|
|
|
|
/**
|
|
* Uses the crytpographically strong random seed to generate a
|
|
* Curve25519 key pair.
|
|
* @return The public and private key pair.
|
|
*/
|
|
export function MakeKeypair(seed: Buffer): CurveKeyPair;
|
|
|
|
/**
|
|
* Signs a plaintext message buffer using the private key generated using
|
|
* MakeKeypair().
|
|
* @return The signature calculated on the plaintext.
|
|
*/
|
|
export function Sign(message: Buffer, privateKeyOrKeyPair: Buffer | CurveKeyPair): Buffer;
|
|
|
|
/**
|
|
* Verifies a signature for a message buffer using a
|
|
* public key generated using MakeKeypair().
|
|
* @return True if the signature validates correctly, false otherwise.
|
|
*/
|
|
export function Verify(message: Buffer, signature: Buffer, publicKey: Buffer): boolean;
|