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

Function keyToString

test/parallel/test-crypto-key-objects-messageport.js:21–32  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

19} = require('worker_threads');
20
21function keyToString(key) {
22 let ret;
23 if (key instanceof CryptoKey) {
24 key = KeyObject.from(key);
25 }
26 if (key.type === 'secret') {
27 ret = key.export().toString('hex');
28 } else {
29 ret = key.export({ type: 'pkcs1', format: 'pem' });
30 }
31 return ret;
32}
33
34// Worker threads simply reply with their representation of the received key.
35if (process.env.HAS_STARTED_WORKER) {

Calls 3

fromMethod · 0.45
toStringMethod · 0.45
exportMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…