Skip to content

Instantly share code, notes, and snippets.

@ozouai
Last active September 2, 2016 05:53
Show Gist options
  • Save ozouai/b80b8366df69c44ac5ef49a2f1ccac82 to your computer and use it in GitHub Desktop.
Save ozouai/b80b8366df69c44ac5ef49a2f1ccac82 to your computer and use it in GitHub Desktop.
Typings for Node-Forge
declare module "node-forge" {
export namespace pki {
export class Key {
e: any;
n: any;
}
export class PrivateKey extends Key {
d: any;
}
export class PublicKey extends Key {
}
export interface KeyPair {
publicKey: Key;
privateKey: Key;
}
export function privateKeyToPem(key: PrivateKey, maxline?: number): string;
export function publicKeyToPem(key: PublicKey, maxline?: number): string;
export function setRsaPublicKey(n: any, e: any): PublicKey;
export function privateKeyFromPem(pem: string): PrivateKey;
export namespace rsa {
export interface GenerateKeyPairOptions {
bits?: number;
e?: number;
workerScript?: string;
workers?: number;
workLoad?: number;
prng?: any;
algorithm?: string;
}
export function generateKeyPair(bits?: number, e?: number, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
export function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
}
}
export namespace pem {
export function encode(msg: any, options: Object): string;
export function decode(str: string): string;
}
export namespace aes {
}
export namespace tls {
}
export namespace asn1 {
}
export namespace cipher {
export namespace modes {
}
}
export namespace ssh {
export function getPublicKeyFingerprint(key: pki.PublicKey, options: any): string;
export function getPublicKeyFingerprint(key: pki.PublicKey): string;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment