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

typescript-lib-example-caui

v0.1.4

Published

This library helps to integrate with signer extensions

Downloads

2

Readme

Web API Docs

Here some instructions to make website communicate with the extension

Lib Path

The lib is a JS/TS file that create functions to run commands direct from webpage to extension. TS file are located at web-lib-generator\src\sign.ts JS file can be generated by the command yarn build-lib, and the minified js file will be generated at web-lib-generator\dist\Sign.min.js

Using Lib

const SITE = window.location.protocol + "//" + window.location.host

const MY_KEY = btoa(JSON.stringify({sitesEnabled: [SITE]}))

  1. Import Lib (Sign.min.js or sign.ts)
  2. Instantiate the signer object passing the key const signer = new Sign(MY_KEY)
  3. Use methods from signer object (sign, getCertificates, hasSoftware, hasExtension)

Types

interface Certificate {
  isValid: boolean
  issuer: string
  name: string
  notAfter: string
  notBefore: string
  pem: string
  provider: string
  specialName: string
  type: string
  personId?: string
}

interface Signature {
  key: number
  signature: string
}

interface ErrorResponse {
  level: "BACKGROUND" | "CONTENT" | "CLI" | "LIB" | "EXTENSION_RUNTIME" // specify where the error occurred
  error: string // user friendly message
  code: number // code based on error level, explained later...
  originalErrorMessage?: string // original error message if it exist (set if level is "EXTENSION_RUNTIME" or "CLI")
}

Error Codes

All error codes can be found at ../extension-ts/shared/errorMessagesAndCodes.ts Code

Functions

List certificates

const searchResponse = await signer.getCertificates()
// will return: Certificate[] | ErrorResponse

Sign

const dataToSignArray = [{
  dataToSign, // string of data to sign
  key: 1,
}]
const signResponse = await signer.sign({ dataToSignArray, certificate })
// will return: Signature[] | ErrorResponse

Has Extension

const hasExtension = await signer.hasExtension() // timeout = 1000ms
// wil return: true | ErrorResponse

Has Software

const hasSoftware = await signer.hasSoftware() // timeout = 1000ms
// wil return: true | ErrorResponse

Download extension

const  = await signer.downloadExtension()
// wil return: void | ErrorResponse
// void response will open a new tab with the download link

Download software

const  = await signer.downloadSoftware()
// wil return: void | ErrorResponse
// void response will open a new tab with the download link