Skip to content

Latest commit

 

History

History

filevault

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

FileVault

Open in ICP Ninja

🥷 Try it live — no local setup. ICP Ninja is a web-based IDE that builds and deploys this project to the mainnet for free, right in your browser. Click the badge above, or hit Deploy if you're already in Ninja. To build and run it locally instead, follow the steps below.

FileVault is a file storage application that allows you to upload files from your local computer and store them on the network. FileVault uses Internet Identity (II) for user login and authentication. Once files are uploaded, they can be downloaded at a later time, or they can be deleted. Each user's files are stored under their Internet Identity principal, so only that principal can access them through the canister's public interface.

Build and deploy from the command line

Prerequisites

  • Node.js
  • icp-cli: npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm
  • ic-mops: npm install -g ic-mops

Install

Clone the example project:

git clone https://github.com/dfinity/examples
cd examples/motoko/filevault

Deploy and test

Start the local network, deploy, and run tests:

icp network start -d
icp deploy
bash test.sh
icp network stop

Internet Identity sign-in runs against the Internet Identity canister deployed on the local network (ii: true in icp.yaml). If signing in fails, update the local network launcher with icp network update and restart the network.

The frontend is served by the asset canister. To run the Vite dev server with hot reload during frontend development:

npm run dev

Updating the Candid interface

The backend/backend.did file defines the backend canister's public interface. The frontend TypeScript bindings are auto-generated from this file during the frontend build.

If you modify the backend's public API, regenerate the .did file:

mops generate candid backend

Security considerations and best practices

If you base your application on this example, it is recommended that you familiarize yourself with and adhere to the security best practices for developing on ICP. This example may not implement all the best practices.