ula-vc-data-management
A ULA Holder plugin, responsible for storing and retrieving Verifiable Credentials and address data from a self defined data source. This plugin also translates Verifiable Credentials to the shared data model.
Installation
In an existing project (with package.json
), install ula-vc-data-management
npm install ula-vc-data-management --save
Usage
The following data-storage
interface must be implemented to store the data on the medium of your choice:
Currently the vcDataManagement
plugin accepts the following message types:
save-vcs
: Store Verified Credentialsget-vcs-by-context
: Retrieve Verified Credentials based on a regular expression matching the context fieldget-vcs-by-subject
: Retrieve Verified Credentials based on a regular expression matching the CredentialSubject keysave-address
: Store an address and its details (accountId, keyId, predicate)save-vc-transaction
: Save a VC transaction objectget-address-details
: Get the address details (accountId, keyId, predicate)get-attestations
: Get all attestations (conform the shared data model)get-attestors
: Get all attestors (conform the shared data model)get-transactions
: Get all transaction (conform the shared data model)get-new-key-id
: Receive a unique unused keyId (to create a unique address)data-clear-all
: Clear all Verifiable Credentials
// Assume an implementation of DataStorage at 'my-data-storage' // Create instances for the address - and VC repositories // Create the vcDataManagement instance // Create an array of plugins, now it's only vcDataManagement // Initialize the ULA with the plugins // Example: Store an address // define the ULA message, to save address details // Offer the message to the ULA. For this message implementation,// no callback is used in this case so the parameter undefinedeventHandler.processMessagemessage, undefined
Running tests
Besides unit testing with Mocha, the effectivity of all tests are also measured with the Stryker mutation testing framework.
npm run testnpm run stryker
We aim to achieve a coverage of 100%. Stryker and/or mocha test scores below 80% will fail the build.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License and disclaimer
apache-2.0 with a notice.
We discourage the use of this work in production environments as it is in active development and not mature enough.