The asset_storage
project is a frontend canister-based solution for managing assets on the Internet Computer (IC) using the dfinity/assets
library. It enables asset storage, authentication, and permission management within a frontend canister.
Deploy the frontend canister using:
dfx deploy asset_storage_frontend
Grant ManagePermissions
to the frontend canister using:
dfx canister call <frontend_canister_id> grant_permission '(record { to_principal = principal "<frontend_canister_id>"; permission = variant { ManagePermissions } })'
Note : Replace <frontend_canister_id>
with the actual canister ID of the frontend canister.
Use the idlFactory
and canisterId
from declarations/asset_storage_frontend
to create the frontend actor.
After user authentication, grant Commit
permission to allow file uploads:
await frontend.grant_permission({
to_principal: userPrincipal,
permission: { Commit: null }
});
Use the AssetManager
from dfinity/assets
to efficiently chunk and store files within the frontend canister.