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

uport-appuser

v0.2.2

Published

Lightweight App User Identities

Downloads

4

Readme


title: "uPort AppUser" index: 0 category: "appuser" type: "reference" source: "https://github.com/uport-project/appuser/blob/develop/README.md"

uPort AppUser

uPort AppUser allows you to build a User model for your decentralized or wannabe decentralized app. It brings back some of the niceties of running a centralized app, while protecting both you and your users from accidental leaking private data.

Features:

  • Actionable usage metrics such as DAU, browser distribution etc without relying on Google
  • Strictly partition and interactions into the following buckets
    • Private to your user
    • Shared between you and your user
    • Meta data for permissioned tracking
  • Share usage metrics with your community and investors
  • Strong Encryption
  • Extremely Lightweight (20kb)

Web Sites

Quick Script Tag installation

If you are familiar with installing traditional analytics platforms all you have to do is add the following snippet at the bottom of your html page.

<script language=“javascript” src=“https://unpkg.com/uport-appuser” />
<script language="javascript">
window.user = AppUser.init()
user.track('buy.tokens', {private: {address: '0x...'}, claims: {success: true}, shared: {amount: 123})
</script>

That’s it. Once you’ve deployed it go to https://metrics.uport.me/ enter your domain name and watch the data come in.

Share your results on social media to your community.

Advanced JavaScript Installation

In your web project add the uport-appuser package to your project.

npm install --save uport-appuser

Initialize the framework with:

import AppUser from 'uport-appuser'

// Wherever you initialize your app initialize the tracker
const user = new AppUser()

// This will automatically track page visits,

// Track specific events within your app and add optional data along. Don’t worry only your customer and you can access this
user.track('buy.tokens', {private: {address: '0x...'}, claims: {success: true}, shared: {amount: 123})

Setup Application Identity

All user data is encrypted and can only be accessed by your users. To access the raw data yourself you need to publish a Decentralized Identifiers (DIDs) Document containing your encryption public key.

DID Document

Create a DID document and place it in the following directory on your website:

https://example.com/.well-known/did.json

A minimal DID Document might contain the following information:

{
  "@context": 'https://w3id.org/did/v1',
  "id": 'did:https:example.com',
  "publicKey": [{
       id: 'did:https:example.com#owner',
       type: 'Secp256k1VerificationKey2018',
       owner: 'did:https:example.com',
       ethereumAddress: '0xb9c5714089478a327f09197987f16f9e5d936e8a'},
       {
    "id": "did:https:example.com#encrypt",
  	"type": 'Curve25519EncryptionPublicKey',
"publicKeyBase58":"H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"
	}],
  authentication: [{
       type: 'Secp256k1SignatureAuthentication2018',
       publicKey: 'did:https:example.com#owner'}]
  },
  "services": [{
    "id": "did:https:example.com;events",
    "type": "EventService",
    "serviceEndpoint": "https://appuser.uport.me/api/v1/events"
  }]
}

Note this has to have a public key using Curve25519EncryptionPublicKey.

Encryption is performed using tweetnacl. The Public key is created using box.keyPair() and Base64 encoded.

Create a DDO document easily

npm install --save appuser
./node_modules/.bin/create-appuser-ddo https://example.com > did.json

It will display a private key that you should store somewhere safe.