Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elrondnetwork/attest.web

Package Overview
Dependencies
Maintainers
12
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elrondnetwork/attest.web

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

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
12
Created
Source

@elrondnetwork/attest.web

The Browser implementation of the Elrond Attest service, built using Node.js and Typescript.

Requirements

  • Node.js version 14.16.0+
  • Npm version 6.14.0+
  • Typescript version 4.2.3+

Dependencies

Usage

// Creating a hash

import { hash } from '@elrondnetwork/attest.web'

// (file: File) => Promise<HashResult>
const hashResult = await hash(file) // regular Web API file, 
// see https://developer.mozilla.org/en-US/docs/Web/API/File
// Creating the attest client
import { attest } from '@elrondnetwork/attest.web'

// Only one of the following fields should be used at once
const authorization = {
    token: 'sampleToken', 
}

const client = attest({ authorization })

// The client can then be used to access the attestation functions

// Fetching an user's account

// () => Promise<Result>
const account = await client.account()

// Fetching an user's attestations

// Both of the following fields are nullable
const parameter = {
    sha256: 'some hash', // Last hash after which to fetch attestations 
    timeStamp: 'some timestamp' // Last timestamp after which to fetch attestations
}

// (input: AttestationParameter) => Promise<Result>
const attestations = await client.attestations(parameter)

// Creating an attestation

const input = {
    file,
    options: {
        shouldStoreObject: true // Flag to store generated object alongside attestation
    }
}

// (input: { file: File, onProgress?: onProgress, options?: Options }) => Promise<Result> 
const createResponse = await client.create(input)

// Verifying if a file is already attested

const input = "some existing hash" // Or use the reader if you don't already have a hash

const verifyResponse = await client.verify(input)

Exposed types

TokenAuthorization: { baseUrl: string, token: string }

Type to be used for authorizing the client by access token

AttestWeb: { attestations, account, create, verify }

Type of the attest client

FAQs

Package last updated on 08 Apr 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc