mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-03-30 15:08:32 +00:00
Merge pull request #1807
This commit is contained in:
commit
088d5f3638
12
openpgp.d.ts
vendored
12
openpgp.d.ts
vendored
@ -94,7 +94,7 @@ export class PrivateKey extends PublicKey {
|
||||
public revoke(reason?: ReasonForRevocation, date?: Date, config?: Config): Promise<PrivateKey>;
|
||||
public isDecrypted(): boolean;
|
||||
public addSubkey(options: SubkeyOptions): Promise<PrivateKey>;
|
||||
public getDecryptionKeys(keyID?: KeyID, date?: Date | null, userID?: UserID, config?: Config): Promise<PrivateKey | Subkey>;
|
||||
public getDecryptionKeys(keyID?: KeyID, date?: Date | null, userID?: UserID, config?: Config): Promise<(PrivateKey | Subkey)[]>;
|
||||
public update(sourceKey: PublicKey, date?: Date, config?: Config): Promise<PrivateKey>;
|
||||
}
|
||||
|
||||
@ -702,7 +702,7 @@ export type EllipticCurveName = 'ed25519Legacy' | 'curve25519Legacy' | 'nistP256
|
||||
interface GenerateKeyOptions {
|
||||
userIDs: MaybeArray<UserID>;
|
||||
passphrase?: string;
|
||||
type?: 'ecc' | 'rsa';
|
||||
type?: 'ecc' | 'rsa' | 'curve25519' | 'curve448';
|
||||
curve?: EllipticCurveName;
|
||||
rsaBits?: number;
|
||||
keyExpirationTime?: number;
|
||||
@ -713,14 +713,8 @@ interface GenerateKeyOptions {
|
||||
}
|
||||
export type KeyOptions = GenerateKeyOptions;
|
||||
|
||||
export interface SubkeyOptions {
|
||||
type?: 'ecc' | 'rsa';
|
||||
curve?: EllipticCurveName;
|
||||
rsaBits?: number;
|
||||
keyExpirationTime?: number;
|
||||
date?: Date;
|
||||
export interface SubkeyOptions extends Pick<GenerateKeyOptions, 'type' | 'curve' | 'rsaBits' | 'keyExpirationTime' | 'date' | 'config'> {
|
||||
sign?: boolean;
|
||||
config?: PartialConfig;
|
||||
}
|
||||
|
||||
export declare class KeyID {
|
||||
|
@ -22,7 +22,12 @@ import {
|
||||
(async () => {
|
||||
|
||||
// Generate keys
|
||||
const keyOptions = { userIDs: [{ email: 'user@corp.co' }], config: { v6Keys: true } };
|
||||
const keyOptions = {
|
||||
type: 'curve25519' as const,
|
||||
userIDs: [{ email: 'user@corp.co' }],
|
||||
subkeys: [{ type: 'rsa' as const, sign: false }],
|
||||
config: { v6Keys: true }
|
||||
};
|
||||
const { privateKey: privateKeyArmored, publicKey: publicKeyArmored } = await generateKey(keyOptions);
|
||||
const { privateKey: privateKeyBinary } = await generateKey({ ...keyOptions, format: 'binary' });
|
||||
const { privateKey, publicKey, revocationCertificate } = await generateKey({ ...keyOptions, format: 'object' });
|
||||
|
Loading…
x
Reference in New Issue
Block a user