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

poc-sdk-auth

v1.1.7

Published

Prova de Conceito de uma SDK que renderiza uma tela de login

Downloads

558

Readme

POC SDK de Autenticação

Esta Prova de Conceito (POC) para uma SDK de autenticação visa fornecer uma maneira simplificada e padronizada para implementar telas de login, recuperação de senha e autenticação multifator (MFA) em aplicações front-end.

Recursos

  • Renderização de componente de autenticação.
  • Suporte para temas claros e escuros.
  • Manipulação de eventos de login como sucesso, erro, esqueci minha senha e primeiro acesso.

Estrutura do Projeto

O projeto está dividido em vários módulos principais:

  • src/: Contém os componentes principais da SDK, incluindo o inicializador e os componentes de login.
  • src/components/: Componentes reutilizáveis, incluindo o componente de login.
  • src/themes/: Temas (claro e escuro) disponíveis para os componentes.
  • src/utils/: Funções utilitárias, como a função para transformar componentes em tela cheia.

Configuração

Este projeto utiliza TypeScript e é construído com Vite. Para configurar o ambiente de desenvolvimento e construir o projeto, siga os passos abaixo:

  1. Instale as dependências com npm install.
  2. Execute o comando npm run dev para iniciar o servidor de desenvolvimento.
  3. Utilize npm run build para gerar os arquivos de produção.

Testes

Execute npm run test para rodar os testes unitários e verificar a integridade dos componentes e suas funcionalidades.

Integração

Vanilla (HTML/JS)

  1. Inclua o script gerado no build no seu arquivo HTML.

    <script src="https://unpkg.com/poc-sdk-auth@latest/dist/mfa-sdk.umd.js"></script>
  2. Inicialize a SDK e renderize o componente de autenticação:

    const sdk = MfaSdk.init({
      environment: "DEV",
      clientToken: "token-aqui",
      themeConfig: {
        theme: "light",
        assets: { logo: "https://v4.vitejs.dev/logo.svg" },
      },
    });
    
    const componenteLogin = sdk.renderAutenticacao();
    
    componenteLogin.on("sucesso", () => {
      alert("Autenticado com sucesso");
    });
    
    componenteLogin.on("erro", () => {
      alert("Usuário ou senha inválido");
    });
  3. Inclua o container de autenticação no seu HTML:

    <div id="aegis-autenticacao"></div>

React (Next.js)

  1. Instale a SDK como dependência:

    npm install poc-sdk-auth
  2. Importe o SDK de autenticação:

    useEffect(() => {
      import("poc-sdk-auth").then((module) => {
        const sdk = module.init({
          environment: "DEV",
          clientToken: "token",
          themeConfig: {
            theme: "light",
            assets: { logo: "https://nextjs.org/icons/next.svg" },
          },
        });
    
        const component = sdk.renderAutenticacao();
        component.on("erro", () => {
          console.log("Erro ao logar");
        });
      });
    }, []);
  3. Adicione o container de autenticação no JSX:

    <div id="aegis-autenticacao"></div>

Angular

  1. Instale a SDK como dependência:

    npm install poc-sdk-auth
  2. Inicialize o SDK e renderize o componente de autenticação no ngOnInit:

    import { Component } from "@angular/core";
    import { init } from "poc-sdk-auth";
    
    @Component({
      selector: "app-root",
      templateUrl: "./app.component.html",
      styleUrl: "./app.component.css",
    })
    export class AppComponent {
      ngOnInit(): void {
        const sdk = init({
          environment: "DEV",
          clientToken: "token",
          themeConfig: {
            theme: "light",
            assets: {
              logo: "https://v17.angular.io/assets/images/logos/angular/[email protected]",
            },
          },
        });
    
        const component = sdk.renderAutenticacao();
        component.on("erro", () => {
          console.log("Erro ao logar");
        });
      }
    }
  3. Inclua o container de autenticação no template HTML:

    <div id="aegis-autenticacao"></div>