Update type definitions
This commit is contained in:
parent
809deee3a6
commit
fbd71f8dfe
7
openpgp.d.ts
vendored
7
openpgp.d.ts
vendored
|
@ -166,7 +166,7 @@ export class CleartextMessage {
|
||||||
*
|
*
|
||||||
* @param privateKeys private keys with decrypted secret key data for signing
|
* @param privateKeys private keys with decrypted secret key data for signing
|
||||||
*/
|
*/
|
||||||
sign(privateKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], config?: Config): void;
|
sign(privateKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], notations?: RawNotation[], config?: Config): void;
|
||||||
|
|
||||||
/** Verify signatures of cleartext signed message
|
/** Verify signatures of cleartext signed message
|
||||||
* @param keys array of keys to verify signatures
|
* @param keys array of keys to verify signatures
|
||||||
|
@ -285,7 +285,7 @@ export class Message<T extends MaybeStream<Data>> {
|
||||||
/** Sign the message (the literal data packet of the message)
|
/** Sign the message (the literal data packet of the message)
|
||||||
@param signingKeys private keys with decrypted secret key data for signing
|
@param signingKeys private keys with decrypted secret key data for signing
|
||||||
*/
|
*/
|
||||||
public sign(signingKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], config?: Config): Promise<Message<T>>;
|
public sign(signingKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], notations?: RawNotation[], config?: Config): Promise<Message<T>>;
|
||||||
|
|
||||||
/** Unwrap compressed message
|
/** Unwrap compressed message
|
||||||
*/
|
*/
|
||||||
|
@ -604,6 +604,8 @@ interface EncryptOptions {
|
||||||
signingUserIDs?: MaybeArray<UserID>;
|
signingUserIDs?: MaybeArray<UserID>;
|
||||||
/** (optional) array of user IDs to encrypt for, e.g. { name:'Robert Receiver', email:'robert@openpgp.org' } */
|
/** (optional) array of user IDs to encrypt for, e.g. { name:'Robert Receiver', email:'robert@openpgp.org' } */
|
||||||
encryptionUserIDs?: MaybeArray<UserID>;
|
encryptionUserIDs?: MaybeArray<UserID>;
|
||||||
|
/** (optional) array of notations to add to the signatures, e.g. { name: 'test@example.org', value: new TextEncoder().encode('test'), humanReadable: true } */
|
||||||
|
signatureNotations?: MaybeArray<RawNotation>;
|
||||||
config?: PartialConfig;
|
config?: PartialConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,6 +639,7 @@ interface SignOptions {
|
||||||
signingKeyIDs?: MaybeArray<KeyID>;
|
signingKeyIDs?: MaybeArray<KeyID>;
|
||||||
date?: Date;
|
date?: Date;
|
||||||
signingUserIDs?: MaybeArray<UserID>;
|
signingUserIDs?: MaybeArray<UserID>;
|
||||||
|
signatureNotations?: MaybeArray<RawNotation>;
|
||||||
config?: PartialConfig;
|
config?: PartialConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,14 @@ import {
|
||||||
const textSignedObject: Message<string> = await sign({ signingKeys: privateKeys, message: textMessage, format: 'object' });
|
const textSignedObject: Message<string> = await sign({ signingKeys: privateKeys, message: textMessage, format: 'object' });
|
||||||
expect(textSignedObject).to.be.instanceOf(Message);
|
expect(textSignedObject).to.be.instanceOf(Message);
|
||||||
|
|
||||||
|
// Sign text message (armored)
|
||||||
|
const textSignedWithNotations: string = await sign({ signingKeys: privateKeys, message: textMessage, signatureNotations: [{
|
||||||
|
name: 'test@example.org',
|
||||||
|
value: new TextEncoder().encode('test'),
|
||||||
|
humanReadable: true
|
||||||
|
}] });
|
||||||
|
expect(textSignedWithNotations).to.include('-----BEGIN PGP MESSAGE-----');
|
||||||
|
|
||||||
// Verify signed text message (armored)
|
// Verify signed text message (armored)
|
||||||
const signedMessage = await readMessage({ armoredMessage: textSignedArmor });
|
const signedMessage = await readMessage({ armoredMessage: textSignedArmor });
|
||||||
const verifiedText = await verify({ verificationKeys: publicKeys, message: signedMessage });
|
const verifiedText = await verify({ verificationKeys: publicKeys, message: signedMessage });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user