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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chaindoc_io/server-sdk

v1.0.5

Published

Server-side SDK for Chaindoc API - document management, signatures, and embedded sessions

Readme

@chaindoc_io/server-sdk

Official server-side SDK for Chaindoc API - document management, digital signatures, and blockchain verification.

npm version License: MIT TypeScript Node.js

Features

  • Document Management - Create, update, and version documents with blockchain verification
  • Digital Signatures - Request and collect legally-binding electronic signatures
  • Embedded Signing - Seamless in-app signing experience with frontend SDK integration
  • Blockchain Verification - Immutable document verification on blockchain
  • KYC Integration - Built-in Sumsub KYC verification for signers
  • Zero Dependencies - Uses native Node.js 18+ APIs (fetch, FormData)
  • TypeScript First - Full type definitions included
  • Automatic Retries - Built-in retry logic with exponential backoff

Installation

npm install @chaindoc_io/server-sdk
yarn add @chaindoc_io/server-sdk
pnpm add @chaindoc_io/server-sdk

Quick Start

import { Chaindoc } from "@chaindoc_io/server-sdk";

const chaindoc = new Chaindoc({
  secretKey: "sk_your_secret_key",
});

// Create embedded session for document signing
const session = await chaindoc.embedded.createSession({
  email: "[email protected]",
  metadata: {
    documentId: "doc_xxx",
    signatureRequestId: "req_xxx",
  },
});

// Use session.sessionId on frontend with @chaindoc_io/embed-sdk
console.log(session.sessionId);

Complete Example: Document Signing Flow

import { Chaindoc } from "@chaindoc_io/server-sdk";
import { readFile } from "fs/promises";

const chaindoc = new Chaindoc({
  secretKey: "sk_your_secret_key",
});

// 1. Upload document
const buffer = await readFile("./contract.pdf");
const file = new Blob([buffer], { type: "application/pdf" });
const { media } = await chaindoc.media.upload([file]);

// 2. Create document with blockchain verification
const doc = await chaindoc.documents.create({
  name: "Service Agreement",
  description: "Contract for services",
  media: media[0],
  hashtags: ["#contract", "#agreement"],
  status: "published", // Verify in blockchain
});

// 3. Create signature request
const request = await chaindoc.signatures.createRequest({
  versionId: doc.document.versions[0].uuid,
  recipients: [
    { email: "[email protected]" },
    // With KYC verification:
    // { email: '[email protected]', shareToken: 'sumsub_share_token' }
  ],
  deadline: new Date("2025-12-31"),
  embeddedFlow: true,
});

// 4. Create embedded session for signer
const session = await chaindoc.embedded.createSession({
  email: "[email protected]",
  metadata: {
    documentId: doc.documentId,
    signatureRequestId: request.signatureRequest.uuid,
    returnUrl: "https://yourapp.com/signing-complete",
  },
});

// 5. Send sessionId to frontend
// Frontend uses: @chaindoc_io/embed-sdk
// sdk.openSignatureFlow({ sessionId: session.sessionId })

Configuration

const chaindoc = new Chaindoc({
  secretKey: "sk_xxx", // Required - Your secret API key
  environment: "production", // Optional: 'production' | 'staging' | 'development'
  timeout: 30000, // Optional: Request timeout in ms (default: 30000)
  retry: {
    // Optional: Retry configuration
    maxRetries: 3,
    initialDelay: 1000,
    maxDelay: 10000,
  },
});

Environments

| Environment | API URL | Use Case | | ------------- | ----------------------------------- | ----------------------- | | production | https://api.chaindoc.io (default) | Live production traffic | | staging | https://api-demo.chaindoc.io | Pre-release testing | | development | https://api-demo.chaindoc.io | Development & debugging |

API Overview

Documents

// Create document
await chaindoc.documents.create({
  name: string;
  description: string;
  media: Media;
  hashtags: string[];
  status: 'draft' | 'published';
  accessType?: 'private' | 'public' | 'restricted';
});

// Update document (creates new version)
await chaindoc.documents.update(documentId, params);

// Update access rights
await chaindoc.documents.updateRights(documentId, {
  accessType: 'restricted',
  accessEmails: [{ email: '[email protected]', level: 'read' }],
});

// Verify document in blockchain
await chaindoc.documents.verify({ versionHash: '0x...' });

// Get verification status
await chaindoc.documents.getVerificationStatus(versionId);

Signatures

// Create signature request
await chaindoc.signatures.createRequest({
  versionId: string;
  recipients: [{ email: string, shareToken?: string }];
  deadline: Date;
  embeddedFlow?: boolean;
  isKycRequired?: boolean;
});

// Get request status
await chaindoc.signatures.getRequestStatus(requestId);

// Get all requests
await chaindoc.signatures.getMyRequests({ pageNumber: 1, pageSize: 10 });

// Sign document
await chaindoc.signatures.sign({ requestId, signatureId });

Embedded Sessions

// Create session for frontend signing (sends OTP to email)
const session = await chaindoc.embedded.createSession({
  email: '[email protected]',
  metadata: {
    documentId: string;
    signatureRequestId?: string;
    returnUrl?: string;
  },
});
// Returns sessionId for @chaindoc_io/embed-sdk

Media

// Upload files (PDF, DOC, images, videos)
const { media } = await chaindoc.media.upload([file1, file2]);

KYC

// Share KYC data for pre-verification
await chaindoc.kyc.share({
  email: "[email protected]",
  shareToken: "sumsub_share_token",
});

Utility

// Get API key info
await chaindoc.getApiKeyInfo();

// Health check
await chaindoc.healthCheck();

Error Handling

import { Chaindoc, ChaindocError } from '@chaindoc_io/server-sdk';

try {
  await chaindoc.documents.create({ ... });
} catch (error) {
  if (error instanceof ChaindocError) {
    console.error('API Error:', error.message);
    console.error('Status:', error.statusCode);
    console.error('Response:', error.response);
  }
}

Documentation

Requirements

Related Packages

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Security

For security vulnerabilities, please see our Security Policy.

License

MIT License - see LICENSE file for details.

Support


Made with ❤️ by the Chaindoc team