@elrondnetwork/attest
The npm package of the Elrond Attest service, built using Node.js and Typescript.
Requirements
- Node.js version 14.16.0+
- Npm version 6.14.0+
Dependencies
Exposed types
- AttestApi - creates an instance of the AttestApi
- HashResult - represents the result of a hashing operation
Exposed functions
Note that these may be subject to change
- webHash - hashes its inputs -> to be used by browser-based applications
- cliHash - hashes its inputs -> to be used by cli-based applications
Usage
AttestApi
Note that the following methods may be subject to change
const api = AttestApi.withApiKey(apiKey, baseUrl)
const api = AttestApi.withToken(token, baseUrl)
api.account()
const input = {
type: 'file',
sha256: 'some hash here'
}
api.create(input)
const input = {
type: 'object',
sha256: 'some hash here',
object: {
}
}
api.create(input)
api.accountRecords()
const hashOfFileToVerify = 'some hash'
api.records(hashOfFileToVerify)
HashResult
type HashResult = {
type: 'file' | 'object',
sha256: string,
object?: object
}
webHash
const file = {}
const setProgress = progress => {}
const onFinalize = hashResult => {}
webHash(file, setProgress, onFinalize)
cliHash
const path = 'Path to file...'
cliHash(path)