Skip to content

Export functions of immutability provider for nodejs usage #3

@ArzelaAscoIi

Description

@ArzelaAscoIi

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")
        }
    })
})

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions