npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@trace4eu/timestamp-wrapper

v0.0.5

Published

The `TimestampWrapper` class simplifies the usage of EBSI's [Timestamp API (version 4)](https://hub.ebsi.eu/apis/pilot/timestamp/v4). This class abstracts the complexities of interacting with EBSI's timestamping API, allowing developers to easily create,

Downloads

8

Readme

Documentation: timestamp wrapper

The TimestampWrapper class simplifies the usage of EBSI's Timestamp API (version 4). This class abstracts the complexities of interacting with EBSI's timestamping API, allowing developers to easily create, manage, and retrieve timestamp records and their versions. The class relies on a Wallet instance for signing transactions and an AuthorisationApi instance for managing authentication with EBSI.

Constructor

constructor(wallet: Wallet)

Creates a new instance of the TimestampWrapper class.

  • Parameters:

    • wallet: Wallet: A Wallet instance used for signing transactions.
  • Example:

    const wallet = new Wallet();
    const timestampWrapper = new TimestampWrapper(wallet);
    

Methods

timestampRecordHashes

Creates a timestamp record with the ability to be versioned.

  • Parameters:

    • hashAlgorithmId: number: The ID of the hashing algorithm used. Use 0 for SHA-256.
    • hashValue: string: The hash value to be recorded. Unlike EBSI's Timestamp API, this method allows only one hash value instead of three.
    • versionInfo: string: Information about the version.
    • timestampData: string[] = ['']: Optional array of timestamp data.
    • waitMined: boolean = true: Optional command about whether to wait for the transaction to be mined.
  • Returns:

    • Promise<Result<{ hex: string; multibase: string }, Error>>: A Result object containing the record ID in hex and multibase format or an error.

timestampRecordVersionHashes

Creates a new version for a specific timestamp record.

  • Parameters:

    • recordId: string: The ID of the record (in hex format).
    • hashAlgorithmId: number: The ID of the hashing algorithm used.
    • hashValue: string: The hash value to be recorded.
    • versionInfo: string: Information about the version.
    • timestampData: string[] = ['']: Optional array of timestamp data.
    • waitMined: boolean = true: Whether to wait for the transaction to be mined.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the version ID or an error.

insertRecordOwner

Inserts a new owner for a specific timestamp record.

  • Parameters:

    • recordId: string: The ID of the record (in hex format).
    • ownerId: string: The ID of the new owner (in ETH address format).
    • notBefore: number: The start time for ownership.
    • notAfter: number: The end time for ownership.
    • waitMined: boolean = true: Optional flag indicating whether to wait for the transaction to be mined.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the owner ID or an error.

revokeRecordOwner

Revokes ownership of a specific timestamp record.

  • Parameters:

    • recordId: string: The ID of the record (in hex format).
    • ownerId: string: The ID of the owner to revoke (in ETH address format).
    • waitMined: boolean = true: Optional flag indicating whether to wait for the transaction to be mined.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the owner ID or an error.

getRecord

Retrieves details of a specific record by its ID.

  • Parameters:

    • recordId: string: The ID of the record (in multibase format).
  • Returns:

    • Promise<Result<Record, Error>>: A Result object containing the record details or an error.

getRecordVersions

Retrieves the versions of a specific record by its ID.

  • Parameters:

    • recordId: string: The ID of the record (in multibase format).
  • Returns:

    • Promise<Result<RecordVersions, Error>>: A Result object containing the record versions or an error.

getRecordVersionDetails

Retrieves details of a specific version of a record.

  • Parameters:

    • recordId: string: The ID of the record (in multibase format).
    • versionId: string: The ID of the version.
  • Returns:

    • Promise<Result<RecordVersionDetails, Error>>: A Result object containing the version details or an error.

timestampHashes

Creates a timestamp for a hash value. note: endpoint is not tested, use with caution and report bugs to trace4eu consortium

  • Parameters:

    • from: string: The sender’s ETH address.
    • hashAlgorithmId: number: The ID of the hashing algorithm used.
    • hashValue: string: The hash value to be recorded.
    • timestampData: string[] = ['']: Optional array of timestamp data.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the transaction hash or an error.

timestampVersionHashes

Creates a timestamp for a versioned hash value. note: endpoint is not tested, use with caution and report bugs to trace4eu consortium

  • Parameters:

    • from: string: The sender’s ETH address.
    • versionHash: string: The version hash.
    • hashAlgorithmId: number: The ID of the hashing algorithm used.
    • hashValue: string: The hash value to be recorded.
    • versionInfo: string: Information about the version.
    • timestampData: string[] = ['']: Optional array of timestamp data.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the transaction hash or an error.

appendRecordVersionHashes

Appends hash values to a specific record version. note: endpoint is not tested, use with caution and report bugs to trace4eu consortium

  • Parameters:

    • from: string: The sender’s ETH address.
    • recordId: string: The ID of the record.
    • versionId: string: The ID of the version.
    • hashAlgorithmId: number: The ID of the hashing algorithm used.
    • hashValue: string: The hash value to be recorded.
    • versionInfo: string: Information about the version.
    • timestampData: string[] = ['']: Optional array of timestamp data.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the transaction hash or an error.

detachRecordVersionHash

Detaches a hash value from a specific record version. note: endpoint is not tested, use with caution and report bugs to trace4eu consortium

  • Parameters:

    • from: string: The sender’s ETH address.
    • recordId: string: The ID of the record.
    • versionId: string: The ID of the version.
    • versionHash: string: The version hash.
    • hashValue: string: The hash value to be detached.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the transaction hash or an error.

insertRecordVersionInfo

Inserts version information into a specific record version. note: endpoint is not tested, use with caution and report bugs to trace4eu consortium

  • Parameters:

    • from: string: The sender’s ETH address.
    • recordId: string: The ID of the record.
    • versionId: string: The ID of the version.
    • versionInfo: string: Information about the version.
  • Returns:

    • Promise<Result<string, Error>>: A Result object containing the transaction hash or an error.