Socket
Book a DemoInstallSign in
Socket

indigotrace-sdk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

indigotrace-sdk

Indigo Trace SDK

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

trace-sdk-js

This javascript module exposes function to communicate with the Trace API.

Usage

import Trace from "trace-sdk-js";

// Your key should be retrieved from an environment variable or an other secure store.
// The public key will be derived from its private key.
// The 'secret' field must be an base64-encoded string of 64 bytes.
myKey = {
  type: "ed25519",
  secret:
    "VD6zmq068l1EhaWfpRQxnlpTjGbwSN2q2XcgriBmo3Mco+7GK+BPLO49yxuQzbQ1dzd/6B+3YQb2c3BhqEaTsA=="
};

// Initialize the SDK with the API's URL
trace = Trace("https://indigotrace.com", myKey);

// This is an example of data we want to send to Trace
data = {
  type: "test",
  data: "data",
  name: "name"
};

// Create a payload containing our data
// Since we omit the traceID, it will instanciate a new trace.
payload = trace.create(data);

// Sign the payload before sending it
signedPayload = trace.sign(payload);

// Finally, you can send the payload to the trace API.
// Before sending it, it will ensure that the fields (payload, signature) are present.
trace.send(payload);

// PAYLOAD FORMAT
// {
//   payload: {
//     data: {
//       type: "test",
//       data: "data",
//       name: "name"
//     },
//     refs: ["ref2", "ref2"],
//     traceID: "db255d6d-8e7f-45e6-99f8-cf9f1084ba9b"
//   },
//   signatures: [{
//     type: "ed25519",
//     pubKey: "EXAMPLEPUBLICKEY123",
//     sig: "signedpayload"
//   }]
// };

Keywords

stratumn

FAQs

Package last updated on 31 Jan 2018

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