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 🙏

© 2025 – Pkg Stats / Ryan Hefner

use-eimzo

v3.0.2

Published

React va TypeScript ilovalarida raqamli imzolar bilan ishlash uchun oddiy paket.

Downloads

41

Readme

use-eimzo

use-eimzo — bu React hooki bo‘lib, E-IMZO (Elektron Imzo) bilan ishlashni osonlashtiradi. U ID-card, BAIK token yoki sertifikat kalitlaridan PKCS#7 yaratish, kalitlarni ro‘yxatlash va API key’larni boshqarishni qo‘llab-quvvatlaydi.

O'rnatish

Paketni npm yoki yarn orqali o'rnating:

npm install use-eimzo

yoki

yarn add use-eimzo

Xususiyatlar

  • E-IMZO versiyasini tekshirish (checkVersion)
  • API key’larni o‘rnatish (install, addApiKey)
  • Foydalanuvchi kalitlarini ro‘yxatlash (listAllKeys)
  • Sertifikat kaliti bilan PKCS#7 yaratish (signKey)
  • ID-card bilan PKCS#7 yaratish (signIdCard)
  • BAIK token bilan PKCS#7 yaratish (signBaik)

Foydalanish

EImzoProvider

EImzoProvider komponenti yordamida ilovangizni o'rab oling, bu E-IMZO skriptining to'g'ri yuklanishini ta'minlaydi.

import { EImzoProvider } from 'use-eimzo'

function App() {
  return (
    <EImzoProvider>
      <YourComponent />
    </EImzoProvider>
  )
}

useEImzo Hook

useEImzo hookidan foydalanib, E-IMZO funksiyalariga kirish mumkin.

import React, { useEffect, useState } from 'react'
import { useEImzo } from 'use-eimzo'
import type { Cert } from 'use-eimzo/types'

const MyComponent = () => {
  const { listAllKeys, signKey, signIdCard, signBaik, addApiKey, install } = useEImzo()
  const [keys, setKeys] = useState<Cert[]>([])
  const [pkcs7, setPkcs7] = useState<string | null>(null)

  useEffect(() => {
    const init = async () => {
      try {
        await install() // API keys va E-IMZO ni ishga tushirish
        const allKeys = await listAllKeys()
        setKeys(allKeys)
      } catch (err) {
        console.error('E-IMZO init xatolik:', err)
      }
    }
    init()
  }, [])

  const handleSignKey = async (cert: Cert) => {
    try {
      const result = await signKey(cert, 'my-challenge-string')
      setPkcs7(result)
    } catch (err) {
      console.error(err)
    }
  }

  const handleSignIdCard = async () => {
    try {
      const result = await signIdCard('my-challenge-string')
      setPkcs7(result)
    } catch (err) {
      console.error(err)
    }
  }

  const handleSignBaik = async () => {
    try {
      const result = await signBaik('my-challenge-string')
      setPkcs7(result)
    } catch (err) {
      console.error(err)
    }
  }

  return (
    <div>
      <h1>E-IMZO Demo</h1>
      <button onClick={handleSignIdCard}>Sign with ID-card</button>
      <button onClick={handleSignBaik}>Sign with BAIK token</button>
      {keys.map((cert) => (
        <div key={cert.serialNumber}>
          <p>
            {cert.CN} - {cert.TIN}
          </p>
          <button onClick={() => handleSignKey(cert)}>Sign with Certificate</button>
        </div>
      ))}
      {pkcs7 && <pre>{pkcs7}</pre>}
    </div>
  )
}

EimzoDefaultItem Komponenti

EimzoDefaultItem komponentidan sertifikat tafsilotlarini ko'rsatish uchun foydalaning.

import { EimzoDefaultItem } from 'use-eimzo'

function CertificateList({ data }) {
  return (
    <div>
      {data.map((cert, index) => (
        <EimzoDefaultItem key={index} data={cert} />
      ))}
    </div>
  )
}

API

install(): Promise<void> E-IMZO API’ni ishga tushiradi va API key’larni o‘rnatadi.

addApiKey(domain: string, key: string) Berilgan domain va key bilan API key qo‘shadi.

listAllKeys(): Promise<Cert[]> Foydalanuvchi sertifikatlarini ro‘yxatlaydi.

createPkcs7(keyId: string, challenge: string): Promise<string> Berilgan keyId bilan PKCS#7 yaratadi.

signKey(item: Cert, challenge: string): Promise<string> Sertifikat kaliti bilan PKCS#7 yaratadi.

signIdCard(challenge: string): Promise<string> ID-card bilan PKCS#7 yaratadi. Agar karta ulanmagan bo‘lsa, xato qaytaradi.

signBaik(challenge: string): Promise<string> BAIK token bilan PKCS#7 yaratadi. Agar token ulanmagan bo‘lsa, xato qaytaradi.

Talablar

  • Hook faqat browser muhitida ishlaydi.
  • E-IMZO dasturi o‘rnatilgan va ishga tushirilgan bo‘lishi kerak.
  • ID-card va BAIK token ishlashi uchun ularning ulanmaganligini tekshirish zarur.
  • challenge parametri istalgan string bo‘lishi mumkin, bu server tomonidan tekshiriladi.
  • React 17+

Litsenziya

MIT