Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

ID command now generates a public key for output #68

Merged
merged 6 commits into from
Feb 19, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
module.exports = function (config) {
var path = require('path')
var nodeForgePath = path.resolve(__dirname, 'node_modules/peer-id/deps/forge.bundle.js')

config.set({
basePath: '',
frameworks: ['mocha'],

files: [
nodeForgePath,
'tests/test-core/browser.js'
],

Expand All @@ -16,7 +20,8 @@ module.exports = function (config) {
extensions: ['', '.js', '.json']
},
externals: {
fs: '{}'
fs: '{}',
'node-forge': 'forge'
},
node: {
Buffer: true
Expand All @@ -40,7 +45,6 @@ module.exports = function (config) {
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'],
captureTimeout: 60000,
singleRun: true
})
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"brfs": "^1.4.3",
"buffer-loader": "0.0.1",
"chai": "^3.4.1",
"expose-loader": "^0.7.1",
"fs-blob-store": "^5.2.1",
"idb-plus-blob-store": "^1.0.0",
"istanbul": "^0.4.1",
Expand All @@ -54,11 +55,12 @@
"mocha": "^2.3.4",
"ncp": "^2.0.0",
"nexpect": "^0.5.0",
"peer-id": "^0.5.0",
"pre-commit": "^1.1.2",
"rimraf": "^2.4.4",
"standard": "^5.4.1",
"transform-loader": "^0.2.3",
"webpack": "^2.0.5-beta"
"webpack": "^2.0.7-beta"
},
"dependencies": {
"bl": "^1.0.0",
Expand Down
5 changes: 3 additions & 2 deletions src/ipfs-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Block = blocks.Block
const mDAG = require('ipfs-merkle-dag')
const DAGNode = mDAG.DAGNode
const DAGService = mDAG.DAGService
const peerId = require('peer-id')

exports = module.exports = IPFS

Expand Down Expand Up @@ -55,10 +56,10 @@ function IPFS (repo) {
if (err) {
return callback(err)
}
var pid = peerId.createFromPrivKey(config.Identity.PrivKey)
callback(null, {
ID: config.Identity.PeerID,
// TODO needs https:/diasdavid/js-peer-id/blob/master/src/index.js#L76
PublicKey: '',
PublicKey: pid.pubKey,
Addresses: config.Addresses,
AgentVersion: 'js-ipfs',
ProtocolVersion: '9000'
Expand Down
2 changes: 1 addition & 1 deletion tests/test-api/test-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('id', function () {
url: '/api/v0/id'
}, res => {
expect(res.result).to.deep.equal({ ID: 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A',
PublicKey: '',
PublicKey: 'CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2SKo/HMFZeBml1AF3XijzrxrfQXdJzjePBZAbdxqKR1Mc6juRHXij6HXYPjlAk01BhF1S3Ll4Lwi0cAHhggf457sMg55UWyeGKeUv0ucgvCpBwlR5cQ020i0MgzjPWOLWq1rtvSbNcAi2ZEVn6+Q2EcHo3wUvWRtLeKz+DZSZfw2PEDC+DGPJPl7f8g7zl56YymmmzH9liZLNrzg/qidokUv5u1pdGrcpLuPNeTODk0cqKB+OUbuKj9GShYECCEjaybJDl9276oalL9ghBtSeEv20kugatTvYy590wFlJkkvyl+nPxIH0EEYMKK9XRWlu9XYnoSfboiwcv8M3SlsjAgMBAAE=',
Addresses: { Swarm: [ '/ip4/0.0.0.0/tcp/4001', '/ip6/::/tcp/4001' ],
API: '/ip4/127.0.0.1/tcp/5001',
Gateway: '/ip4/127.0.0.1/tcp/8080' },
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cli-offline/test-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('id', () => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'id'])
.run((err, stdout, exitcode) => {
var expected = [ "{ ID: 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A',",
" PublicKey: '',",
" PublicKey: 'CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2SKo/HMFZeBml1AF3XijzrxrfQXdJzjePBZAbdxqKR1Mc6juRHXij6HXYPjlAk01BhF1S3Ll4Lwi0cAHhggf457sMg55UWyeGKeUv0ucgvCpBwlR5cQ020i0MgzjPWOLWq1rtvSbNcAi2ZEVn6+Q2EcHo3wUvWRtLeKz+DZSZfw2PEDC+DGPJPl7f8g7zl56YymmmzH9liZLNrzg/qidokUv5u1pdGrcpLuPNeTODk0cqKB+OUbuKj9GShYECCEjaybJDl9276oalL9ghBtSeEv20kugatTvYy590wFlJkkvyl+nPxIH0EEYMKK9XRWlu9XYnoSfboiwcv8M3SlsjAgMBAAE=',",
' Addresses: ',
" { Swarm: [ '/ip4/0.0.0.0/tcp/4001', '/ip6/::/tcp/4001' ],",
" API: '/ip4/127.0.0.1/tcp/5001',",
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cli/test-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('id', () => {
nexpect.spawn('node', [process.cwd() + '/src/cli/bin.js', 'id'])
.run((err, stdout, exitcode) => {
var expected = [ "{ ID: 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A',",
" PublicKey: '',",
" PublicKey: 'CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2SKo/HMFZeBml1AF3XijzrxrfQXdJzjePBZAbdxqKR1Mc6juRHXij6HXYPjlAk01BhF1S3Ll4Lwi0cAHhggf457sMg55UWyeGKeUv0ucgvCpBwlR5cQ020i0MgzjPWOLWq1rtvSbNcAi2ZEVn6+Q2EcHo3wUvWRtLeKz+DZSZfw2PEDC+DGPJPl7f8g7zl56YymmmzH9liZLNrzg/qidokUv5u1pdGrcpLuPNeTODk0cqKB+OUbuKj9GShYECCEjaybJDl9276oalL9ghBtSeEv20kugatTvYy590wFlJkkvyl+nPxIH0EEYMKK9XRWlu9XYnoSfboiwcv8M3SlsjAgMBAAE=',",
' Addresses: ',
" { Swarm: [ '/ip4/0.0.0.0/tcp/4001', '/ip6/::/tcp/4001' ],",
" API: '/ip4/127.0.0.1/tcp/5001',",
Expand Down
2 changes: 1 addition & 1 deletion tests/test-core/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ idb.deleteDatabase('ipfs')
idb.deleteDatabase('ipfs/blocks')

describe('IPFS Repo Tests on the Browser', function () {
this.timeout(10000)
before(function (done) {
var repoData = []
repoContext.keys().forEach(function (key) {
Expand All @@ -34,7 +35,6 @@ describe('IPFS Repo Tests on the Browser', function () {

const blocks = _.startsWith(file.key, 'blocks/')
const blob = blocks ? blocksBlob : mainBlob

const key = blocks ? file.key.replace(/^blocks\//, '') : file.key

blob.createWriteStream({
Expand Down
2 changes: 1 addition & 1 deletion tests/test-core/test-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('id', () => {
ipfs.id((err, id) => {
expect(err).to.not.exist
expect(id).to.deep.equal({ ID: 'QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A',
PublicKey: '',
PublicKey: 'CAASpgIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2SKo/HMFZeBml1AF3XijzrxrfQXdJzjePBZAbdxqKR1Mc6juRHXij6HXYPjlAk01BhF1S3Ll4Lwi0cAHhggf457sMg55UWyeGKeUv0ucgvCpBwlR5cQ020i0MgzjPWOLWq1rtvSbNcAi2ZEVn6+Q2EcHo3wUvWRtLeKz+DZSZfw2PEDC+DGPJPl7f8g7zl56YymmmzH9liZLNrzg/qidokUv5u1pdGrcpLuPNeTODk0cqKB+OUbuKj9GShYECCEjaybJDl9276oalL9ghBtSeEv20kugatTvYy590wFlJkkvyl+nPxIH0EEYMKK9XRWlu9XYnoSfboiwcv8M3SlsjAgMBAAE=',
Addresses: { Swarm: [ '/ip4/0.0.0.0/tcp/4001', '/ip6/::/tcp/4001' ],
API: '/ip4/127.0.0.1/tcp/5001',
Gateway: '/ip4/127.0.0.1/tcp/8080' },
Expand Down