(keyType, options = kEmptyObject)
| 138 | } |
| 139 | |
| 140 | function parseKeyEncoding(keyType, options = kEmptyObject) { |
| 141 | const { publicKeyEncoding, privateKeyEncoding } = options; |
| 142 | |
| 143 | let publicFormat, publicType; |
| 144 | if (publicKeyEncoding == null) { |
| 145 | publicFormat = publicType = undefined; |
| 146 | } else if (typeof publicKeyEncoding === 'object') { |
| 147 | ({ |
| 148 | format: publicFormat, |
| 149 | type: publicType, |
| 150 | } = parsePublicKeyEncoding(publicKeyEncoding, keyType, |
| 151 | 'options.publicKeyEncoding')); |
| 152 | } else { |
| 153 | throw new ERR_INVALID_ARG_VALUE('options.publicKeyEncoding', |
| 154 | publicKeyEncoding); |
| 155 | } |
| 156 | |
| 157 | let privateFormat, privateType, cipher, passphrase; |
| 158 | if (privateKeyEncoding == null) { |
| 159 | privateFormat = privateType = undefined; |
| 160 | } else if (typeof privateKeyEncoding === 'object') { |
| 161 | ({ |
| 162 | format: privateFormat, |
| 163 | type: privateType, |
| 164 | cipher, |
| 165 | passphrase, |
| 166 | } = parsePrivateKeyEncoding(privateKeyEncoding, keyType, |
| 167 | 'options.privateKeyEncoding')); |
| 168 | } else { |
| 169 | throw new ERR_INVALID_ARG_VALUE('options.privateKeyEncoding', |
| 170 | privateKeyEncoding); |
| 171 | } |
| 172 | |
| 173 | return [ |
| 174 | publicFormat, |
| 175 | publicType, |
| 176 | privateFormat, |
| 177 | privateType, |
| 178 | cipher, |
| 179 | passphrase, |
| 180 | ]; |
| 181 | } |
| 182 | |
| 183 | const nidOnlyKeyPairs = { |
| 184 | '__proto__': null, |
no test coverage detected
searching dependent graphs…