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

vault-auth-component

v1.7.1

Published

[![build](https://github.com/jerome-bienaime/vaultauth/actions/workflows/npm-build.yml/badge.svg)](https://github.com/jerome-bienaime/vaultauth/actions/workflows/npm-build.yml)

Downloads

26

Readme

Vault Auth Component

build

Vault Auth Component is a library for dealing with vault-fashioned authentication

Installation

Use a nodejs package manager to install Vault Auth Component.

# npm
npm i vault-auth-component

# yarn
yarn add vault-auth-component

# pnpm
pnpm add vault-auth-component

Usage

as a React component

/** @jsxImportSource theme-ui */
// my-component.tsx|jsx

import {
  VaultAuthComponent,
  theme
  } from "vault-auth-component";
import { ThemeUIProvider } from "theme-ui";

export default function MyComponent() {
  // handle click each case
  function click(value: Case) {
    console.log(value)
  }
  // Keypad data coming from external ressource
  const shuffleArray = [
    [ 0,1,2 ],
    [ 3,4,5 ],
    [ 6,7,8 ],
  ]

  // User vault pass
  const vaultPass = [ 1,5,7,9 ]

  // Use theme-ui under the hood
  return <ThemeUIProvider theme={theme}>
  <VaultAuthComponent
    shuffleArray={shuffleArray}
    onCaseClick={click}
    vaultPass={vaultPass}
  />
  </ThemeUIProvider>
}

VaultAuthComponent

| args | status | description | | ------------------- | ------------- | ------------------------------------------- | | shuffleArray | mandatory | visual keypad | | vaultPass | mandatory | user password | | onCaseClick | optional | triggered when user click a Case | | onDeleteClick | optional | triggered when user click the Delete Button | | SubmitButton | optional | SubmitButton custom component | | DeleteButton | optional | DeleteButton custom component | | config | optional | additional config | | config.keypadAccess | default=false | authorize keyboard events | | config.submitButton | default=false | show submit button |

as a library

import { lib } from 'vault-auth-component'

const {
  ShuffleArraySchema,
  ValueInputSchema,
  VaultValidate,
} = lib

/* shuffleArray data validation */
const shuffleArray = ShuffleArraySchema.safeParse(
  [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9],
  ]
)
if (!shuffleArray.success) {
  // throw error
  console.error(shuffleArray.error)
}
// shuffleArray is validated, do anything with it

/* ValueInputSchema data validation */
const valueInput = ValueInputSchema.safeParse([
  1, 2, 3, 4,
])
if (!valueInput.success) {
  //throw error
  console.error(valueInput.error)
}
// valueInput is validated, do anything with it

/* Is vaultPass contained in shuffleArray */
const contained = VaultValidate({
  shuffleArray,
  vaultPass: valueInput,
})
if (!contained) {
  //throw error
  console.error(
    'vaultPass is not contained in shuffleArray'
  )
}

// everything’s fine, do anything with it

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

The repo now has an examples project powered by Storybook. Just run npm run storybook, yarn storybook or pnpm run storybook

License

MIT