Replace check for detecting that an object is a promise

This commit is contained in:
evilaliv3
2016-01-07 15:55:49 +01:00
parent 1a4a75501a
commit a730d3f7ad
4 changed files with 123 additions and 90 deletions

View File

@@ -167,7 +167,7 @@ function RSA() {
};
keys = webCrypto.generateKey(keyGenOpt, true, ['sign', 'verify']);
if (!(keys instanceof Promise)) { // IE11 KeyOperation
if (!(typeof keys.then === 'function')) { // IE11 KeyOperation
keys = convertKeyOperation(keys, 'Error generating RSA key pair.');
}
}
@@ -185,7 +185,7 @@ function RSA() {
// export the generated keys as JsonWebKey (JWK)
// https://tools.ietf.org/html/draft-ietf-jose-json-web-key-33
var key = webCrypto.exportKey('jwk', keypair.privateKey);
if (!(key instanceof Promise)) { // IE11 KeyOperation
if (!(typeof key.then === 'function')) { // IE11 KeyOperation
key = convertKeyOperation(key, 'Error exporting RSA key pair.');
}
return key;