UNPKG

@microsoft/dev-tunnels-ssh-keys

Version:

SSH key import/export library for Dev Tunnels

39 lines 2.57 kB
/// <reference types="node" /> import { Buffer } from 'buffer'; import { KeyPair } from '@microsoft/dev-tunnels-ssh'; import { KeyFormatter } from './keyFormatter'; import { KeyFormat } from './keyFormat'; /** * Specifies how formatted key data is encoded into a string or file. */ export declare const enum KeyEncoding { Default = 0, Binary = 1, Base64 = 2, Pem = 3, SshBase64 = 4, Json = 5 } /** * Mapping to formatters for each supported key format. */ export declare const keyFormatters: Map<KeyFormat, KeyFormatter>; /** Exports the public key from a key pair, as a string. */ export declare function exportPublicKey(keyPair: KeyPair, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<string>; /** Exports the public key from a key pair, to a file. */ export declare function exportPublicKeyFile(keyPair: KeyPair, keyFile: string, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<void>; /** Exports the public key from a key pair, to a byte buffer. */ export declare function exportPublicKeyBytes(keyPair: KeyPair, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<Buffer>; /** Exports the private key from a key pair, as a string. */ export declare function exportPrivateKey(keyPair: KeyPair, passphrase?: string | null, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<string>; /** Exports the private key from a key pair, to a file. */ export declare function exportPrivateKeyFile(keyPair: KeyPair, passphrase: string | null | undefined, keyFile: string, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<void>; /** Exports the private key from a key pair, to a byte buffer. */ export declare function exportPrivateKeyBytes(keyPair: KeyPair, passphrase?: string | null, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<Buffer>; /** Imports a public key or public/private key pair from a string. */ export declare function importKey(keyString: string, passphrase?: string | null, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<KeyPair>; /** Imports a public key or public/private key pair from a file. */ export declare function importKeyFile(keyFile: string, passphrase?: string | null, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<KeyPair>; /** Imports a public key or public/private key pair from a byte array. */ export declare function importKeyBytes(keyBytes: Buffer, passphrase?: string | null, keyFormat?: KeyFormat, keyEncoding?: KeyEncoding): Promise<KeyPair>; //# sourceMappingURL=importExport.d.ts.map