@truestamp/client
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

Truestamp Client

Description

A small Truestamp API wrapper library, written in Typescript, for usage in Deno and Node.js.

Usage of this library requires an active Truestamp account, and an associated API key.

Features

  • Small library size
  • Zero dependencies
  • Built with Typescript
  • Promise based API (async/await)
  • Supports Deno (ESM), Node.js (CommonJS)
  • esm.sh CDN support
  • SkyPack CDN support
  • JSDELIVR CDN support
  • UNPKG CDN support

Installation

How to install and use the TruestampClient in different runtime environments.

Node.js (CommonJS)

In your NPM project root.

npm install @truestamp/client --save

Require the @truestamp/client CommonJS module in your project and initialize it with an api key.

const { TruestampClient } = require("@truestamp/client")
...

Deno (ES Modules)

Import the @truestamp/client ESM module in your project via esm.sh and initialize it with an apiKey.

// Tip : Load module from esm.sh CDN, pinned to a specific version.
import { TruestampClient } from "https://esm.sh/@truestamp/client@0.15.0"
...

API Usage Example

The first step is to instantiate an instance of the TruestampClient class, passing it your apiKey as an argument.

The client class instance the makes available a number of functions, each of which accepts typed arguments and returns typed response Objects.

// See installation section for your runtime environment.
import { TruestampClient } from "@truestamp/client"

const ts = new TruestampClient({ apiKey: "%yourApiKey%" })

const myHash =
  "e728e4adeb8c0606fce4686552338622efeb8c63b53d072a323a4914d1aa5c07"

// Create new Item
const resp = await ts.createItem(
  {
    itemData: [
      {
        hash: myHash,
        hashType: "sha-256",
      },
    ],
  },
  { skipCF: false, skipOE: false }
)

// Success! `resp` contains good response JSON
// of the appropriate type.
console.log("createItem", resp)

Examples

There are working code examples for Deno and Node.js in the /examples directory. Take a look at the examples/README.md for usage instructions.

Truestamp Community Hub

Please see our Github organization's profile at github.com/truestamp for quick access to links related to these and other important topics.

  • Filing Issues (bug reports & feedback)
  • Community Discussions
  • Security Reporting
  • Code of Conduct
  • Code Contributions
  • Public roadmap
  • Support

Legal

Copyright © 2019-2023 Truestamp Inc. All Rights Reserved.

Package Sidebar

Install

npm i @truestamp/client

Weekly Downloads

24

Version

2.1.0

License

MIT License

Unpacked Size

674 kB

Total Files

13

Last publish

Collaborators

  • truestamp-dev