mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
[node] Infer type of value returned by KeyObject.export more accurately
This commit is contained in:
Vendored
+9
-6
@@ -135,15 +135,18 @@ declare module "crypto" {
|
||||
|
||||
export type KeyObjectType = 'secret' | 'public' | 'private';
|
||||
|
||||
interface KeyExportOptions<T extends KeyFormat> {
|
||||
type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
|
||||
format: T;
|
||||
cipher?: string;
|
||||
passphrase?: string | Buffer;
|
||||
}
|
||||
|
||||
class KeyObject {
|
||||
private constructor();
|
||||
asymmetricKeyType?: KeyType;
|
||||
export(options?: {
|
||||
type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1',
|
||||
format: KeyFormat,
|
||||
cipher?: string,
|
||||
passphrase?: string | Buffer
|
||||
}): string | Buffer;
|
||||
export(options: KeyExportOptions<'pem'>): string | Buffer;
|
||||
export(options?: KeyExportOptions<'der'>): Buffer;
|
||||
symmetricSize?: number;
|
||||
type: KeyObjectType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user