(type, options, callback)
| 90 | } |
| 91 | |
| 92 | function generateKeyPair(type, options, callback) { |
| 93 | if (typeof options === 'function') { |
| 94 | callback = options; |
| 95 | options = undefined; |
| 96 | } |
| 97 | validateFunction(callback, 'callback'); |
| 98 | |
| 99 | const job = createJob(kCryptoJobAsync, type, options); |
| 100 | |
| 101 | job.ondone = (error, result) => { |
| 102 | if (error) return FunctionPrototypeCall(callback, job, error); |
| 103 | // If no encoding was chosen, return key objects instead. |
| 104 | let { 0: pubkey, 1: privkey } = result; |
| 105 | pubkey = wrapKey(pubkey, PublicKeyObject); |
| 106 | privkey = wrapKey(privkey, PrivateKeyObject); |
| 107 | FunctionPrototypeCall(callback, job, null, pubkey, privkey); |
| 108 | }; |
| 109 | |
| 110 | job.run(); |
| 111 | } |
| 112 | |
| 113 | ObjectDefineProperty(generateKeyPair, customPromisifyArgs, { |
| 114 | __proto__: null, |
no test coverage detected
searching dependent graphs…