This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Awesome Async Crypto + Less magic to 'run in the browser' #485
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
bf2a4b2
refactor: use async peer-id and peer-info
dignifiedquire 6ba6219
tests are starting
dignifiedquire c38590a
some browser related refactoring
dignifiedquire d2ea32a
more fixes
dignifiedquire 2f901b7
fix async methods everyhwere
dignifiedquire fc955e7
refactor: use multihashes instead of bs58
dignifiedquire 9358c42
some test improvements
dignifiedquire 2d2185b
fix: async .key
dignifiedquire 6d94eba
node:core passing
dignifiedquire 6ef4ec0
test:node:http passes
dignifiedquire 2933054
test:node:cli passing
dignifiedquire 2005dbe
test:browser pass
dignifiedquire 458d6a6
sauce labs ready
dignifiedquire 639efcd
chore: update deps
dignifiedquire 983882b
update test folders
dignifiedquire a1cd2ac
chore: update deps
daviddias 8d5b10a
test: bring back bitswap
dignifiedquire 19589ca
CR cleanup
dignifiedquire 67fbc0f
last cr fixes
dignifiedquire cd7f77d
feat(http): better error messages
dignifiedquire 6a21cd0
feat(http): set default headers for browsers
dignifiedquire 4aad341
test: proper handling of browser tests
dignifiedquire File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,12 @@ | ||
'use strict' | ||
|
||
const path = require('path') | ||
|
||
module.exports = { | ||
webpack: { | ||
resolve: { | ||
alias: { | ||
'libp2p-ipfs': 'libp2p-ipfs-browser', | ||
'node-forge': path.resolve( | ||
path.dirname(require.resolve('libp2p-crypto')), | ||
'../vendor/forge.bundle.js' | ||
) | ||
} | ||
}, | ||
externals: { | ||
mkdirp: '{}', | ||
glob: '{}', | ||
'simple-websocket-server': '{}' | ||
} | ||
karma: { | ||
files: [{ | ||
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*', | ||
watched: false, | ||
served: true, | ||
included: false | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,21 +5,31 @@ | |
"bin": { | ||
"jsipfs": "src/cli/bin.js" | ||
}, | ||
"main": "lib/core/index.js", | ||
"jsnext:main": "src/core/index.js", | ||
"main": "src/core/index.js", | ||
"browser": { | ||
"libp2p-ipfs": "libp2p-ipfs-browser", | ||
"./src/core/default-repo.js": "./src/core/default-repo-browser.js", | ||
"./src/core/components/init-assets.js": false, | ||
"./test/utils/temp-repo.js": "./test/utils/temp-repo-browser.js", | ||
"stream": "readable-stream" | ||
}, | ||
"engines": { | ||
"node": ">=4.0.0", | ||
"npm": ">=3.0.0" | ||
}, | ||
"scripts": { | ||
"lint": "aegir-lint", | ||
"coverage": "gulp coverage", | ||
"test": "PHANTOM=off gulp test", | ||
"test": "gulp test", | ||
"test:node": "gulp test:node", | ||
"test:node:core": "TEST=core npm run test:node", | ||
"test:node:http": "TEST=http npm run test:node", | ||
"test:node:cli": "TEST=cli npm run test:node", | ||
"test:browser": "PHANTOM=off gulp test:browser", | ||
"test:browser": "gulp test:browser", | ||
"build": "gulp build", | ||
"release": "PHANTOM=off gulp release", | ||
"release-minor": "PHANTOM=off gulp release --type minor", | ||
"release-major": "PHANTOM=off gulp release --type major", | ||
"release": "gulp release", | ||
"release-minor": "gulp release --type minor", | ||
"release-major": "gulp release --type major", | ||
"coverage-publish": "aegir-coverage publish" | ||
}, | ||
"pre-commit": [ | ||
|
@@ -40,17 +50,18 @@ | |
}, | ||
"homepage": "https://github.com/ipfs/js-ipfs#readme", | ||
"devDependencies": { | ||
"aegir": "^8.1.2", | ||
"aegir": "^9.1.1", | ||
"buffer-loader": "0.0.1", | ||
"chai": "^3.5.0", | ||
"detect-node": "^2.0.3", | ||
"execa": "^0.5.0", | ||
"expose-loader": "^0.7.1", | ||
"form-data": "^2.0.0", | ||
"form-data": "^2.1.2", | ||
"fs-pull-blob-store": "^0.4.1", | ||
"gulp": "^3.9.1", | ||
"interface-ipfs-core": "^0.16.6", | ||
"left-pad": "^1.1.1", | ||
"lodash": "^4.15.0", | ||
"interface-ipfs-core": "^0.18.4", | ||
"left-pad": "^1.1.3", | ||
"lodash": "^4.16.6", | ||
"ncp": "^2.0.0", | ||
"nexpect": "^0.5.0", | ||
"pre-commit": "^1.1.3", | ||
|
@@ -59,62 +70,57 @@ | |
"transform-loader": "^0.2.3" | ||
}, | ||
"dependencies": { | ||
"async": "^2.0.1", | ||
"babel-runtime": "^6.11.6", | ||
"async": "^2.1.2", | ||
"bl": "^1.1.2", | ||
"boom": "^4.0.0", | ||
"bs58": "^3.0.0", | ||
"debug": "^2.2.0", | ||
"detect-node": "^2.0.3", | ||
"boom": "^4.2.0", | ||
"debug": "^2.3.2", | ||
"fs-pull-blob-store": "^0.3.0", | ||
"glob": "^7.0.6", | ||
"glob": "^7.1.1", | ||
"hapi": "^15.2.0", | ||
"hapi-set-header": "^1.0.2", | ||
"idb-pull-blob-store": "^0.5.1", | ||
"ipfs-api": "^10.0.0", | ||
"ipfs-bitswap": "^0.7.0", | ||
"ipfs-block": "^0.4.0", | ||
"ipfs-block-service": "^0.6.0", | ||
"ipfs-api": "^11.1.0", | ||
"ipfs-bitswap": "^0.8.1", | ||
"ipfs-block": "^0.5.0", | ||
"ipfs-block-service": "^0.7.0", | ||
"ipfs-multipart": "^0.1.0", | ||
"ipfs-repo": "^0.10.0", | ||
"ipfs-unixfs": "^0.1.4", | ||
"ipfs-unixfs-engine": "^0.12.0", | ||
"ipld-resolver": "^0.1.1", | ||
"ipfs-repo": "^0.11.1", | ||
"ipfs-unixfs": "^0.1.5", | ||
"ipfs-unixfs-engine": "^0.13.0", | ||
"ipld-resolver": "^0.2.0", | ||
"isstream": "^0.1.2", | ||
"joi": "^9.0.4", | ||
"libp2p-ipfs": "^0.14.1", | ||
"libp2p-ipfs-browser": "^0.15.1", | ||
"joi": "^9.2.0", | ||
"libp2p-ipfs": "^0.15.0", | ||
"libp2p-ipfs-browser": "^0.16.0", | ||
"lodash.flatmap": "^4.5.0", | ||
"lodash.get": "^4.4.2", | ||
"lodash.has": "^4.5.2", | ||
"lodash.set": "^4.3.2", | ||
"lodash.sortby": "^4.7.0", | ||
"lodash.values": "^4.3.0", | ||
"mafmt": "^2.1.2", | ||
"map-limit": "0.0.1", | ||
"multiaddr": "^2.0.3", | ||
"multihashes": "^0.2.2", | ||
"path-exists": "^3.0.0", | ||
"peer-book": "^0.3.0", | ||
"peer-id": "^0.7.0", | ||
"peer-info": "^0.7.1", | ||
"promisify-es6": "^1.0.1", | ||
"peer-id": "^0.8.0", | ||
"peer-info": "^0.8.0", | ||
"promisify-es6": "^1.0.2", | ||
"pull-file": "^1.0.0", | ||
"pull-paramap": "^1.1.6", | ||
"pull-paramap": "^1.2.1", | ||
"pull-pushable": "^2.0.1", | ||
"pull-sort": "^1.0.0", | ||
"pull-stream": "^3.4.5", | ||
"pull-stream": "^3.5.0", | ||
"pull-stream-to-stream": "^1.3.3", | ||
"pull-zip": "^2.0.0", | ||
"read-pkg-up": "^1.0.1", | ||
"run-parallel": "^1.1.6", | ||
"run-parallel-limit": "^1.0.3", | ||
"run-series": "^1.1.4", | ||
"run-waterfall": "^1.1.3", | ||
"stream-to-pull-stream": "^1.7.0", | ||
"pull-zip": "^2.0.1", | ||
"read-pkg-up": "^2.0.0", | ||
"readable-stream": "^1.1.14", | ||
"stream-to-pull-stream": "^1.7.2", | ||
"tar-stream": "^1.5.2", | ||
"temp": "^0.8.3", | ||
"through2": "^2.0.1", | ||
"update-notifier": "^1.0.2", | ||
"yargs": "^6.0.0" | ||
"yargs": "^6.3.0" | ||
}, | ||
"contributors": [ | ||
"Andrew de Andrade <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use strict' | ||
|
||
const utils = require('../../utils') | ||
const bs58 = require('bs58') | ||
const mh = require('multihashes') | ||
const debug = require('debug') | ||
const log = debug('cli:block') | ||
log.error = debug('cli:block:error') | ||
|
@@ -24,9 +24,7 @@ module.exports = { | |
throw new Error('rm block with daemon running is not yet implemented') | ||
} | ||
|
||
const mh = new Buffer(bs58.decode(argv.key)) | ||
|
||
ipfs.block.del(mh, (err) => { | ||
ipfs.block.del(mh.fromB58String(argv.key), (err) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. block.del should support multihash as strings There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's exactly what I'm doing here, decoding the multihash from a string |
||
if (err) { | ||
throw err | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
'use strict' | ||
|
||
const waterfall = require('async/waterfall') | ||
const utils = require('../../utils') | ||
const debug = require('debug') | ||
const log = debug('cli:object') | ||
|
@@ -13,23 +14,16 @@ module.exports = { | |
builder: {}, | ||
|
||
handler (argv) { | ||
utils.getIPFS((err, ipfs) => { | ||
waterfall([ | ||
(cb) => utils.getIPFS(cb), | ||
(ipfs, cb) => ipfs.object.new(cb), | ||
(node, cb) => node.toJSON(cb) | ||
], (err, node) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/node/nodeJSON |
||
if (err) { | ||
throw err | ||
} | ||
|
||
ipfs.object.new((err, node) => { | ||
if (err) { | ||
throw err | ||
} | ||
|
||
node.toJSON((err, nodeJSON) => { | ||
if (err) { | ||
throw err | ||
} | ||
console.log(nodeJSON.Hash) | ||
}) | ||
}) | ||
console.log(node.Hash) | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, does this still apply? we have standardised the block API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, tests will fail otherwise