{"id":14384510,"url":"https://github.com/shlemph/ipfsecret","last_synced_at":"2025-11-15T15:20:06.580Z","repository":{"id":38369252,"uuid":"174486155","full_name":"shlemph/ipfsecret","owner":"shlemph","description":"Encrypt and decrypt IPFS files with a secret passphrase.","archived":false,"fork":false,"pushed_at":"2022-12-07T05:44:41.000Z","size":708,"stargazers_count":26,"open_issues_count":7,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-10T13:37:20.090Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://c2fo-lab.github.io/ipfsecret/","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shlemph.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-08T07:02:20.000Z","updated_at":"2024-08-18T18:15:17.000Z","dependencies_parsed_at":"2023-01-24T10:31:03.755Z","dependency_job_id":null,"html_url":"https://github.com/shlemph/ipfsecret","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlemph%2Fipfsecret","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlemph%2Fipfsecret/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlemph%2Fipfsecret/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlemph%2Fipfsecret/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shlemph","download_url":"https://codeload.github.com/shlemph/ipfsecret/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230694377,"owners_count":18266058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-28T18:01:26.331Z","updated_at":"2025-11-15T15:20:06.492Z","avatar_url":"https://github.com/shlemph.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Tools"],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/ipfsecret.svg)]() [![license](https://img.shields.io/github/license/c2fo-lab/ipfsecret.svg)]() [![npm](https://img.shields.io/npm/dw/ipfsecret.svg)]() [![node](https://img.shields.io/node/v/ipfsecret.svg)]() [![GitHub last commit](https://img.shields.io/github/last-commit/c2fo-lab/ipfsecret.svg)]()\n\n  * [Introduction](#introduction)\n  * [Install](#install)\n  * [Quickstart](#quickstart)\n  * [Warnings](#warnings)\n  * [Testing](#testing)\n  * [API](#api)\n  * [Command-line web gateways](#command-line-web-gateways)\n  * [Implementation](#implementation)\n  * [Passphrase file](#passphrase-file)\n  * [Security](#security)\n  * [Troubleshooting](#troubleshooting)\n  * [Acknowledgements](#acknowledgements)\n  * [Todo](#todo)\n  * [See also](#see-also)\n\n# Introduction\n\nIPFSecret lets you encrypt and decrypt IPFS files with a secret passphrase.\n\nIf you are new to IPFS, there are guides for [getting started](https://ipfs.io/docs/getting-started/) and [running the daemon with the right port](https://github.com/ipfs/js-ipfs-api#running-the-daemon-with-the-right-port).\n\n# Install\n\n    λ npm install -g ipfsecret\n\n# Quickstart\n\n## Add a file\n\n    λ ipfsecret add README.md\n    Passphrase?\n    Confirm passphrase:\n    QmeVMn7oLoSC7ShLeLPu2tMrGq4TEr9icSxPbKxAF7CJ7Q\n\n## Get a file\n\n    λ ipfsecret get QmeVMn7oLoSC7ShLeLPu2tMrGq4TEr9icSxPbKxAF7CJ7Q\n    Passphrase?\n    λ head -n1 ipfsecret-decrypted-QmeVMn7oLoSC7ShLeLPu2tMrGq4TEr9icSxPbKxAF7CJ7Q\n    * [Introduction](#introduction)\n    λ\n\n## Add a directory\n\n    λ ipfsecret add -r node_modules/webcrypto-crypt\n    Passphrase?\n    Confirm passphrase:\n    QmfSi8rg7ismstGwDKoEwKySCr8Ptt7XHV1xMkB27DAARv\n\n## Get a directory\n\n    λ ipfsecret get QmfSi8rg7ismstGwDKoEwKySCr8Ptt7XHV1xMkB27DAARv\n    Passphrase?\n    λ ls ipfsecret-decrypted-QmfSi8rg7ismstGwDKoEwKySCr8Ptt7XHV1xMkB27DAARv/node_modules/webcrypto-crypt/\n    CHANGES.md      README.md       bin             examples        lib             test\n    LICENSE         SIGNED.txt      dist            index.js        package.json\n\n## Add a file, include web interface\n\n    λ ipfsecret add -w README.md\n    Passphrase?\n    Confirm passphrase:\n    http://127.0.0.1:8080/ipfs/QmNndRMk9sQzYGmszosGCYUiDm9WBKGy512bLZNoxcAcPm/ipfsecret.html\n\n## Add a directory, include web interface\n\n    λ ipfsecret add -wr node_modules/webcrypto-crypt\n    Passphrase?\n    Confirm passphrase:\n    http://127.0.0.1:8080/ipfs/QmWCGgmQdT1xNd44kUwEqY61aX551kRMwrXdvBPBGA1Qto/ipfsecret.html\n\n# Warnings\n\n* File contents added via IPFSecret are encrypted but file and directory names are stored in clear text.\n* There are [problems with symmetric algorithms](http://web.archive.org/web/20150916184759/http://www.informit.com/articles/article.aspx?p=102212).\n* Depending on [pinning](https://discuss.ipfs.io/t/replication-on-ipfs-or-the-backing-up-content-model/372/2) activity, your encrypted data could be distributed to many nodes across the IPFS network.\n* Entities with access to your IPFSecret multihashes that then guess, learn, or crack the relevant passphrase will be able to decrypt your data.\n* Unknown bugs in this code or its dependency tree (e.g., the [webcrypto-crypt](https://c2fo-lab.github.io/webcrypto-crypt) package) could render encryption ineffective.\n* Downloading large files over IPFS web gateways can be slow and in the case of decryption there is currently no feedback on download progress.\n* [Private Networks](https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#private-networks), [public-key cryptography](https://en.wikipedia.org/wiki/Public-key_cryptography) tools, or something like [FileNation](https://filenation.io/) or [Firefox Send](https://send.firefox.com/) may better fit your needs.\n\n# Testing\n\n## Node.js\n\nOptionally run the relevant daemon using the [```--offline```](https://github.com/ipfs/go-ipfs/pull/2696#issuecomment-242664950) option for the duration of the tests.  Tests assume the API settings present in [```lib/config.js```](https://github.com/c2fo-lab/ipfsecret/blob/master/lib/config.json#L79-L83).\n\n    λ npm run test\n\n## Web browsers\n\nAs 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.\n\n## Tested environments\n\n| **OS** | **Environment** | **Version** |\n| :-------- | :------- | :------- |\n| Mac Sierra | Chrome  |  70.0.3538.110  |\n| Mac Sierra | Firefox  | 63.0.3  |\n| Mac Sierra | Node  | v10.13.0 |\n| Mac Sierra | Safari | 11.0.2 |\n\n### Help\n\n#### Commands\n\n    λ ipfsecret --help\n    Usage: ipfsecret \u003ccommand\u003e [options]\n\n    Commands:\n      get   Retrieve \u0026 decrypt encrypted files from IPFS\n      add   Encrypt \u0026 add files to IPFS\n      list  List known HTTPS gateways\n\n    Options:\n      --debug, -d    Print debugging info to stderr  [boolean] [default: false]\n      --api, -a      Specify IPFS API configuration  [string] [default: \"/ip4/127.0.0.1/tcp/5001\"]\n      --gateway, -g  Use this HTTP(S) gateway when returning gateway address  [string] [default: false]\n      --version, -v  Display version and exit  [boolean] [default: false]\n      --help         Show help  [boolean]\n\n##### add\n\n    λ ipfsecret add -h\n    File or directory required\n    Usage: ipfsecret add [options] [file|dir]\n\n    Options:\n      --debug, -d      Print debugging info to stderr  [boolean] [default: false]\n      --api, -a        Specify IPFS API configuration  [string] [default: \"/ip4/127.0.0.1/tcp/5001\"]\n      --gateway, -g    Use this HTTP(S) gateway when returning gateway address  [string] [default: false]\n      --version, -v    Display version and exit  [boolean] [default: false]\n      --help           Show help  [boolean]\n      --web, -w        Add web interface  [boolean] [default: \"false\"]\n      --naked, -n      With --web, return naked hash vs URL  [boolean] [default: \"false\"] \n      --recursive, -r  Add as directory, recursively  [boolean] [default: \"false\"]\n      --hidden, -H     When adding directory, include hidden files  [boolean] [default: \"false\"]\n\n##### get\n\n    λ ipfsecret get --help\n    Multihash required\n    Usage: ipfsecret get [multihash]\n\n    Options:\n      --debug, -d    Print debugging info to stderr  [boolean] [default: false]\n      --api, -a      Specify IPFS API configuration  [string] [default: \"/ip4/127.0.0.1/tcp/5001\"]\n      --gateway, -g  Use this HTTP(S) gateway when returning gateway address  [string] [default: false]\n      --version, -v  Display version and exit  [boolean] [default: false]\n      --help         Show help  [boolean]\n      --output, -o   Path where output should be stored  [string]\n\n#### example of specifying output paths\n\n    λ ipfsecret get -o decrypted.md QmXCsAFuP7Jv2bePvcZEmHeygSHLYfVEB9rtkvhaKF5pL9\n    Passphrase?\n    λ head -n1 decrypted.md\n    * [Purpose](#purpose)\n\n    λ ipfsecret get -o decrypted-dir-test QmfSi8rg7ismstGwDKoEwKySCr8Ptt7XHV1xMkB27DAARv\n    Passphrase?\n    λ ls decrypted-dir-test/node_modules/webcrypto-crypt/\n    CHANGES.md      README.md       bin             examples        lib             test\n    LICENSE         SIGNED.txt      dist            index.js        package.json\n\n# API\n\nPlease assume the following lines precede these examples:\n\n```javascript\nconst IPFSecret = require('ipfsecret'),\n    ipfsecret = new IPFSecret();\n```\n\n## ipfsecret.add(path, passphrase)\n\nWraps [ipfs.files.add](https://github.com/ipfs/interface-ipfs-core/tree/master/API/files) to require a ```path``` to add to IPFS and a ```passphrase``` for encryption.  Encrypts each file found along the path using [webcrypto-crypt](https://c2fo-lab.github.io/webcrypto-crypt) and appends the ```.wcrypt``` suffix before adding.\n\n### Add file\n\n```javascript\nipfsecret.add('./README.md', 'justtesting')\n    .then(results =\u003e {\n        console.log(results);\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\nExample:\n\n    [ { path: 'README.md.wcrypt',\n      hash: 'QmcrMFv4f4yef5EpdM9mUTGiE4msi2VKLmTPbGenRaiKLd',\n      size: 20871 } ]\n\n### Add directory\n\n```javascript\nipfsecret.add('./test', 'justtesting')\n    .then(results =\u003e {\n        console.log(results);\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\nExample:\n\n    [ { path: 'ipfsecret/test/add-indexed.js.wcrypt',\n        hash: 'QmPm5MGHooEiDuiJjDg5dFRvaNgyTNYuM7Lx4gqj5k77cB',\n        size: 8013 },\n      { path: 'ipfsecret/test/add.js.wcrypt',\n        hash: 'Qmcdj2aRshwSkVnEUSAANcHEmbyjb1tnt9Cg5Ubh2bxvav',\n        size: 6900 },\n      { path: 'ipfsecret/test/get.js.wcrypt',\n        hash: 'QmXYeFbCBL8vgYKsvy4K98kYNvqDHMXVeEogR6zQzdedg7',\n        size: 5322 }...\n\n0 byte files are skipped during encryption.  Symbolic links encountered are resolved and encrypted as separate files.\n\n### Other options\n\nIf the caller passes in an Object instead of ```passphrase```, ```ipfsecret.add``` recognizes the following key:value pairs:\n\n```javascript\n  const options = {\n      directory: 'mydirname',                 // Use this wrapping dir, default 'ipfsecret'\n      hidden: false,                          // Include hidden files.  Default true\n      passphrase: 'justtesting',              // Use value to encrypt, always required\n      root: true,                             // Return just multihash.  Default false\n      suffix: 'myfilesuffix',                 // Use this suffix, default 'wcrypt'\n      wcrypt: {config:{crypto:tagLength:112}} // Pass options to webcrypto-crypt (see below)\n  };\n```\n\n#### Root multihash only\n\nThe multihash is returned as a [Buffer](https://nodejs.org/api/buffer.html):\n\n```javascript\nconst bs58 = require('bs58');\n\nipfsecret.add('./test', {passphrase:'justtesting', root:true})\n    .then(hash =\u003e {\n        console.log(bs58.encode(hash));\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\nExample:\n\n    Qmf22oxRTsz6CPWf2xDZeF729xdBx7ULDQsdtqpXYh8UKV\n\n#### Custom file suffix\n\n```javascript\nipfsecret.add('./test', {passphrase:'justtesting', suffix: 'shazam'})\n    .then(results =\u003e {\n        console.log(results);\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\nExample:\n\n    [ { path: 'ipfsecret/test/add-indexed.js.shazam',\n        hash: 'QmY4EWxfvBVAUVzpbB7wXhktWLFwE4xunx1jiFbpiNWiKM',\n        size: 8013 },\n      { path: 'ipfsecret/test/add.js.shazam',\n        hash: 'QmRGKq3VHsuX4kyerYE1atNBC7wCu2gRpmxXqocKdXTQsT',\n        size: 6900 },\n      { path: 'ipfsecret/test/get.js.shazam',\n        hash: 'QmRU2qKJBScmedhcDgGGPCvtpWVnasQEJdkF9UvVEM9L7N',\n        size: 5322 },...\n    \n#### Custom wrapping dir\n\n```javascript\nipfsecret.add('./test', {passphrase:'justtesting', directory:'shazam'})\n    .then(results =\u003e {\n        console.log(results);\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\nExample:\n\n    [ { path: 'shazam/test/add-indexed.js.wcrypt',\n        hash: 'QmTWSp9uyPG2DuxFuw3XBhuqJd7cq4zemz4iJqxMw6693r',\n        size: 8013 },\n      { path: 'shazam/test/add.js.wcrypt',\n        hash: 'QmXC348Z6PZGUCSz4tMGaRuhcQ7cgiAxhD8h4gbqhCoAEn',\n        size: 6900 },\n      { path: 'shazam/test/get.js.wcrypt',\n        hash: 'QmcU8eu2fWFfUsM1SkKq8zSrmDa9hWB6hze6yVzNtDKE2G',\n        size: 5322 }...\n\n#### Custom cryptography settings\n\nTo pass custom settings to [webcrypto-crypt](https://c2fo-lab.github.io/webcrypto-crypt), use the ```wcrypt``` options attribute:\n\n```javascript\nipfsecret.add('./test', {\n    passphrase:'justtesting',\n    root: true,\n    wcrypt: {\n        config: {\n            crypto: {\n                tagLength: 112\n            },\n            derive: {\n                hash: 'SHA-256',\n                length: 192,\n                iterations: 5000\n            },\n            paranoid: true\n        }\n    }\n})\n    .then(hash =\u003e {\n        console.log(hash);\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\n    QmesGPZmiAgGhQSvEF7m7AdotmMygaPsJHvUH9STRjttwB\n    λ head -n1 QmesGPZmiAgGhQSvEF7m7AdotmMygaPsJHvUH9STRjttwB/test/add-index.js.wcrypt\n    WCRYPT00.01.125000112192SHA-256....\n\n## ipfsecret.get(hash, passphrase)\n\nWraps [ipfs.files.get](https://github.com/ipfs/interface-ipfs-core/tree/master/API/files) 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.\n\nAny files encountered during an ```ipfsecret.get``` operation that could not be decrypted will not be retrieved.\n\nConsider the following IPFS directory, encrypted with the passphrase, \"学年別漢字配当表\":\n\n    λ ipfs ls QmZdNHJpzvTYqS3ba6EW4tryGaaEjHYyqY4ji6jZGK6Les/assets/fonts\n    QmX6KnVkx6L3uXsLcTfi5d8SUwc4F1DLTEMeYgeRWYscoc 34016 roboto-v16-latin-300.woff.wcrypt\n    QmYWKumL3aj54gRyG11dLRKp9eon9kCZzDM4MDMdzg7nQg 26475 roboto-v16-latin-300.woff2.wcrypt\n    QmXAVPjgS2FiCpGXz7pA5Prh5WjHJtan1H1L7PSNNZLMCz 37008 roboto-v16-latin-300italic.woff.wcrypt\n    QmaX7JAakBrgw5GAaMSuqxGyyntQsmxHc3jHLDDuuMsxSt 29439 roboto-v16-latin-300italic.woff2.wcrypt\n    QmPPoCqdCCxNEqyPJmsEqasDUes9uP49UAzyJ6S4JVEnJb 34001 roboto-v16-latin-700.woff.wcrypt\n    QmeFr49dWjcRJm9LM6vzfVEHZaZB8JwbgA5fXkq68vL4gn 26494 roboto-v16-latin-700.woff2.wcrypt\n    QmSsuY2teXgFRk5dXx4P2CBe4VG4QmmjJsAXVMRofpKmvP 35974 roboto-v16-latin-700italic.woff.wcrypt\n    Qmb3LegLP2kNLmvjUPsWkt82mVPX9BVGCbgTajj5KidrRG 28344 roboto-v16-latin-700italic.woff2.wcrypt\n    QmU5ehUCXbbMcoEDHgdp55T51kqi1X1Qjh3VeeZAz94xdN 33648 roboto-v16-latin-regular.woff.wcrypt\n    QmUWp3DJNujDFXvQaxdR8qm3ueYnGd6tnnsHuVP4qmiQVL 26516 roboto-v16-latin-regular.woff2.wcrypt\n    λ\n\n```javascript\nconst fs = require('fs'),\n    path = require('path'),\n    hash = 'QmZdNHJpzvTYqS3ba6EW4tryGaaEjHYyqY4ji6jZGK6Les';\n\nipfsecret.get(hash, '学年別漢字配当表')\n    .then((stream) =\u003e {stream.on('data', (obj) =\u003e {\n        if (obj.content) {\n            var filename = path.basename(obj.path),\n                writeable = fs.createWriteStream(filename);\n            obj.content.pipe(writeable);\n            obj.content.on('finish', () =\u003e {\n                console.log('Wrote ' + filename);\n            });\n            obj.content.on('error', (err) =\u003e {\n                console.error('Error: ' + err);\n            });\n        }\n    });})\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\nExample:\n\n    Wrote roboto-v16-latin-300.woff\n    Wrote roboto-v16-latin-300.woff2\n    Wrote roboto-v16-latin-300italic.woff\n    Wrote roboto-v16-latin-300italic.woff2\n    Wrote roboto-v16-latin-700.woff\n    Wrote roboto-v16-latin-700.woff2\n    Wrote roboto-v16-latin-700italic.woff\n    Wrote roboto-v16-latin-700italic.woff2\n    Wrote roboto-v16-latin-regular.woff\n    Wrote roboto-v16-latin-regular.woff2\n    λ ls roboto-v16-latin-*\n    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\n    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\n    λ file roboto-v16-latin-300.woff\n    roboto-v16-latin-300.woff: Web Open Font Format, flavor 65536, length 18972, version 1.1\n\n### Other options\n\nIf the caller passes in an Object instead of a passphrase, ```ipfsecret.get``` recognizes the following key:value pairs:\n\n```javascript\nconst options = {\n    passphrase: 'justtesting',               // Use value to encrypt data, always required\n    wcrypt: {config:{crypto:tagLength:112}} // Pass options to cryptography package\n};\n```\n\n## ipfsecret.addIndexed(path, passphrase)\n\nOtherwise identical to ```ipfsecret.add```, ```ipfsecret.addIndexed``` adds HTML, JavaScript, CSS, and fonts that together provide a browser interface for listing and decrypting ipfsecret-encrypted files.  This is an alias for ```ipfsecret.add(path, {passphrase: p, indexed: true}```.\n\n### Add directory and include browser interface files\n\n```javascript\nipfsecret.addIndexed('./test', 'justtesting')\n    .then(results =\u003e {\n        console.log(results);\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\nExample:\n\n    [ { path: 'ipfsecret/ipfsecret/styles/normalize.css',\n        hash: 'QmbfTL2ZsgZzhH5Cz6pcnChUkrDsozHnjnqSfYAbCex7W2',\n        size: 7730 },\n      { path: 'ipfsecret/ipfsecret/styles/fonts.css',\n        hash: 'Qmc8XfJ4w1LjV6uK4q2ENzREdTELLpnGWdoKfnjkXHH1Vm',\n        size: 1992 },\n      { path: 'ipfsecret/ipfsecret/styles/milligram.css',\n        hash: 'QmaFP6KqC1LrkBadFcxgqSKnxqhjByiALpjSeAoYtzMDth',\n        size: 8729 },\n      { path: 'ipfsecret/ipfsecret/js/ipfsecret.js',\n        hash: 'QmTWa8Hx5G5M72xb3A3bbdmkvvpSM8UZ5ct8oqLZSgRfYn',\n        size: 76326 },\n      { path: 'ipfsecret/ipfsecret/fonts/roboto-v16-latin-300.woff',\n        hash: 'QmVeWJjZaoXLitapfpDHVWxm7BwqqiT6FfeVdDHxMCkCXn',\n        size: 18986 },\n      { path: 'ipfsecret/ipfsecret/fonts/roboto-v16-latin-300.woff2',\n        hash: 'QmNuucbg8ojSkDvN2x4HJBjiLqN9vdcKz5VPee6RroASgX',\n        size: 14707 },\n      ...\n\n### Other options\n\n#### Content overrides\n\nIn addition to all the options supported by ```ipfsecret.add```, you may override ```ipfsecret.addIndexed```'s CSS, font directory, and JavaScript build by passing in overriding options:\n\n```javascript\nipfsecret.addIndexed('./test', {\n    baseCss: './myBase.css',\n    dialogCss: './myDialog.css',\n    fontCss: './myFonts.css',\n    mainCss: './myStyles.css',\n    mapCss: './myStyles.css.map',\n    fontsDir: './myFontsDirectory',\n    jsPath: './myJavaScriptBuild.js',\n    passphrase: 'justtesting',\n})\n    .then(results =\u003e {\n        console.log(results);\n    })\n    .catch(err =\u003e {\n        console.error(err);\n    });\n```\n\n## ipfsecret.getGatewayList()\n\nReturn an array of currently known HTTP/S gateways; used by the command-line utility.\n\n```javascript\nconsole.log(ipfsecret.getGatewayList());\n```\n\n    [ 'https://gateway.ipfs.io',\n      'https://earth.i.ipfs.io',\n      'https://mercury.i.ipfs.io',\n      'https://gateway.ipfsstore.it:8443',\n      'https://scrappy.i.ipfs.io',\n      'https://chappy.i.ipfs.io' ]\n\n## IPFSecret.DEBUG = true | false\n\nIf set to ```true```, send debugging statements to stderr.  Default ```false```.\n\n## IPFSecret.version\n\nReturns the current version of this library, e.g., ```0.1.2```.\n\n## Custom API endpoint\n\nWhen instantiating a new IPFSecret object, you may optionally pass in ```options``` to override the default IPFS connection parameters:\n\n```javascript\n    const ipfsecret = new IPFSecret({\n        host: '192.168.1.233',  // default 'localhost'\n        port: 5002,             // default 5001\n        proto: 'http'           // default 'http'\n    });\n```\n\n# Command-line web gateways\n\n## List known web gateways\n\n    λ ipfsecret list\n    0 - https://cloudflare-ipfs.com\n    1 - https://gateway.ipfs.io\n    2 - https://gateway.pinata.cloud\n    3 - https://ipfs.eternum.io\n    4 - https://ipfs.infura.io\n    5 - https://ipfs.io\n    6 - https://ipfs.jes.xxx\n    7 - https://ipfs.mle.party\n    8 - https://siderus.io\n    9 - https://xmine128.tk\n\n## Specify a web gateway (instead of localhost) when outputting result\n\n    λ ipfsecret add -g3 -wr node_modules/webcrypto-crypt/\n    Passphrase?\n    Confirm passphrase:\n    https://gateway.ipfsstore.it:8443/ipfs/QmWqwUpf4jBdTb8BRxaLUvPQj3JMUtMQe1Kxo2sm3noHE7/ipfsecret.html\n\n## Specify a custom gateway when outputting hash\n\n    λ ipfsecret add -g \"https://mygateway.io:8088\" -wr node_modules/webcrypto-crypt/\n    Passphrase?\n    Confirm passphrase:\n    https://mygateway.io:8088/ipfs/QmYYoHfaAcvkRQy6bubTChkXPi2c9d1r6vBatWeRXMr7p5/ipfsecret.htmlλ\n\n# Implementation\n\n## Cryptography\n\nIPFSecret's encryption depends on WebCrypto's [SubtleCrypto](https://www.w3.org/TR/WebCryptoAPI/#subtlecrypto-interface) interface, specifically the algorithms [PBKDF2](https://www.w3.org/TR/WebCryptoAPI/#pbkdf2) and [AES-GCM](https://www.w3.org/TR/WebCryptoAPI/#aes-gcm). It then marshals the encrypted chunks into IPFS objects and adds these to IPFS as new files.  Decryption is carried out via the same SubtleCrypto interface, with the caller supplying the correct passphrase along with the relevant multihash to decrypt the files as they are retrieved.  See [webcrypto-crypt](https://c2fo-lab.github.io/webcrypto-crypt) for more information.\n\nDecrypting IPFS files in the web browser is currently supported but encrypting in the browser is not supported.\n\n## Web browsers\n\n### HTML page\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://pix.toile-libre.org/upload/original/1510603116.png\"\u003e\u003cimg width=\"50%\" height=\"50%\" src=\"http://pix.toile-libre.org/upload/original/1510603116.png\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nBy default, IPFSecret publishes the index using the filename ```ipfsecret.html```.  This can be overridden to specify any filename but be aware ```index.html``` [has special meaning](https://github.com/ipfs/ipfs/issues/167#issuecomment-329969289) for IPFS gateways.\n\n### Markup and styling\n\nWhen calling ```addIndexed()``` from JavaScript or specifying the ```--web``` argument to the ```ipfsecret``` command-line utility, IPFSecret will generate unencrypted HTML pages that contain a directory listing and buttons to decrypt any file by providing the passphrase.  The HTML is currently styled using [Milligram](http://milligram.io/) but as noted in the [Content overrides](#content-overrides) section, you may also specify your own CSS and accompanying fonts.\n\n### Decryption\n\nIPFSecret currently accesses encrypted IPFS files from the web browser as [Blobs](https://developer.mozilla.org/en-US/docs/Web/API/Blob) and decrypts them via [webcrypto-crypt](https://c2fo-lab.github.io/webcrypto-crypt).\n\n### Decrypted file size limits\n\n[Filesaver.js documentation](https://github.com/eligrey/FileSaver.js/#supported-browsers) shows the download size limits of the various browsers.  If IPFSecret detects that an encrypted file is larger than the current browser's limit, instead of decrypting it will display a message suggesting other options.  Encrypted files can always be downloaded from the gateway and later decrypted using Node.js or the command-line.\n\n### Encrypted file modified times\n\nThe ```Date modified``` field populated in the web interface reflects the modified time of the original, unencrypted file, versus the time that the encrypted version was created.\n\n### Long download times \u0026 decryption times\n\nIPFSecret currently relies on the browser's [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to access files as blobs, and there is currently no support in the API for showing download progress.  In the case of accessing large files over slow IPFS web gateways, you may end up waiting a good while for the encrypted file to download before decryption can begin, without knowing how much longer the download will take to complete.  Decryption in the browser can also be slow, particularly with blobs approaching 500MB or more.  There is currently a [Todo](#todo) item to migrate these operations to the [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) which may improve performance in future releases.\n\n### Offline mode\n\nIPFSecret web pages try to detect whether or not the current browser is connected to the internet and, if not connected, attempt to redirect to the local IPFS HTTP gateway.  Decryption should work in the browser whether or not the user is connected to the internet, provided the multihashes in question are locally accessible.\n\n# Passphrase file\n\nSee [.wcryptpass](https://c2fo-lab.github.io/webcrypto-crypt#wcryptpass)\n\n# Security\n\nSecurity Mail: labs@c2fo.com\u003cbr\u003e\nPGP key fingerprint: [````E838 B51C C63F 7ED6 0980 9535 4D46 5218 A674 6F81````](https://pgp.mit.edu/pks/lookup?search=0xE838B51CC63F7ED6098095354D465218A6746F81)\u003cbr\u003e\nKeyserver: [pgp.mit.edu](https://pgp.mit.edu)\u003cbr\u003e\n\n# Troubleshooting\n\nIPFSecret is not fast.  For large directories and files, you may just need to wait it out...\n\n    λ osxinfo\n    User      : alfonz\n    Time:     : Sun Nov 12 13:54:49 2017\n    Model     : MacBookPro10,1\n    Processor : Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz\n    OS        : Darwin\n    Release   : 16.7.0\n    Disk      : 80.10% of 249.78 GB\n    Memory    : 10254 MB of 17180 MB\n    Shell     : /bin/bash\n    Terminal  : screen\n    Memory    : 10254 MB of 17180 MB\n    Graphics  : Intel HD Graphics 4000 @ 1536 MB\n    Graphics  : NVIDIA GeForce GT 650M @ 1024 MB\n    Packages  : no packages found\n    Uptime    : 1 day 04:37\n\n    λ ipfs --version\n    ipfs version 0.4.11\n\n    λ ipfs init\n    ...\n\n    λ ipfs daemon --offline \u0026\n    [1] 12178\n    λ Initializing daemon...\n    Swarm not listening, running in offline mode.\n    API server listening on /ip4/127.0.0.1/tcp/5001\n    Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080\n    Daemon is ready\n\n    λ git log | head -n4 \u0026\u0026 du -sh\n    commit bebc6082da0a9f5d47a1ea2edc099bf671058bd4\n    Author: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n    Date:   Sun Nov 12 10:46:13 2017 -0800\n\n    2.9G    .\n\n    λ time ipfsecret add -wrH .\n    Passphrase?\n    Confirm passphrase:\n    http://127.0.0.1:8080/ipfs/QmdScWuXY97CDsqUpxCgF6RjtYnu8qzf66EaWpTdZNfvdN/ipfsecret.html\n    real    4m32.701s\n    user    3m53.192s\n    sys     0m20.093s\n    λ\n\n    λ cd ..\n    λ time ipfsecret -o decrypted-linux get QmdScWuXY97CDsqUpxCgF6RjtYnu8qzf66EaWpTdZNfvdN\n    Passphrase?\n\n    real    3m27.587s\n    user    7m20.771s\n    sys     0m29.577s\n\n    λ du -sh decrypted-linux\n    2.9G    decrypted-linux\n\n    λ diff -Nur ./decrypted-linux ./linux\n    λ # but some 0 byte files and empty dirs will cause differences (diff -r)\n\n    λ ls -lh ubuntu.vdi\n    -rw-------  1 alfonz  staff   2.7G Jul 27 19:06 ubuntu.vdi\n\n    λ time ipfsecret add ubuntu.vdi\n    Passphrase?\n    Confirm passphrase:\n    Qmd4tq3Q7PVzNcfDojdx7koRsEfVMnitvAFSR4EDhirUUj\n    real    0m47.569s\n    user    0m27.784s\n    sys     0m6.920s\n\n    λ time ipfsecret get -o ubuntu.vdi.decrypted Qmd4tq3Q7PVzNcfDojdx7koRsEfVMnitvAFSR4EDhirUUj\n    Passphrase?\n\n    real    2m10.282s\n    user    2m4.236s\n    sys     0m10.424s\n\n    λ diff ubuntu.vdi.decrypted ubuntu.vdi\n    λ\n\n## Timeouts\n\nYou may encounter timeouts after connecting to the API server.  In these cases you can try adding the content again:\n\n    λ ipfsecret add -wr linux/\n    Passphrase?\n    Confirm passphrase:\n    { Error: connect ETIMEDOUT 127.0.0.1:5001\n        at Object._errnoException (util.js:1041:11)\n        at _exceptionWithHostPort (util.js:1064:20)\n        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1153:14)\n      code: 'ETIMEDOUT',\n      errno: 'ETIMEDOUT',\n      syscall: 'connect',\n      address: '127.0.0.1',\n      port: 5001 }\n    λ ipfsecret add -wr linux/\n    Passphrase?\n    Confirm passphrase:\n    http://localhost:8080/ipfs/Qma7w6RchCgv7E8yqeqeU9viPE97RGMuih8yvE2NL4555q/ipfsecret.htmlλ\n\n## File signature warnings\n\nWhen decrypting directories that contain the web user interface, the unencrypted web interface files may trigger this warning:\n\n    Error: Error: Invalid file signature webcrypto-crypt0.1.15\n\n## Invalid index entries\n\nDirectories that contained no files or contained only 0-byte files will currently result in invalid links in the HTML indices.\n\n## Out of memory\n\nIf you hand ```ipfsecret add``` a very large directory, you may encounter a fatal error like:\n\n    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory\n\nIn these cases you might consider writing several directories as separate operations.\n\n# Acknowledgements\n\n* Decryption via WebCrypto in the browser uses a modified version of the [binary-split](https://github.com/maxogden/binary-split) function.\n* Modal box implementation from [modalbox](https://github.com/CristianDeveloper/modalbox).\n\n# Todo\n\n* Add automated tests for browser-based decryption.\n* Fix UI navigation when user specifies ```.``` or ```../../../```, etc .\n* Start ```ipfs --daemon``` if it's not already running for duration of tests.\n* Support embed and decrypt Base64 and hexadecimal encoded data in HTML files.\n* Support streaming decryption through the forthcoming [Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API).\n* Rewrite install.sh in node for portability\n* Test on Win and Linux.\n* Support [progress bar on the command line](https://github.com/ipfs/js-ipfs/pull/1036).\n\n# See also\n\n* [IPFS](https://ipfs.io/)\n* [webcrypto-crypt](https://c2fo-lab.github.io/webcrypto-crypt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshlemph%2Fipfsecret","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshlemph%2Fipfsecret","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshlemph%2Fipfsecret/lists"}