Skip to content

truestamp-js 0.14.4

Install from the command line:
Learn more about npm packages
$ npm install @truestamp/truestamp-js@0.14.4
Install via package.json:
"@truestamp/truestamp-js": "0.14.4"

About this version

Truestamp JS

@truestamp/truestamp-js actions @truestamp/truestamp-js jsDelivr

Description

A zero-dependency Truestamp SDK written in Typescript that supports ES Modules, UMD, and CommonJS loaders and runs in Deno, Node.js, and modern browsers.

Features

  • Small library size
  • No external dependencies
  • Built with Typescript
  • Promise based API
  • Supports Deno (ESM), Node.js (CommonJS), and modern browsers (ESM, UMD)
  • SkyPack CDN support
  • JSDELIVR CDN support
  • UNPKG CDN support

API Documentation

https://docs.truestamp.com/

Usage

Here are some simple usage examples. Additional example code can be found in the /examples directory.

Node.js (CommonJS)

Setup Node.js

In your NPM project directory.

npm install @truestamp/truestamp-js --save

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

Node.js Example

const Truestamp = require("@truestamp/truestamp-js")

// A TRUESTAMP_API_KEY environment variable can also be set in your
// environment in place of providing the `apiKey` value as an argument.
const TruestampClient = new Truestamp({ apiKey: "%yourApiKey%" })

TruestampClient.getHealth()
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

Deno (ES Modules)

Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

Setup Deno

Import the @truestamp/truestamp-js ESM module in your project via SkyPack and initialize it with your apiKey.

SkyPack Package Info

https://www.skypack.dev/view/@truestamp/truestamp-js

It is recommended to used a pinned version of the library when using SkyPack in production. Also, note the ?dts suffix on the URL to get the SkyPack Automatic TypeScript Declarations for Deno.

Deno Example

// Note the `?dts` param to provide the proper typings for Deno
import Truestamp from "https://cdn.skypack.dev/@truestamp/truestamp-js?dts"

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

const hb = await TruestampClient.getHealth()
console.log(hb)

Browser (UMD)

You can use a <script> tag in the browser to load a specific version of the library from several supported CDN's. Replace the pinned version in the link with the version you use in your app. You can use the ES Modules or UMD builds for browser support.

<!-- load from JSDELIVR CDN latest (using latest not recommended for production use, pin a version) -->
<!-- See : https://www.jsdelivr.com/package/npm/@truestamp/truestamp-js -->
<script src="https://cdn.jsdelivr.net/npm/@truestamp/truestamp-js@latest/dist/truestamp.umd.min.js"></script>

The JS files available for each version can be browsed at JSDELIVR

<!-- load from UNPKG CDN latest (using latest not recommended for production use, pin a version) -->
<!-- See : https://unpkg.com/browse/@truestamp/truestamp-js/ -->
<script src="https://unpkg.com/@truestamp/truestamp-js"></script>

Example Code

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

Contributing

We'd love you to join our network of contributors. Please read CONTRIBUTING.md for help getting started.

Testing

The tests run actual requests against the public API. You need to configure a .env file in the root of the repository with contents like:

TRUESTAMP_ENV=development
TRUESTAMP_API_KEY=...

Releasing

  • Commit changes, merge PR's to main branch
  • Bump version field in package.json
  • Cut a new release
  • New release will trigger workflow to build, test, and publish package to Github Package Registry and NPM.js.

Code of Conduct

We expect all members of the community to respect our Code of Conduct at all times.

Legal

Copyright © 2021-2022 Truestamp Inc. All Rights Reserved.

Details


Assets

  • truestamp-js-0.14.4.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0