App
Use end-to-end encryption or publish public files to Arweave.
API
Plug Akord vaults into existing products and workflows.
Explorer
Find, discover and follow Akord vaults with our Permaweb dApp.
Learn > AkordJS

AkordJS: privacy, collaboration and file management on Arweave

Richard Caetano
Richard Caetano
30 Jan 2023 · 4 min

Building on Arweave’s immutable and permanent file storage, AkordJS provides the privacy layer and means to collaborate securely with messaging and notes.

Introducing AkordJS

Implementing the core functions of the Akord protocol, AkordJS enables developers to integrate user-owned storage into their (d)Apps with our digital vaults

Specifically, AkordJS allows developers to do the following.

  • Create end-to-end encrypted and permanent vaults for archiving and preserving documents, images, structured data, and other forms of data. Applications can be granted access to a user’s vault to get or save data related to the application. The vaults are managed by a contract on Arweave and all data is stored on-chain.

  • Add or remove members to vaults who can be assigned as contributors or have view-only permission. Keys are generated and rotated by the client. The agreement between members is maintained by the protocol and verified by the members’ clients.

  • Files, messages and other data sets can be encrypted client side and stored in the vault. Data that is managed by the vault can be arranged within folders, as well as allowing for file revisions and audits of an immutable timeline of events.

Building with AkordJS

We believe the ability to collaborate in an end-to-end encrypted environment where data is immutable and permanent will open up exciting new opportunities; products and services that will be built on a foundation of data ownership.

Listed below are just a few simple ideas for how AkordJS could be used.

  • Writing or blogging where content is published and shared exclusively.

  • Creating archives of important files that need to be stored for many years or even indefinitely, and where ownership can easily be managed and passed on.

  • Airdropping token-gated access to vaults, containing files and message threads for specific communities.

  • Printing a QR code that provides access to a vault containing additional information, media or rewards.

  • Build a content vault, where viewers sign and agree to terms to access a specific resource.

AkordJS, like all our tools, is just the start. Now it’s over to you to start building with privacy and permanence.

Code example – a Permablog

Using AkordJS, we’ll easily build a simple, private and permanent blog – a Permablog!

Out of the box, we’ll get end-to-end encryption of the blog posts, permanent storage on the Arweave blockchain and access control using key rotation provided by Akord protocol.

Start with an Akord wallet

First, you’ll first need to create your Akord account and wallet here.

By creating an Akord account, you’ll be able to access your wallet across devices. The wallet is where you secure your keys.

Make sure to safely store your recovery phrase. Akord does not have access to your recovery phrase and will never ask for it.

Create the vault

Next, we’ll start by creating a new vault for our Permablog.

NOTE: You’ll need to build with Node v16.x

import { Akord, Auth } from "@akord/akord-js";

Using the credentials from our Akord account to retrieve the wallet, along with the keys contained in it, we’re able to create the vault with the title “My Permablog”.

Note: you can sign up for a free Akord account to conveniently store and secure your wallet.

// access your Akord wallet 
const email = "--akord username--"
const password = "--akord password--"
const { wallet } = await Auth.signIn(email, password);
const akord = await Akord.init(wallet);

// create the vault
const { vaultId } = await akord.vault.create("my first vault");

To finish the Vault setup, let’s create a folder to store our blog posts:

// create a folder for blog posts
const { folderId } = await akord.folder.create(vaultId, "posts");

Posting to the Permablog

We now have our Akord wallet, vault and folder ready for our blog posts. Next, we’ll post our content:

// post content to the vault
const title = “Hello world!”
const body = “# Welcome to my Permablog! \nThis is how it starts."

const { noteId } = await akord.note.create(vaultId, body, title, { parentId: folderId });

A ‘note’ is a primitive in the AkordJS library that enables you to post markdown to your vault. It’s simply a file that’s uploaded as a ‘stack’ in the Akord Protocol.

Stacks are a useful primitive enabling you to upload a file along with any revisions. Each revision is stored in a stack like structure, meaning you keep all revisions and history of the file.

Reading from the Permablog

Now that we’ve posted content to our vault, next we’ll read from the vault display our blog post:

// get a list of notes in the vault
const notes = await akord.note.listAll(vaultId);

// download each note from the vault
notes.forEach(async (note) => {
    const { data } = await akord.note.getVersion(note.id);
    console.log(data);
});

Verify with Akord App

Until now, we have used javascript and AkordJs to interact with our vault. Using the Akord App (http://v2.akord.com) we can open the vault and verify the results.

Permablog UI

More tutorials and builder support

You can find a similar tutorial here. We also recommend checking out the full documentation for Akord protocol here, as well as our Litepaper.

This article will be followed with a more another more detailed tutorial looking at different ways to use and access Akord's vaults.

If you want to connect directly with our developers, jump into the discord and join the #builder-chat.

Make your first upload to Arweave for free

Upload public or private data to Akord’s digital vaults. The only app to provide free storage on the Arweave blockchain.