Building on Arweave’s immutable and permanent file storage, AkordJS provides the privacy layer and means to collaborate securely with messaging and notes.
基于 Arweave 的不可变和永久文件存储,AkordJS 提供了隐私层和与消息传递和注释间安全协作的方法。
AkordJS介绍 (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
实施 Akord 协议的核心功能,AkordJS 使开发人员能够使用我们的数字保险库保管库,将用户拥有的存储集成到其(d)Apps 中。
Specifically, AkordJS allows developers to do the following.
具体来说,AkordJS 允许开发人员执行以下操作。
-
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.
创建端到端的加密和永久保管库,用于归档和保存文档、图像、结构化数据和其他形式的数据。可以授予应用访问用户保管库的权限,获取或保存与应用相关的数据。保险库由 Arweave 上的合约管理,所有数据都存储在链上。 -
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.
文件、消息和其他数据集可以在客户端加密并存储在保管库中。由保管库管理的数据可以安排在文件夹中,并允许对不可变的事件时间线进行文件修订和审计。
2.0发布 (2.0 release)
We're excited to announce the release of AkordJS 2.0. This release makes some major improvements, addressing the feedback we received from the community. It includes the following updates.
我们很高兴地宣布发布 AkordJS 2.0 。此版本进行了一些重大改进,回应了我们从社区收到的反馈。它包括以下更新。
-
Abstracted external services and other APIs from AkordJS core, replacing them with a single, deployable and public endpoint. Developers can now choose their preferred backend for accessing and committing transactions to Arweave.
从 AkordJS 核心中,抽象出外部服务和其他 API,将它们替换为一个单一的、可部署的公共端点。开发人员现在可以选择他们喜欢的后端来访问 Arweave 并将交易提交给 Arweave。 -
Removed unneeded dependencies from the abstraction above, therefore reducing the size of AkordJS.
从上面的抽象中删除了不需要的依赖项,因此减少了 AkordJS 的大小。 -
Renamed and improved the consistency of the project – naming conventions and codebase.
重命名并改进了项目的一致性—命名约定和代码库。
使用 AkordJS 构建 (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.
下面列出的只是关于如何使用 AkordJS 的一些简单想法。
-
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.
与我们所有的工具一样,AkordJS 只是一个开始。现在轮到您开始构建具有隐私和永久性的产物了。
代码示例—永久博客 (Code example – a Permablog)
Using AkordJS, we’ll easily build a simple, private and permanent blog – a Permablog!
使用 AkordJS,我们将轻松构建一个简单、私人和永久的博客——永久博客!
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.
开箱即用,我们将获得博客文章的端到端加密、Arweave 区块链上的永久存储以及使用 Akord 协议提供的密钥轮换来获得的访问控制。
从 Akord 钱包开始 (Start with an Akord wallet)
First, you’ll first need to create your Akord account and wallet here.
首先,您首先需要在此处创建您的 Akord 帐户和钱包。
By creating an Akord account, you’ll be able to access your wallet across devices. The wallet is where you secure your keys.
通过创建 Akord 帐户,您将能够跨设备访问您的钱包。钱包是您保护密钥的地方。
Make sure to safely store your recovery phrase. Akord does not have access to your recovery phrase and will never ask for it.
确保安全地存储您的助记词。 Akord 无法访问您的助记词,也绝不会要求它。
创建保管库 (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
注意:您需要使用 Node v16.x 进行构建
const { Akord } = require("@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”.
使用我们 Akord 帐户的凭据来检索钱包,连同其中包含的密钥,我们能够创建标题为“My Permablog”的保管库。
Note: you can sign up for a free Akord account to conveniently store and secure your wallet.
注意:您可以注册一个免费的 Akord 帐户 来方便地存储和保护您的钱包。
// access your Akord wallet
const email = "--akord username--"
const pass = "--akord password--"
const { akord } = Akord.auth.signIn(email, password);
// 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:
我们现在已经为我们的博客文章准备好了 Akord 钱包、保险库和文件夹。接下来,我们将发布我们的内容:
// 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, 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.
“注释”是 AkordJS 库中的原语,可让您将 markdown 发布到您的保险库。它只是一个在 Akord 协议中作为“栈”上传的文件。
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.list(vaultId);
// download each note from the vault
notes.forEach(async (note) => {
const { data } = await akord.note.getVersion(note.id);
console.log(data);
});
使用 Akord App 验证 (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.
到目前为止,我们已经使用 javascript 和 AkordJs 与我们的保管库进行交互。使用 Akord 应用(http://v2.akord.com),我们可以打开保管库并验证结果。
更多教程和构建器支持 (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.
您可以在此处找到类似的教程。我们还建议您在此处查看Akord 协议的完整文档,以及我们的Litepaper。
This article will be followed with a more another more detailed tutorial looking at different ways to use and access Akord's vaults.
这篇文章之后将有一个更详细的教程,介绍使用和访问 Akord 保险库的不同方式。
If you want to connect directly with our developers, jump into the discord and join the #builder-chat.
如果您想直接与我们的开发人员联系,请加入 Discord 并加入 #builder-chat。