Austin Fatheree, February 22 2022
This bounty gives the opportunity to
The goal of this bounty is to produce two motoko libraries.
More info about CBOR can be found at:
An example of cbor library can be found at:
DFINITY uses CBOR in the agent-js library as well. The implementation can be found at https://github.com/dfinity/agent-js/blob/main/packages/agent/src/cbor.ts
Github user Nomeata has done some cbor(only on binaries) at https://github.com/nomeata/motoko-certified-http which may demonstrate some good paterns for parsing and constructing CBOR.
We need a CBOR library in motoko because the new call_raw functionality allows a motoko canister to receive Binary Represented data from a server. A wallet may want to filter this call and decide if it wants to pass it on to another IC service by data inside the encoded representation. The cbor plug in will allow a wallet author to inspect the payload and make decisions about the call.
The opposite is also possible, where a wallet may want to be able to construct a payload for call raw using an uploaded candid definition for a service that did not exist when the wallet was minted.
Once CBOR is decoded it needs to be synced with the cadid representation of the service it was encoded for. If you want to be able to tell what property is what in your function call package you need to know the candid that was used to encode the package.
The Candid parsing logic can be found for the agent-js library at: https://github.com/dfinity/agent-js/blob/main/packages/candid/src/candid-core.ts
These libraries will often be used together to parse and encode binary data.
The developer is welcome to attempt to refactor the Candy Library at https://github.com/aramakme/candy_library to host the candid parser as that was one of the initial intents of that library.
A full set of tests should be implemented.
The package should be deployed as a vessel package.
The bounty was generously funded by the DFINITY Foundation. If you would like to turbocharge this bounty you can seed additional donations of ICP to d0e3be904a939ff752979aaa53cfb66fac8d75b85ce4fa878e147d60706be6ed. ICDevs will match the bounty 5:1 for the first 24 ICP out of the DFINITY grant and then 0.25:1 after that. All donations will be tax deductible for US Citizens and Corporations. If you send a donation and need a donation receipt, please email the hash of your donation transaction, physical address, and name to [email protected]. More information about how you can contribute can be found at our donations page.
The award has been given granted to https://github.com/Gekctek for the following contributions: