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

@dashkite/zinc

v0.4.0

Published

Manage profiles and Web grants locally in the browser.

Downloads

7

Readme

Zinc

Manage profile and Web capabilities using IndexedDB.

Install

npm i @dashkite/zinc

Use with your favorite bundler.

Scenarios

List All Profiles

If you want to allow for multiple identities, you’ll need a way to list the choices.

profiles = await Profile.all

Create A New Profile

alice = await Profile.create authority, nickname: "alice"

Get Current Profile

alice = await Profile.current

Set Current Profile

Profile.current = alice

Update And Store A Profile

await profile.update -> @data.nickname = "alice"

Create An Adjunct Profile

await profile.createAdjunct authority, nickname: "alice"

Get An Adjunct Profile

await profile.getAdjunct authority

Listen For Changes To A Profile

Profile.on update: (profile) -> console.log "Profile [#{profile.address}] updated"

Add Grants To The Grants Directory

The key and ciphertext variables are the sender’s public encryption key and the Base64 ciphertext of the grants.

alice = await Profile.current
await alice.receive key, ciphertext

Exercise A Grant For Use With A Request

alice = await Profile.current
claim = grants.exercise request

Delete A Profile

alice = await Profile.current
await alice.delete()

API

Conventions:

  • A function or method with a dotted arrow ⇢ yields or returns a Promise
  • The :: indicates the prototype. Ex: Profile::exercise is a method, not a class function.

Profile

Property: Profile.Confidential

Returns the instance of Confidential used by Zinc to generate key pairs and other cryptographic elements, and to perform cryptographic operations.

Function: Profile.on event-handlers

Set event handlers for Profile-related events based on the event-handlers, which is a dictionary of events and handlers. Handlers should be functions that take an optional target argument.

Profile.on update: (profile) -> console.log "Profile [#{profile.address}] updated"

Function: Profile.dispatch event, value

Fire a. Profile-related event. You typically do not need to call this directly.

Event: update → profile

Fired whenever a profile is updated. The updated profile is passed to the event handler.

Function: Profile.create authority, data ⇢ profile

Creates a profile for a given authority and data and stores it. Automatically generates encryption and signature keypairs for use with the profile. Returns a promise for the profile.

Function: Profile.createAdjunct authority, data ⇢ profile

Creates a profile using the address for the current profile for a given authority and data and stores it. Automatically generates encryption and signature keypairs for use with the profile. Returns a promise for the profile.

Function: Profile.getAdjunct authority ⇢ profile

Loads and returns the adjunct profile for given authority. Returns a promise for the profile.

Function: Profile.load authority, address ⇢ profile

Load the profile corresponding to the given authority and address.

Property: Profile.all ⇢ array

Returns a promise for an array of all profiles.

Property: Profile.current ⇢ profile

Gets or sets the current profile. Getter returns a promise for the profile. Returns undefined if the current profile is not set or has been deleted.

Method: Profile::createAdjunct authority, data ⇢ profile

Convenience method for Profile.createAdjunct.

Method: Profile::getAdjunct authority ⇢ profile

Convenience method for Profile.getAdjunct.

Method: Profile::exercise request → claim

Exercise the grant corresponding to the given claim. Returns a claim (a countersigned grant). The request argument must provide path, parameters, and method properties.

Method: Profile::receive key, ciphertext ⇢ undefined

Decrypts a directory of grants from base64 ciphertext using the given base64 encoded sender public encryption key, adds them to the profile’s grants directory, and stores the profile.

Method: Profile::update handler ⇢ undefined

Runs handler bound to profile and stores the profile. Useful for ensuring that profile updates are stored. Promise resolves when the update has been stored.

Method: Profile::delete ⇢ undefined

Deletes the given profile. If this the current profile, Profile.current will return undefined.