Wee need to export the two functions immute and audit to make them available within the package.
For this a class ImmutabilityProvider needs to be created, whose objects offer these two functions for a selected Provider.
An example usage should look like:
const { ImmutabilityProvider } = require("@senseering/obsidian");
const data = "<data-to-be-immutable>" // object, string, number, boolean
let iotaImute = new ImmutabilityProvider("iota", config)
iotaImute.imute({ data }).then((immutabilityIdentifier) => {
console.log("Stored data with identifier: ", immutabilityIdentifier)
iotaImute.audit({ data, immutabilityIdentifier }).then((isValid) => {
if (!isValid) {
throw new Error("Hash does not match the data")
}
})
})
Wee need to export the two functions
immuteandauditto make them available within the package.For this a class
ImmutabilityProviderneeds to be created, whose objects offer these two functions for a selected Provider.An example usage should look like: