@bubblewrap/core
Version:
Core Library to generate, build and sign TWA projects
58 lines (57 loc) • 2 kB
TypeScript
import { JdkHelper } from './JdkHelper';
import { Log } from '../Log';
export interface KeyInfo {
fingerprints: Map<string, string>;
}
export interface KeyOptions {
path: string;
alias: string;
keypassword: string;
password: string;
}
export interface CreateKeyOptions extends KeyOptions {
fullName: string;
organizationalUnit: string;
organization: string;
country: string;
}
/**
* A Wrapper of the Java keytool command-line tool
*/
export declare class KeyTool {
private jdkHelper;
private log;
constructor(jdkHelper: JdkHelper, log?: Log);
/**
* Creates a new signing key.
*
* @param {CreateKeyOptions} keyOptions arguments to use to generate the key.
* @param {boolean} overwrite true if an existing key should be overwriten.
* @returns {Promise<void>}
*/
createSigningKey(keyOptions: CreateKeyOptions, overwrite?: boolean): Promise<void>;
/**
* Runs `keytool --list` on the keystore / alias provided on the {@link KeyOptions}.
*
* @param {KeyOptions} keyOptions parameters for they key to be listed.
* @returns {Promise<string>} the raw output of the `keytool --list` command
*/
list(keyOptions: KeyOptions): Promise<string>;
/**
* Runs `keytool --list` on the keystore / alias provided on the {@link KeyOptions}. Currently,
* only extracting fingerprints is implemented.
*
* @param {KeyOptions} keyOptions parameters for they key to be listed.
* @returns {Promise<KeyInfo>} the parsed output of the `keytool --list` command
*/
keyInfo(keyOptions: KeyOptions): Promise<KeyInfo>;
/**
* The commas in the dname field from key tool must be escaped, so that 'te,st' becomes 'te\,st'.
*/
private static escapeDName;
/**
* Parses the output of `keytool --list` and returns a structured {@link KeyInfo}. Currently,
* only extracts the fingerprints.
*/
static parseKeyInfo(rawKeyInfo: string): KeyInfo;
}