mirror of
https://github.com/alexbosworth/balanceofsatoshis.git
synced 2026-08-13 12:33:37 +02:00
26 lines
457 B
JavaScript
26 lines
457 B
JavaScript
const beginKey = '-----BEGIN PUBLIC KEY-----';
|
|
const endKey = '-----END PUBLIC KEY-----';
|
|
const split = /.{0,64}/g;
|
|
|
|
/** Get a DER encoded public key as a PEM encoded public key
|
|
|
|
{
|
|
pem: <Pem Encoded Public Key String>
|
|
}
|
|
|
|
@returns
|
|
{
|
|
der: <DER Binary Buffer>
|
|
}
|
|
*/
|
|
module.exports = ({pem}) => {
|
|
const lines = pem.split('\n');
|
|
|
|
lines.pop();
|
|
|
|
lines.shift();
|
|
|
|
const der = Buffer.from(lines.join(String()), 'base64');
|
|
|
|
return {der};
|
|
};
|