(mcPubKeyBuffer)
| 77 | } |
| 78 | |
| 79 | function mcPubKeyToPem (mcPubKeyBuffer) { |
| 80 | let pem = '-----BEGIN PUBLIC KEY-----\n' |
| 81 | let base64PubKey = mcPubKeyBuffer.toString('base64') |
| 82 | const maxLineLength = 64 |
| 83 | while (base64PubKey.length > 0) { |
| 84 | pem += base64PubKey.substring(0, maxLineLength) + '\n' |
| 85 | base64PubKey = base64PubKey.substring(maxLineLength) |
| 86 | } |
| 87 | pem += '-----END PUBLIC KEY-----\n' |
| 88 | return pem |
| 89 | } |
no outgoing calls
no test coverage detected