toc: - name: Highlighted section description: | The public key is a base64 encoded string of a protobuf containing an RSA DER buffer. This uses a node buffer to pass the base64 encoded public key protobuf to the multihash for ID generation. ```js var PeerId = require('peer-id') PeerId.create({ bits: 1024 }, (err, id) => { console.log(JSON.stringify(id.toJSON(), null, 2) }) ``` ``` { "id": "Qma9T5YraSnpRDZqRR4krcSJabThc8nwZuJV3LercPHufi", "privKey": "CAAS4AQwggJcAgEAAoGBAMBgbIqyOL26oV3nGPBYrdpbv..", "pubKey": "CAASogEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMBgbIqyOL26oV3nGPBYrdpbvzCY..." } ```