@ergosphere-it/protocol
Ergosphere-it的格式和规则: schemas, canonical JSON, Ed25519 签名,核查,以及符合情况. 它没有I/O,运行于Node.js,Electron,浏览器,德诺,邦和工人.
它会做什么
- 定义已签名的文档:捆绑清单、安装者清单和频道文件.
- 以Canonical JSON(JCS,RFC 8785)的方式以WebCrypto Ed25519.
- 验证一个文档:签名,信任的密钥,计划,安全的文件路径,对于一个频道文件,产品,频道,过期,再播放.
- 决定一个安装是否可以带一个经过验证的捆绑或安装器,每个原因有一个错误代码.
- 船舶符合性案例,因此一个客户端用另一种语言给出相同的输入结果.
使用量
import { checkBundleCandidate, verifyBundleManifest } from '@ergosphere-it/protocol'
const manifest = await verifyBundleManifest(bytes, signature, trustedKeys)
checkBundleCandidate(manifest, { host: 'electron', installerBundleReleaseId, nativeVersion: 2, platform: 'darwin-arm64', product: 'my-app' })
检查失败会丢出一个 ErgosphereError 带有子类 code 从规格,例如 invalid-signature 或者说 native-version-mismatch。 。 。 .
import { conformanceSuite } from '@ergosphere-it/protocol/conformance'
for (const testCase of conformanceSuite.cases) {
// Run the case against your client, and compare with testCase.expect.
}
何时使用
- 您为另一个运行时间写客户端或主机, 它必须遵守相同的规则 .
- 您用自己的工具验证或检查释放文件.
不使用时
- 你给Electron软件添加了更新 使用
@ergosphere-it/electron,使用此软件包. - 你创造了释放。 使用
@ergosphere-it/publish,它只签署通过这些检查的文件.