Open dlongley opened 6 years ago
Alright, time to deal with this issue.
In addition to the things previously mentioned, it is currently possible to change the value of ledger
in the config which I assume should not be allowed. I am I correct in that assumption?
https://github.com/digitalbazaar/bedrock-ledger-node/blob/master/lib/ledger-node-config.js#L75
So, we need to do some JSON schema type validation and if I'm correct, ensure that the ledger
value matches the existing config?
Here is a minimal ledgerConfiguration for the sake of discussion: https://github.com/digitalbazaar/bedrock-ledger-consensus-continuity/blob/master/test/mocha/mock.data.js#L30
{
'@context': 'https://w3id.org/webledger/v1',
type: 'WebLedgerConfiguration',
ledger: 'did:v1:eb8c22dc-bde6-4315-92e2-59bd3f3c7d59',
consensusMethod: 'Continuity2017'
}
@gannan08 -- please check to see if your PR #33 closes this out.
I think we should have a basic requirement that
ledgerConfiguration
has a@context
with a string value ofhttps://w3id.org/webledger/v1
or an array value where that string is the first entry. There may be a few other requirements such as aconsensusMethod
, etc. These must be present for all ledger configs when using the bedrock-ledger-node APIs.In short, bedrock-ledger-* libraries have some basic requirements that data conform to the core webledger context and we should minimally enforce this by requiring its presence in the
@context
value and we should enforce a basic shape that plugins, etc. would need to use. Other than that, we can allow extensions to add addition data that custom validator plugins can handle for specific ledgers.Does anyone object to this approach?