Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whs/ipfs-encrypted-share
IPFS Encrypted Share
https://github.com/whs/ipfs-encrypted-share
ipfs
Last synced: 21 days ago
JSON representation
IPFS Encrypted Share
- Host: GitHub
- URL: https://github.com/whs/ipfs-encrypted-share
- Owner: whs
- License: mit
- Created: 2018-07-22T15:31:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-12T03:34:55.000Z (over 6 years ago)
- Last Synced: 2024-12-10T13:02:38.751Z (30 days ago)
- Topics: ipfs
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 23
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IPFS Encrypted Share
Current version: [1.0.0](https://ipfs.io/ipfs/QmYQLkWNYwXmqjTaP15kbfwzPGWEcBejAfAJMnmKmXwLFZ/)
Encrypted file uploader for IPFS, similar to [Mega](https://mega.co.nz/)
## Security
This use libsodium, so it should be quite safe to use. However, I'm not a cryptography expert and this code is not audited, so use it at your own risk.
## Technical details
### Encryption
Files are encrypted with [libsodium stream encryption](https://download.libsodium.org/doc/secret-key_cryptography/secretstream.html). The encryption key are randomly generated every time and stored as urlsafe unpadded base64 in URL fragment (not transmitted to gateway or IPFS).
### Metadata
File metadata is stored at /metadata.json. It contains 2 keys:
- **header**: Stream header (from `crypto_secretstream_xchacha20poly1305_init_push`), base64 encoded without padding.
- **encryptedMetadata**: Encrypted metadata, base64 encoded without padding.The encrypted metadata is the first message in the stream. It is a JSON with the following keys:
- **filename**: Original filename
- **size**: File size in bytes
- **pieces**: Number of file piecesThis message has the tag `crypto_secretstream_xchacha20poly1305_TAG_FINAL`.
### File pieces
The file are splitted to pieces, each 5MB in size. (limited by libsodium.js heap size) They are encrypted and stored at /pieces/`chunkId`. ChunkID starts at 0 to `encryptedMetadata.pieces - 1`. File pieces share the same encryption stream with the metadata.
The final piece has the tag `crypto_secretstream_xchacha20poly1305_TAG_FINAL`. All other pieces has the tag `0`.
## License
Licensed under the [MIT License](LICENSE)