Fix unit tests on Safari, Closes openpgpjs/openpgpjs#399
This commit is contained in:
parent
74763c155d
commit
d707164857
|
@ -50,7 +50,6 @@ matrix:
|
|||
- env: OPENPGPJSTEST='end2end-5' BROWSER='chrome beta'
|
||||
- env: OPENPGPJSTEST='end2end-7' BROWSER='microsoft edge 20.10240'
|
||||
- env: OPENPGPJSTEST='end2end-8' BROWSER='safari 8'
|
||||
- env: OPENPGPJSTEST='end2end-9' BROWSER='safari 9'
|
||||
- env: OPENPGPJSTEST='end2end-10' BROWSER='android 4.4'
|
||||
- env: OPENPGPJSTEST='end2end-11' BROWSER='android 5.1'
|
||||
- env: OPENPGPJSTEST='end2end-12' BROWSER='iphone 7.0'
|
||||
|
|
|
@ -13,9 +13,7 @@ describe('Basic', function() {
|
|||
var privKey;
|
||||
var pubKey;
|
||||
|
||||
if (openpgp.util.getWebCrypto()) {
|
||||
opt.numBits = 2048; // webkit webcrypto accepts minimum 2048 bit keys
|
||||
}
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
|
||||
openpgp.generateKeyPair(opt).then(function(key) {
|
||||
|
||||
|
@ -77,6 +75,8 @@ describe('Basic', function() {
|
|||
var msg;
|
||||
|
||||
var opt = {numBits: 512, userId: userid, passphrase: passphrase};
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
|
||||
openpgp.generateKeyPair(opt).then(function(key) {
|
||||
|
||||
var privKeys = openpgp.key.readArmored(key.privateKeyArmored);
|
||||
|
@ -128,6 +128,8 @@ describe('Basic', function() {
|
|||
var passphrase = 'password';
|
||||
|
||||
var opt = {numBits: 512, userId: userid, passphrase: passphrase};
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
|
||||
openpgp.generateKeyPair(opt).then(function(key) {
|
||||
|
||||
var privKeys = openpgp.key.readArmored(key.privateKeyArmored);
|
||||
|
|
|
@ -635,6 +635,7 @@ var pgp_desktop_priv =
|
|||
expect(key.users[0].selfCertifications[0].features).to.eql(openpgp.config.integrity_protect ? [1] : null); // modification detection
|
||||
};
|
||||
var opt = {numBits: 512, userId: 'test', passphrase: 'hello'};
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
openpgp.generateKeyPair(opt).then(function(key) {
|
||||
testPref(key.key);
|
||||
testPref(openpgp.key.readArmored(key.publicKeyArmored).keys[0]);
|
||||
|
@ -658,6 +659,7 @@ var pgp_desktop_priv =
|
|||
|
||||
it('Generated key is not unlocked by default', function(done) {
|
||||
var opt = {numBits: 512, userId: 'test', passphrase: '123'};
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
openpgp.generateKeyPair(opt).then(function(key) {
|
||||
var msg = openpgp.message.fromText('hello').encrypt([key.key]);
|
||||
msg = msg.decrypt.bind(msg, key.key);
|
||||
|
@ -669,6 +671,7 @@ var pgp_desktop_priv =
|
|||
it('Generate key - single userid', function(done) {
|
||||
var userId = 'single user';
|
||||
var opt = {numBits: 512, userId: userId, passphrase: '123'};
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
openpgp.generateKeyPair(opt).then(function(key) {
|
||||
key = key.key;
|
||||
expect(key.users.length).to.equal(1);
|
||||
|
@ -681,6 +684,7 @@ var pgp_desktop_priv =
|
|||
var userId1 = 'first user';
|
||||
var userId2 = 'second user';
|
||||
var opt = {numBits: 512, userId: [userId1, userId2], passphrase: '123'};
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
openpgp.generateKeyPair(opt).then(function(key) {
|
||||
key = key.key;
|
||||
expect(key.users.length).to.equal(2);
|
||||
|
|
|
@ -137,8 +137,9 @@ describe("Packet", function() {
|
|||
|
||||
it('Public key encrypted symmetric key packet', function(done) {
|
||||
var rsa = new openpgp.crypto.publicKey.rsa();
|
||||
var keySize = openpgp.util.getWebCrypto() ? 2048 : 512; // webkit webcrypto accepts minimum 2048 bit keys
|
||||
|
||||
rsa.generate(512, "10001").then(function(mpiGen) {
|
||||
rsa.generate(keySize, "10001").then(function(mpiGen) {
|
||||
|
||||
var mpi = [mpiGen.n, mpiGen.ee, mpiGen.d, mpiGen.p, mpiGen.q, mpiGen.u];
|
||||
mpi = mpi.map(function(k) {
|
||||
|
@ -400,8 +401,9 @@ describe("Packet", function() {
|
|||
key.push(new openpgp.packet.SecretKey());
|
||||
|
||||
var rsa = new openpgp.crypto.publicKey.rsa();
|
||||
var keySize = openpgp.util.getWebCrypto() ? 2048 : 512; // webkit webcrypto accepts minimum 2048 bit keys
|
||||
|
||||
rsa.generate(512, "10001").then(function(mipGen) {
|
||||
rsa.generate(keySize, "10001").then(function(mipGen) {
|
||||
var mpi = [mipGen.n, mipGen.ee, mipGen.d, mipGen.p, mipGen.q, mipGen.u];
|
||||
mpi = mpi.map(function(k) {
|
||||
var mpi = new openpgp.MPI();
|
||||
|
@ -428,8 +430,9 @@ describe("Packet", function() {
|
|||
var key = new openpgp.packet.SecretKey();
|
||||
|
||||
var rsa = new openpgp.crypto.publicKey.rsa();
|
||||
var keySize = openpgp.util.getWebCrypto() ? 2048 : 512; // webkit webcrypto accepts minimum 2048 bit keys
|
||||
|
||||
rsa.generate(512, "10001").then(function(mpiGen) {
|
||||
rsa.generate(keySize, "10001").then(function(mpiGen) {
|
||||
var mpi = [mpiGen.n, mpiGen.ee, mpiGen.d, mpiGen.p, mpiGen.q, mpiGen.u];
|
||||
mpi = mpi.map(function(k) {
|
||||
var mpi = new openpgp.MPI();
|
||||
|
|
|
@ -642,6 +642,7 @@ describe("Signature", function() {
|
|||
|
||||
it('Sign message with key without password', function(done) {
|
||||
var opt = {numBits: 512, userId: 'ABC', passphrase: null};
|
||||
if (openpgp.util.getWebCrypto()) { opt.numBits = 2048; } // webkit webcrypto accepts minimum 2048 bit keys
|
||||
openpgp.generateKeyPair(opt).then(function(gen) {
|
||||
var key = gen.key;
|
||||
|
||||
|
|
|
@ -455,7 +455,7 @@ describe('High level API', function() {
|
|||
|
||||
it('Error on wrong password decryptKey', function (done) {
|
||||
proxy.decryptKey(privKeyRSA, 'what?').catch(function(err) {
|
||||
expect(err).to.eql(new Error('Wrong password'));
|
||||
expect(err.message).to.eql('Wrong password');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -463,7 +463,7 @@ describe('High level API', function() {
|
|||
it('Error on wrong password decryptKeyPacket', function (done) {
|
||||
var keyid = privKeyRSA.subKeys[0].subKey.getKeyId();
|
||||
proxy.decryptKeyPacket(privKeyRSA, [keyid], 'what?').catch(function(err) {
|
||||
expect(err).to.eql(new Error('Wrong password'));
|
||||
expect(err.message).to.eql('Wrong password');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user