MCPcopy Create free account
hub / github.com/PrismarineJS/node-minecraft-protocol / mcPubKeyToPem

Function mcPubKeyToPem

src/client/encrypt.js:79–89  ·  view source on GitHub ↗
(mcPubKeyBuffer)

Source from the content-addressed store, hash-verified

77}
78
79function 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}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected