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

@tephranet/tephra-sdk

v2.2.2

Published

This is the official SDK for [Tephra](https://tephra.co). A platform for tracking and preserving the authenticity of assets as they're transferred between users.

Downloads

43

Readme

Tephra SDK

This is the official SDK for Tephra. A platform for tracking and preserving the authenticity of assets as they're transferred between users.

Getting Started

You can install the SDK with npm or yarn:

npm install @tephranet/tephra-sdk
# or ...
yarn add @tephranet/tephra-sdk

Once the SDK is installed, you can create a new instance with your Tephra key and secret.

// Import our SDK
import { TephraSDK } from '@tephranet/tephra-sdk'

// Authenticate
const tephra = new TephraSDK(KEY, SECRET)

Create an Asset

An asset is a representation of whatever is being preserved. Each asset can be owned by just one individual at a time.

const address = await tephra.create()
console.log(`Now there's an asset at "${address}"`)
// e.g., Now there's an asset at "3a134374-b266-411f-882b-022422d05989"

When you create an asset in Tephra, it will be given an address. This unique address represents the asset. It can be used to retrieve information about the asset like the current owner, date of creation, chain of custody, etc.

Note: All transactions on the Tephra production server are stored in the global changeset. The changeset is regularly chunked and preserved on IPFS and timestamped on an Ethereum NFT. Because of this, the changeset is public and immutable.

Asset Contents

Assets can have contents like a name, description, image, and a list of attributes. These contents will be preserved as part of the changeset so they can be used to prove authenticity. They will also be displayed when the asset is validated and provide context for users.

// Create an asset
const assetAddress = await tephra.create({
  name: 'My First Asset',
  description: 'This asset will exist forever.',
  image: {
    type: 'ipfs',
    address: someIpfsAddress,
  },
  // Attributes can be used to store any structured
  // information about the asset.
  attributes: [
    {
      label: 'Created By',
      value: 'Me.',
    },
  ],
})

Custom Addresses

In some cases you might already have universally unique IDs for your products. You can also provide a custom address when creating an asset. Keep in mind that this call will fail if the address already exists.

tephra.create(myProduct, '10fbc842-b481-4556-93c8-b2a7373997ab')

Grants & Transfers

Once the asset has been created you can easily grant it to a user and transfer it between users. The string representation of the user (often a user ID or an email) must be unique for each user but it doesn't have to be unique accross the Tephra network.

// Grant the asset
await tephra.grant(address, USER_ONE)

// Transfer the asset
await tephra.transfer(address, USER_ONE, USER_TWO)

Privacy

Privacy is important to us. We don't store any user information beyond these address <> userId relationships. In cases where more detail is required (e.g., displaying user avatars in a chain of custody log) we request the information from your server using the userId you provide and we won't save it.

Security

We provide assurances that an asset can only be granted to a user ID once, and that tranfers always originate from the user ID that currently owns them. This makes it easier for developers to safely build patterns around trading and secondary sales.

Ejecting

When an asset is consumed, or ported to another marketplace, it can no longer be acted on in Tephra. When this happens, we say the asset has been "ejected". The address can still be validated but it will contain information about the last owner and the date it left the Tephra platform.

await tephra.eject(address, FROM_USER)