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

aid-js-sdk

v0.1.16

Published

client SDK for aid wallet

Downloads

25

Readme

aidjs

the user client SDK for aid system

installation

yarn add aid-js-sdk

Core Components

AidType

An enumeration defining the types of assistance:

enum AidType {
    P2p = "p2p",
    Server = "server",
    Blockchain = "blockchain",
    Full = "full"
}

Interfaces

  1. ContractInfo

    • ContractAddress: string
    • BlockChainUrl: string
  2. ServerInfo

    • ServerAddress: string
  3. AidCert (extends ContractInfo and ServerInfo)

    • Aid: string (UUID)
    • CertType: AidType
    • Claims: Record<string, any>
    • Setting: Record<string, any>
    • VerifyOptions: Record<string, any>

Classes

Aid

Represents a complete assistance instance.

Properties:

  • aid: string
  • certs: Map<string, AidCert>
  • privateMsg: Map<string, string>
  • data: Map<string, string>

Methods:

  • constructor(aid: string, certs: Map<string, AidCert>, privateMsg: Map<string, string>, data: Map<string, string>)
  • static fromStr(str: string): Aid
  • toStr(): string
  • addCert(cert: AidCert, privateMsg: string)
  • removeCert(timestamp: string)
  • listCerts(): { timestamp: string, cert: AidCert, privateMsg: string }[]
  • getData(key: string): string
  • setData(key: string, value: string)

AidPreview

Provides a preview of an Aid instance.

Properties:

  • aid: string
  • descriptions: Map<string, string>

Methods:

  • constructor(aid: string, descriptions: Map<string, string>)
  • static fromStr(str: string): AidPreview
  • toStr(): string

AidList

Manages a collection of AidPreviews and default user information.

Properties:

  • defaultUserInfos: Map<string, string>
  • aids: AidPreview[]

Methods:

  • Constructor(defaultUserInfosZip: string, aidsZip: string)
  • newAidList() : AidList
  • export(): { defaultUserInfosZip: string, aidsZip: string }
  • addAid(aid: AidPreview)
  • removeAid(aid: string)
  • listAids(): AidPreview[]
  • findAid(aid: string): AidPreview

Notes and Considerations

  1. The system uses string timestamps as keys for certificates and their associated private messages within an Aid instance.

  2. The AidCert interface combines blockchain and server information, suggesting it can be used in various contexts.

  3. The Aid class allows for storing and retrieving arbitrary string data through its data property.

  4. The system provides serialization and deserialization methods (toStr and fromStr) for Aid and AidPreview instances, facilitating data persistence and transfer.

  5. The AidList class uses compressed JSON strings for initialization, which may be useful for efficient data transfer or storage.

  6. Error handling is not explicitly implemented in the provided code. Consider adding appropriate error checks and exception handling in a production environment.

  7. The system doesn't include any authentication or authorization mechanisms. Implement these as needed for your specific use case.

  8. Be cautious when using Record<string, any> for Claims, Setting, and VerifyOptions in AidCert. Consider using more specific types if the structure of these objects is known.