{"id":19198534,"url":"https://github.com/virgilsecurity/demo-sharing-js","last_synced_at":"2025-05-09T01:18:38.194Z","repository":{"id":90250376,"uuid":"65831548","full_name":"VirgilSecurity/demo-sharing-js","owner":"VirgilSecurity","description":"This is a demo app shows how you can create a secure file sharing app using Virgil Crypto Library in Javascript. ","archived":false,"fork":false,"pushed_at":"2023-01-23T21:52:43.000Z","size":12250,"stargazers_count":56,"open_issues_count":2,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-09T01:18:32.232Z","etag":null,"topics":["cryptography","demo","encryption","file-sharing","sharing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VirgilSecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-16T15:27:31.000Z","updated_at":"2025-04-09T05:52:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"77c4939d-799d-40e0-861d-913f245ad922","html_url":"https://github.com/VirgilSecurity/demo-sharing-js","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/VirgilSecurity%2Fdemo-sharing-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fdemo-sharing-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fdemo-sharing-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fdemo-sharing-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VirgilSecurity","download_url":"https://codeload.github.com/VirgilSecurity/demo-sharing-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171364,"owners_count":21865312,"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":["cryptography","demo","encryption","file-sharing","sharing"],"created_at":"2024-11-09T12:22:35.747Z","updated_at":"2025-05-09T01:18:38.182Z","avatar_url":"https://github.com/VirgilSecurity.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Virgil Secure Sharing Demo\nThis is a demo app showing one way you can use Virgil Crypto Library in javascript to create a secure file sharing app.\nAfter you complete the steps in **Setup** section you will be able to download, decrypt and view encrypted media files\nfrom a browser.\n\n## Setup\n\n### Clone the repository\n```\n$ git clone https://github.com/VirgilSecurity/virgil-secure-sharing.git\n$ cd ./secure-sharing\n```\n\n### Install the dependencies\n```\n$ npm install\n```\n\n### Configure\nIn order to decrypt files the app needs a private part of the key used to encrypt the files, private key password and \nrecipient id used during encryption. Set these as environment variables before starting the server. For example, execute:\n```\nPRIVATE_KEY=\u003cbase64_encoded_private_key\u003e PRIVATE_KEY_PASSWORD=\u003cprivate_key_password\u003e RECIPIENT_ID=\u003crecipient_id\u003e npm run start\n```\nto set variables and start a server on Unix platform.\n\n### Prepare encrypted files\n\n#### Encrypt\nTo encrypt the files you can use Virgil CLI tool. Instructions on how to encrypt data without using Virgil Services can be found [here](https://github.com/VirgilSecurity/virgil-cli/wiki#using-virgil-cli-without-committing-to-services).\n\n#### Upload\nUpload the files to some publicly available storage (e.g. Dropbox) so that they can be downloaded by the app.\n\n#### Create metadata\nIn order for decrypted media files to be opened accordingly to their type you must provide MIME type of the file along with \nit's download url. You do that by creating a JSON object with two properties \"type\" and \"url\":\n```\n{\n\t\"type\": \"video/mp4\",\n\t\"url\": \"https://example.com/encrypted_video\"\n}\n```\n\n#### Encode the metadata\nThe metadata are passed to the app via url query parameter named `source`. The value of that parameter should be a base64-encoded\nmetadata JSON. There are multiple ways to encode a string in base64 any of which should work fine for this example.\n\n### Give it a try\nNow open your browser and point to `http://localhost:3000/?source=\u003csource\u003e` where `\u003csource\u003e` is the string obtained on the previous step.\n\n## Notes\n\n### Supported MIME types\nFor audio and video files only the following MIME types are supported:\n\n#### Audio\n- audio/aac (.aac)\n- audio/mp4 (.mp4 .m4a)\n- audio/mpeg (.mp1 .mp2 .mp3 .mpg .mpeg)\n- audio/ogg (.oga .ogg)\n- audio/wav (.wav)\n- audio/webm (.webm)\n\n#### Video\n- video/mp4 (.mp4 .m4v)\n- video/ogg (.ogv)\n- video/webm (.webm)\n\n### File sizes\nDue to the use of [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects the maximum file size is limited to 500Mb in Google Chrome browser.\nIn browsers where size of `Blob` is not restricted it is not guaranteed that files over ~700Mb will be successfully decrypted due to memory limitations.\n \n## Live demo\n- [Video](https://virgil-crypto-sharing.herokuapp.com/?source=eyJ0eXBlIjoidmlkZW8vbXA0IiwidXJsIjoiaHR0cHM6Ly9kb3dubG9hZHMudmlyZ2lsc2VjdXJpdHkuY29tL2RlbW9maWxlcy92aWRlby5tcDQuZW5jIn0=)\n- [Audio](https://virgil-crypto-sharing.herokuapp.com/?source=eyJ0eXBlIjoiYXVkaW8vbXBlZyIsInVybCI6Imh0dHBzOi8vZG93bmxvYWRzLnZpcmdpbHNlY3VyaXR5LmNvbS9kZW1vZmlsZXMvYXVkaW8ubXAzLmVuYyJ9)\n- [Image](https://virgil-crypto-sharing.herokuapp.com/?source=eyJ0eXBlIjoiaW1hZ2UvanBlZyIsInVybCI6Imh0dHBzOi8vZG93bmxvYWRzLnZpcmdpbHNlY3VyaXR5LmNvbS9kZW1vZmlsZXMvaW1hZ2UuanBnLmVuYyJ9)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fdemo-sharing-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirgilsecurity%2Fdemo-sharing-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fdemo-sharing-js/lists"}