Remove armor comment and version by default (#1170)
This commit is contained in:
parent
ad7d654f2b
commit
479d826533
|
@ -152,12 +152,12 @@ export default {
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {Boolean} showVersion Whether to include {@link module:config/config.versionString} in armored messages
|
* @property {Boolean} showVersion Whether to include {@link module:config/config.versionString} in armored messages
|
||||||
*/
|
*/
|
||||||
showVersion: true,
|
showVersion: false,
|
||||||
/**
|
/**
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {Boolean} showComment Whether to include {@link module:config/config.commentString} in armored messages
|
* @property {Boolean} showComment Whether to include {@link module:config/config.commentString} in armored messages
|
||||||
*/
|
*/
|
||||||
showComment: true,
|
showComment: false,
|
||||||
/**
|
/**
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {String} versionString A version string to be included in armored messages
|
* @property {String} versionString A version string to be included in armored messages
|
||||||
|
|
|
@ -745,14 +745,27 @@ module.exports = () => describe('OpenPGP.js public api tests', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Configuration', async function() {
|
it('Configuration', async function() {
|
||||||
openpgp.config.showVersion = false;
|
const showCommentVal = openpgp.config.showComment;
|
||||||
openpgp.config.commentString = 'different';
|
const showVersionVal = openpgp.config.showVersion;
|
||||||
|
const commentStringVal = openpgp.config.commentString;
|
||||||
|
|
||||||
return openpgp.encrypt({ publicKeys:publicKey, message:openpgp.Message.fromText(plaintext) }).then(function(encrypted) {
|
try {
|
||||||
expect(encrypted).to.exist;
|
const encryptedDefault = await openpgp.encrypt({ publicKeys:publicKey, message:openpgp.Message.fromText(plaintext) });
|
||||||
expect(encrypted).not.to.match(/^Version:/);
|
expect(encryptedDefault).to.exist;
|
||||||
expect(encrypted).to.match(/Comment: different/);
|
expect(encryptedDefault).not.to.match(/^Version:/);
|
||||||
});
|
expect(encryptedDefault).not.to.match(/^Comment:/);
|
||||||
|
|
||||||
|
openpgp.config.showComment = true;
|
||||||
|
openpgp.config.commentString = 'different';
|
||||||
|
const encryptedWithComment = await openpgp.encrypt({ publicKeys:publicKey, message:openpgp.Message.fromText(plaintext) });
|
||||||
|
expect(encryptedWithComment).to.exist;
|
||||||
|
expect(encryptedWithComment).not.to.match(/^Version:/);
|
||||||
|
expect(encryptedWithComment).to.match(/Comment: different/);
|
||||||
|
} finally {
|
||||||
|
openpgp.config.showComment = showCommentVal;
|
||||||
|
openpgp.config.showVersion = showVersionVal;
|
||||||
|
openpgp.config.commentString = commentStringVal;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Decrypting key with wrong passphrase rejected', async function () {
|
it('Decrypting key with wrong passphrase rejected', async function () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user