mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-06-24 23:22:30 +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 revoke(reason?: ReasonForRevocation, date?: Date, config?: Config): Promise<PrivateKey>;
|
||||||
public isDecrypted(): boolean;
|
public isDecrypted(): boolean;
|
||||||
public addSubkey(options: SubkeyOptions): Promise<PrivateKey>;
|
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>;
|
public update(sourceKey: PublicKey, date?: Date, config?: Config): Promise<PrivateKey>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ export type EllipticCurveName = 'ed25519Legacy' | 'curve25519Legacy' | 'nistP256
|
|||||||
interface GenerateKeyOptions {
|
interface GenerateKeyOptions {
|
||||||
userIDs: MaybeArray<UserID>;
|
userIDs: MaybeArray<UserID>;
|
||||||
passphrase?: string;
|
passphrase?: string;
|
||||||
type?: 'ecc' | 'rsa';
|
type?: 'ecc' | 'rsa' | 'curve25519' | 'curve448';
|
||||||
curve?: EllipticCurveName;
|
curve?: EllipticCurveName;
|
||||||
rsaBits?: number;
|
rsaBits?: number;
|
||||||
keyExpirationTime?: number;
|
keyExpirationTime?: number;
|
||||||
@ -713,14 +713,8 @@ interface GenerateKeyOptions {
|
|||||||
}
|
}
|
||||||
export type KeyOptions = GenerateKeyOptions;
|
export type KeyOptions = GenerateKeyOptions;
|
||||||
|
|
||||||
export interface SubkeyOptions {
|
export interface SubkeyOptions extends Pick<GenerateKeyOptions, 'type' | 'curve' | 'rsaBits' | 'keyExpirationTime' | 'date' | 'config'> {
|
||||||
type?: 'ecc' | 'rsa';
|
|
||||||
curve?: EllipticCurveName;
|
|
||||||
rsaBits?: number;
|
|
||||||
keyExpirationTime?: number;
|
|
||||||
date?: Date;
|
|
||||||
sign?: boolean;
|
sign?: boolean;
|
||||||
config?: PartialConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare class KeyID {
|
export declare class KeyID {
|
||||||
|
@ -22,7 +22,12 @@ import {
|
|||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
// Generate keys
|
// 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: privateKeyArmored, publicKey: publicKeyArmored } = await generateKey(keyOptions);
|
||||||
const { privateKey: privateKeyBinary } = await generateKey({ ...keyOptions, format: 'binary' });
|
const { privateKey: privateKeyBinary } = await generateKey({ ...keyOptions, format: 'binary' });
|
||||||
const { privateKey, publicKey, revocationCertificate } = await generateKey({ ...keyOptions, format: 'object' });
|
const { privateKey, publicKey, revocationCertificate } = await generateKey({ ...keyOptions, format: 'object' });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user