MCPcopy Index your code
hub / github.com/nodejs/node / parseKeyEncoding

Function parseKeyEncoding

lib/internal/crypto/keygen.js:140–181  ·  view source on GitHub ↗
(keyType, options = kEmptyObject)

Source from the content-addressed store, hash-verified

138}
139
140function 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
183const nidOnlyKeyPairs = {
184 '__proto__': null,

Callers 1

createJobFunction · 0.70

Calls 2

parsePublicKeyEncodingFunction · 0.85
parsePrivateKeyEncodingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…