Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add crypto create(De)cipher options parameter #8084

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,26 +551,41 @@ type crypto$key = string | {
...
};

type cryptoCipherOptions = duplexStreamOptions & {
authTagLength?: number,
...
};

declare module "crypto" {
declare var DEFAULT_ENCODING: string;

declare class Sign extends crypto$Sign {}
declare class Verify extends crypto$Verify {}

declare function createCipher(algorithm: string, password: string | Buffer): crypto$Cipher;
declare function createCipher(
algorithm: string,
password: string | Buffer,
options?: cryptoCipherOptions
): crypto$Cipher;
declare function createCipheriv(
algorithm: string,
key: string | Buffer,
iv: string | Buffer
iv: string | Buffer | null,
options?: cryptoCipherOptions
): crypto$Cipher;
declare function createCredentials(
details?: crypto$createCredentialsDetails
): crypto$Credentials
declare function createDecipher(algorithm: string, password: string | Buffer): crypto$Decipher;
declare function createDecipher(
algorithm: string,
password: string | Buffer,
options?: cryptoCipherOptions
): crypto$Decipher;
declare function createDecipheriv(
algorithm: string,
key: string | Buffer,
iv: string | Buffer
iv: string | Buffer | null,
options?: cryptoCipherOptions
): crypto$Decipher;
declare function createDiffieHellman(prime_length: number): crypto$DiffieHellman;
declare function createDiffieHellman(prime: number, encoding?: string): crypto$DiffieHellman;
Expand Down