1.0.0 • Published 6 years ago
@cennznet/cennznut v1.0.0
CENNZnut.js
CENNZnut.js implements the Doughnut protocol CENNZnet Permission Domain in JavaScript.
Installing
This package is not yet in the NPM registry, but you may still install it via npm:
npm install --save cennznet/cennznut.jsDevelopment
Run tests:
npm testRun lint:
npm run lintAPI
Interface {
encode: encodePermissions,
decode: decodePermissions
}CENNZnet Permissions Object
Versioned JSON representations of the CENNZnet (cennznet) Doughnut Permission Domain.
v0
Object {
"modules": {
"<MODULE_NAME>": {
"blockCooldown": 5
"methods": {
"<METHOD_NAME>": {
"blockCooldown": 5
},
...
}
},
...
}
}Notes
blockCooldownindicates how many blocks may pass before the permission set is valid again- When
blockCooldownis 0 or not present, there is no block cooldown - When a module is specified without any methods, access is granted to all methods
- When both a module and one of its methods have
blockCooldown, method'sblockCooldownis used when calling method <MODULE_NAME>is the crate name, with any*rml-prefix removed
encodePermissions
Encode a CENNZnet permission set. Returns a Uint8Array.
encodePermissions(
version, // Currently 0
CENNZnetPermissionsObject, // The CENNZnet Permissions Object described above
) -> Uint8ArraydecodePermissions
Decode the JSON representation. Returns a CENNZnetPermissionsObject if valid.
decodePermissions(
permissions: Uint8Array
) -> Object1.0.0
6 years ago