Socket
Socket
Sign inDemoInstall

@elrondnetwork/attest

Package Overview
Dependencies
5
Maintainers
12
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @elrondnetwork/attest

The npm package of the __Elrond Attest__ service, built using [Node.js](https://nodejs.org/en/) and [Typescript](https://www.typescriptlang.org/).


Version published
Maintainers
12
Created

Readme

Source

@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

// In both examples, base url refers to the url of 
// the ElrondAttest api

// Initialization with api key
const api = AttestApi.withApiKey(apiKey, baseUrl)

// Initialization with access token
const api = AttestApi.withToken(token, baseUrl)

// Fetching account data
api.account() // returns an Axios promise

// Creating a file attestation
const input = {
    type: 'file',
    sha256: 'some hash here'
}

api.create(input) // returns an Axios promise

// Creating an object attestation
const input = {
    type: 'object',
    sha256: 'some hash here',
    object: {
        //...
    }
}

api.create(input) // returns an Axios promise

// Fetching the user's attested files
api.accountRecords() // returns an Axios promise

// Verifying if a file is attested

const hashOfFileToVerify = 'some hash'

api.records(hashOfFileToVerify)

HashResult

type HashResult = {
    type: 'file' | 'object',
    sha256: string,
    object?: object
}

webHash

// An already read file
const file = {}

// Callback for setting progress
// receives a number between 0 & 100 representing progress
// returns void
const setProgress = progress => {}

// Callback called on finalization
// receives a HashResult object representing the hashed file
// returns void
const onFinalize = hashResult => {} 

webHash(file, setProgress, onFinalize)

cliHash

const path = 'Path to file...'

cliHash(path) // Returns Promise<HashResult>

FAQs

Last updated on 05 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc