λ ipfsecret get QmfSi8rg7ismstGwDKoEwKySCr8Ptt7XHV1xMkB27DAARv
Passphrase?
λ ls ipfsecret-decrypted-QmfSi8rg7ismstGwDKoEwKySCr8Ptt7XHV1xMkB27DAARv/node_modules/webcrypto-crypt/
CHANGES.md README.md bin examples lib test
LICENSE SIGNED.txt dist index.js package.json
Optionally run the relevant daemon using the --offline option for the duration of the tests. Tests assume the API settings present in lib/config.js.
λ npm run test
Web browsers
As part of the install process, IPFSecret adds a multihash for browser testing and extracts it to .examples/. The password will be justtesting and you can access it over the local web gateway using the same multihash.
Tested environments
OS
Environment
Version
Mac Sierra
Chrome
70.0.3538.110
Mac Sierra
Firefox
63.0.3
Mac Sierra
Node
v10.13.0
Mac Sierra
Safari
11.0.2
Help
Commands
λ ipfsecret --help
Usage: ipfsecret <command> [options]
Commands:
get Retrieve & decrypt encrypted files from IPFS
add Encrypt & add files to IPFS
list List known HTTPS gateways
Options:
--debug, -d Print debugging info to stderr [boolean] [default: false]
--api, -a Specify IPFS API configuration [string] [default: "/ip4/127.0.0.1/tcp/5001"]
--gateway, -g Use this HTTP(S) gateway when returning gateway address [string] [default: false]
--version, -v Display version and exit [boolean] [default: false]
--help Show help [boolean]
add
λ ipfsecret add -h
File or directory required
Usage: ipfsecret add [options] [file|dir]
Options:
--debug, -d Print debugging info to stderr [boolean] [default: false]
--api, -a Specify IPFS API configuration [string] [default: "/ip4/127.0.0.1/tcp/5001"]
--gateway, -g Use this HTTP(S) gateway when returning gateway address [string] [default: false]
--version, -v Display version and exit [boolean] [default: false]
--help Show help [boolean]
--web, -w Add web interface [boolean] [default: "false"]
--naked, -n With --web, return naked hash vs URL [boolean] [default: "false"]
--recursive, -r Add as directory, recursively [boolean] [default: "false"]
--hidden, -H When adding directory, include hidden files [boolean] [default: "false"]
get
λ ipfsecret get --help
Multihash required
Usage: ipfsecret get [multihash]
Options:
--debug, -d Print debugging info to stderr [boolean] [default: false]
--api, -a Specify IPFS API configuration [string] [default: "/ip4/127.0.0.1/tcp/5001"]
--gateway, -g Use this HTTP(S) gateway when returning gateway address [string] [default: false]
--version, -v Display version and exit [boolean] [default: false]
--help Show help [boolean]
--output, -o Path where output should be stored [string]
example of specifying output paths
λ ipfsecret get -o decrypted.md QmXCsAFuP7Jv2bePvcZEmHeygSHLYfVEB9rtkvhaKF5pL9
Passphrase?
λ head -n1 decrypted.md
* [Purpose](#purpose)
λ ipfsecret get -o decrypted-dir-test QmfSi8rg7ismstGwDKoEwKySCr8Ptt7XHV1xMkB27DAARv
Passphrase?
λ ls decrypted-dir-test/node_modules/webcrypto-crypt/
CHANGES.md README.md bin examples lib test
LICENSE SIGNED.txt dist index.js package.json
API
Please assume the following lines precede these examples:
Wraps ipfs.files.add to require a path to add to IPFS and a passphrase for encryption. Encrypts each file found along the path using webcrypto-crypt and appends the .wcrypt suffix before adding.
0 byte files are skipped during encryption. Symbolic links encountered are resolved and encrypted as separate files.
Other options
If the caller passes in an Object instead of passphrase, ipfsecret.add recognizes the following key:value pairs:
constoptions={directory: 'mydirname',// Use this wrapping dir, default 'ipfsecret'hidden: false,// Include hidden files. Default truepassphrase: 'justtesting',// Use value to encrypt, always requiredroot: true,// Return just multihash. Default falsesuffix: 'myfilesuffix',// Use this suffix, default 'wcrypt'wcrypt: {config:{crypto:tagLength:112}}// Pass options to webcrypto-crypt (see below)};
QmesGPZmiAgGhQSvEF7m7AdotmMygaPsJHvUH9STRjttwB
λ head -n1 QmesGPZmiAgGhQSvEF7m7AdotmMygaPsJHvUH9STRjttwB/test/add-index.js.wcrypt
WCRYPT00.01.125000112192SHA-256....
ipfsecret.get(hash, passphrase)
Wraps ipfs.files.get to require a multihash for retrieval and a passphrase for decryption. If passphrase is accepted, returns a promise that resolves to an object stream of decrypted file objects.
Any files encountered during an ipfsecret.get operation that could not be decrypted will not be retrieved.
Consider the following IPFS directory, encrypted with the passphrase, "学年別漢字配当表":
Wrote roboto-v16-latin-300.woff
Wrote roboto-v16-latin-300.woff2
Wrote roboto-v16-latin-300italic.woff
Wrote roboto-v16-latin-300italic.woff2
Wrote roboto-v16-latin-700.woff
Wrote roboto-v16-latin-700.woff2
Wrote roboto-v16-latin-700italic.woff
Wrote roboto-v16-latin-700italic.woff2
Wrote roboto-v16-latin-regular.woff
Wrote roboto-v16-latin-regular.woff2
λ ls roboto-v16-latin-*
roboto-v16-latin-300.woff roboto-v16-latin-300italic.woff roboto-v16-latin-700.woff roboto-v16-latin-700italic.woff roboto-v16-latin-regular.woff
roboto-v16-latin-300.woff2 roboto-v16-latin-300italic.woff2 roboto-v16-latin-700.woff2 roboto-v16-latin-700italic.woff2 roboto-v16-latin-regular.woff2
λ file roboto-v16-latin-300.woff
roboto-v16-latin-300.woff: Web Open Font Format, flavor 65536, length 18972, version 1.1
Other options
If the caller passes in an Object instead of a passphrase, ipfsecret.get recognizes the following key:value pairs:
请发表评论