获取 API 密钥
概念

设备即存储

机器运行 SDK 第一次交换密钥时, 就会在您的账户上注册。 这正是让代理商工作的原因, 这也是为什么其文件从不离开机器的原因。

registered on first callfiles stay local
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

想法

存储是在数据生命的任何地方,而清单是故意混在一起的:计算机、浏览器、管理下的云存储、数据库或桶,与自己的证书相连。在字节的位置上,它们不同,在如何到达它们方面不同。

型 型其数据系何地联系
计算机计算机下,在 ~/.iagenify/filesstorage.files
电话电话浏览器中的连接您提供的文档
IaGenify 云云管理为您管理storage.run()
连接数据库或桶由您的提供者提供,您的全权证书storage.run()

机器如何到达

您不注册它。 在第一个密钥交换 SDK 机器身份、 环境、 检测到的资源 以及机器出现在列表中。 之后, 保存相同的身份, 因为存储身份与会话缓存 。

const pc = await api.storage.get();   // this machine

pc.id;
pc.type;        // "filesystem"
pc.hostname;
pc.isDefault;

await api.storage.list();             // every storage on the account
pc = api.storage.get()   # this machine

pc.id
pc.type          # "filesystem"
pc.machine_id
pc.is_default

api.storage.list()       # every storage on the account

为什么电脑保存档案

计算机存储服务器上没有计算机存储的字节,而且这是强制的,而不仅仅是意图:拒绝针对一个的上传 storage_is_local。在那里工作的代理人通过机器本身阅读和写作。

// Refused — a computer is not a destination for an upload
await api.files.create({ name: "notes.md", content }).save({ localOnly: false });
// IaGenifyError: storage_is_local

// This is the way: the file is written on the machine
await pc.files.write("notes.md", content);
# Refused — a computer is not a destination for an upload
api.files.create(name="notes.md", content=content).save(local_only=False)
# IaGenifyError: storage_is_local

# This is the way: the file is written on the machine
pc.files.write("notes.md", content)

默认存储

每个账户都有一个账户,它就是没有目的地的储蓄去的地方。 计算机违约情况很差,因为这个原因,它无法接收一个账户,所以默认通常指在管理下的云存储处。

await api.getStorage();              // the default
await api.storage.remove(id);        // allowed even for the default
                                     // another storage inherits the flag
api.get_storage()             # the default
api.storage.remove(storage_id)  # allowed even for the default:
                                # another storage inherits the flag