added ed25519 in pki

This commit is contained in:
Beeno Tung
2018-08-18 17:39:35 +08:00
parent 2437e3c5bc
commit 77159b4b96
+27
View File
@@ -73,6 +73,33 @@ declare module "node-forge" {
function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
}
namespace ed25519 {
type NativeBuffer = Buffer | Uint8Array;
namespace constants {
const PUBLIC_KEY_BYTE_LENGTH = 32;
const PRIVATE_KEY_BYTE_LENGTH = 64;
const SEED_BYTE_LENGTH = 32;
const SIGN_BYTE_LENGTH = 64;
const HASH_BYTE_LENGTH = 64;
}
function generateKeyPair(options?: { seed?: Buffer | Uint8Array | string }): {
publicKey: NativeBuffer;
privateKey: NativeBuffer;
};
function publicKeyFromPrivateKey(options: { privateKey: NativeBuffer }): NativeBuffer;
function sign(options: { privateKey: NativeBuffer }): NativeBuffer;
function verify(options: {
signature: Buffer | Uint8Array | util.ByteBuffer | string,
publicKey: NativeBuffer
}): boolean;
}
interface CertificateFieldOptions {
name?: string;
type?: string;