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

@civic/icp-gateway-react-ui

v0.0.3

Published

Civic Pass ICP React Component

Downloads

29

Readme

ICP Civic Credential Check Button

This React component provides a button for checking and obtaining Civic Pass credentials on the Internet Computer Protocol (ICP) network.

Features

  • Check for existing Civic Pass credentials
  • Obtain new Civic Pass credentials if none exist
  • Configurable for different environments (development/production)
  • Customizable appearance using Emotion CSS

Installation

To use this component, you need to have the following dependencies installed:

npm install @civic/icp-gateway-react-ui

or

yarn add @civic/icp-gateway-react-ui

Usage

import React from 'react';
import { Principal } from '@dfinity/principal';
import ICPCredentialCheckButton from './ICPCredentialCheckButton';

const App = () => {
  const principal = Principal.fromText('your-principal-id');
  const gatekeeperNetwork = 'your-gatekeeper-network';

  const handleCredentialCheck = (response, error) => {
    if (error) {
      console.error('Error checking credential:', error);
    } else {
      console.log('Credential check response:', response);
    }
  };

  return (
    <ICPCredentialCheckButton
      principal={principal}
      gatekeeperNetwork={gatekeeperNetwork}
      onCredentialCheck={handleCredentialCheck}
    />
  );
};

export default App;

Props

| Prop | Type | Description | |------|------|-------------| | principal | Principal | The user's ICP principal | | gatekeeperNetwork | string | The Gatekeeper network for the Civic Pass | | config | Partial<Config> | (Optional) Configuration options | | onCredentialCheck | (response?: CredentialCheckResponse, error?: Error) => void | (Optional) Callback function for credential check results |

Configuration

You can customize the component's behavior by passing a config prop:

<ICPCredentialCheckButton
  principal={principal}
  gatekeeperNetwork={gatekeeperNetwork}
  onCredentialCheck={handleCredentialCheck}
/>

What does the Credential issued by the Civic Canister look like?

The credentials issued by the Civic Canister adhere to the W3C Verifiable Credentials specification, ensuring compatibility and interoperability with various systems and platforms.

Here is an example of a credential the Civic Canister can issue:

{
  "@context": [
    "https://www.w3.org/ns/credentials/v2",
    "https://www.w3.org/ns/credentials/examples/v2"
  ],
  "id": "urn:uuid:6a9c92a9-2530-4e2b-9776-530467e9bbe0",
  "type": ["VerifiableCredential", "CivicPass"],
  "issuer": "did:icp:v0:tglqb-kbqlj-to66e-3w5sg-kkz32-c6ffi-nsnta-vj2gf-vdcc5-5rzjk-jae",
  "expiry": "2024-04-04T00:00:00Z",
  "credentialSubject": {
    "id": "did:icp:user-principal",
    "passType": "ag13vc1KaV5kMjp3Gb5yTq8cyZSnHPVkTHdNJ2fWXk1",
    "status": "ACTIVE",
    "expirationDate": "2024-12-31T23:59:59Z"
  }
}

Styling

The button is styled using Emotion CSS. You can customize the appearance by modifying the buttonStyles constant in the component file.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

We welcome contributions to improve the ICP Credential Check Button! Here are some ways you can contribute:

  1. Report bugs or suggest features by opening an issue.
  2. Submit pull requests to fix issues or add new features.
  3. Improve documentation or add examples.

Please ensure that your code adheres to the existing style and that you've added appropriate tests for your changes.

To contribute:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Support

For support, please email [email protected]. We'll do our best to assist you with any issues or questions you may have about the ICP Civic Credential Check Button.