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

@zcloak/wallet-lib

v0.1.4

Published

zCloak web wallet package

Downloads

8

Readme

wallet-lib

This is a web wallet developed based on zkid-sdk, which supports use in Chrome extension and web pages.

Get Start

await utils.initCrypto();

const didAccounts = new DidAccounts();

await didAccounts.isReady;

DidAccounts

Manages a collection of DID accounts and provides operations for account management.

public async generate(mnemonic: string, passphrase: string, alias?: string): Promise<DidAccount>

Generates a new DID account from a mnemonic.

  • mnemonic: The mnemonic for generating the account.
  • passphrase: The passphrase to secure the account.
  • alias (optional): An alias for the generated account.

public async unlock(passphrase: string)

Unlocks the wallet with a passphrase.

  • passphrase: The passphrase used to unlock the wallet.

public async importDidFile(json: DidKeys$Json, password: string, alias?: string): Promise<DidAccount>

Imports a DID account from a JSON representation.

  • json: The JSON representation of the account.
  • password: The password to decrypt the account.
  • alias (optional): An alias for the imported account.

public exportDidFile(id: DidUrl): DidKeys$Json

Exports a DID account as a JSON representation.

  • id: The DID URL of the account to export.

private async addAccount(account: DidAccount)

Adds a DidAccount instance to the collection and updates related data.

  • account: The DidAccount instance to add.

public async removeAccount(id: DidUrl): Promise<void>

Removes a DID account from the collection and related data.

  • id: The DID URL of the account to remove.

get current(): DidAccount | null

Returns the currently selected DidAccount instance or null if no account is selected.

get accounts(): DidAccount[]

Returns an array of all DidAccount instances in the collection.

WalletKeyring

WalletKeyring is a specialized keyring for managing key pairs, providing wallet-specific functionality. You can override it if you need.

store

Used @zcloak/ui-store

browser

  • BrowserStore
  • BrowserSession

extension

  • ExtensionSession
  • ExtensionStore

Utility Functions

mnemonicGenerate

Creates a valid mnemonic string using using BIP39.

mnemonicValidate

Validates a mnemonic input using BIP39.

isPairKey(key: string): key is string

Checks if a given string key is a key pair identifier key.

  • key: The string key to check.
  • Returns true if the key is a key pair identifier key, false otherwise.

isDidKey(key: string): key is string

Checks if a given string key is a DID (Decentralized Identifier) identifier key.

  • key: The string key to check.
  • Returns true if the key is a DID identifier key, false otherwise.

DidAccount

The DidAccount class represents a DID (Decentralized Identifier) account and provides methods for managing the account and associated metadata.

constructor(did: Did, store: BaseStore)

  • did: The Did instance associated with the account.
  • store: A BaseStore instance for data storage.

Properties

isReady: Promise<this>

  • A promise that resolves when the DidAccount instance is ready for use.

Methods

public async storeMeta(meta: DidAccountMeta)

Stores metadata associated with the account.

  • meta: Metadata to store for the account.

public async storeDocument()

Stores the document associated with the account.

public async remove(): Promise<void>

Removes the account and associated metadata from storage.

Getters

instance: Did

  • Returns the Did instance associated with the account.

metaKey

  • Returns the key used to store metadata associated with the account.

meta: DidAccountMeta

  • Returns the metadata associated with the account.

License

This project is open source and available under the MIT License.