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

@plantquest/seneca-user-auth

v2.2.0

Published

User management plugin for Seneca using Kinde Auth

Downloads

25

Readme

Seneca

A Seneca.js user management plugin.

@seneca/user

npm version build Coverage Status Maintainability

| Voxgig | This open source module is sponsored and supported by Voxgig. | |---|---|

Description

This module is a plugin for the Seneca framework. It provides a set of common user management actions (register, login etc.).

Install

npm install seneca
npm install seneca-promisify // dependency
npm install seneca-entity // dependency
npm install @seneca/user

Quick example

Register a user and then create an automatic login for testing.

const Seneca = require('seneca')

var seneca = Seneca()
  .use('promisify')
  .use('entity')
  .use('user')

var out = await seneca.post('sys:user,register:user', {
  handle: 'alice'
})

console.log('USER:', out.user)

out = await seneca.post('sys:user,login:user', {
  handle: 'alice',
  auto: true
})

console.log('LOGIN:', out.login)

Detailed Examples

Because Seneca treats messages as first-class citizens, 90% of unit testing can be implemented with message scenarios that also provide detailed usage examples:

Action Patterns

Action Descriptions

« adjust:user,sys:user »

Adjust user status idempotently (activated, etc.).

Parameters

  • active : boolean {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user found',
  user: 'user entity'
}

« auth:user,sys:user »

Authenticate a login using token

Parameters

  • token : string {presence:required}
  • user_fields : array {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if login is active',
  user: 'user entity',
  login: 'user entity'
}

« change:pass,sys:user »

Change user password.

Parameters

  • pass : string
  • repeat : string {presence:optional}
  • verify : string {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if changed',
  user: 'user entity'
}

« change:handle,sys:user »

Change user handle.

Parameters

  • new_handle : string
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if changed',
  user: 'user entity'
}

« change:email,sys:user »

Change user email.

Parameters

  • new_email : string
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if changed',
  user: 'user entity'
}

« change:password,sys:user »

Change user password.

Parameters

  • pass : string
  • repeat : string {presence:optional}
  • verify : string {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if changed',
  user: 'user entity'
}

« check:verify,sys:user »

Check a verfication entry.

Parameters

  • kind : string {presence:optional}
  • code : string {presence:optional}
  • now : number {presence:optional}
  • expiry : boolean {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if valid',
  why: 'string coded reason if not valid'
}

« check:exists,sys:user »

Check user exists.

Parameters

  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user exists',
  user: 'user entity'
}

« cmd:encrypt,hook:password,sys:user »

Encrypt a plain text password string.

Examples

  • cmd:encrypt,hook:password,sys:user,pass:foofoobarbar
    • Result: {ok:true, pass:encrypted-string, salt:string}

Parameters

  • salt : string {presence:optional}
  • pass : string {presence:optional}
  • password : string {presence:optional}
  • rounds : number {presence:optional}

Replies With

{
  ok: '_true_ if encryption succeeded',
  pass: 'encrypted password string',
  salt: 'salt value string'
}

« cmd:pass,hook:password,sys:user »

Validate a plain text password string.

Examples

  • cmd:pass,hook:password,sys:user,pass:goodpassword
    • Result: {ok:true}

Parameters

  • salt : string
  • pass : string
  • proposed : string
  • rounds : number {presence:optional}

Replies With

{
  ok: '_true_ if password is valid',
  why: 'string coded reason if not valid'
}

« get:user,sys:user »

Get user details

Parameters

  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user found',
  user: 'user entity'
}

« list:user,sys:user »

List users

Parameters

  • active : boolean {presence:optional}
  • q : object {presence:optional}

Replies With

{
  ok: '_true_ if user found',
  items: 'user entity item list'
}

« list:login,sys:user »

List logins for a user

Parameters

  • active : boolean {presence:optional}
  • login_q : object {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user found',
  items: 'user entity item list'
}

« list:verify,sys:user »

Create a verification entry (multiple use cases).

Parameters

  • kind : string
  • code : string {presence:optional}
  • once : boolean {presence:optional}
  • valid : boolean {presence:optional}
  • custom : object {presence:optional}
  • expire_point : number {presence:optional}
  • expire_duration : number {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user found',
  verify: 'verify entity'
}

« login:user,sys:user »

Login user

Parameters

  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}
  • auto : boolean {presence:optional}
  • pass : string {presence:optional}

Replies With

{
  ok: '_true_ if user logged in',
  user: 'user entity',
  login: 'login entity'
}

« logout:user,sys:user »

Login user

Parameters

  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}
  • token : string {presence:optional}
  • login_in : string {presence:optional}
  • login_q : object {presence:optional,default:{}}
  • load_logins : boolean {presence:optional}

Replies With

{
  ok: '_true_ if user logged in',
  count: 'number of logouts'
}

« make:verify,sys:user »

Create a verification entry (multiple use cases).

Parameters

  • kind : string
  • code : string {presence:optional}
  • once : boolean {presence:optional}
  • valid : boolean {presence:optional}
  • custom : object {presence:optional}
  • expire_point : number {presence:optional}
  • expire_duration : number {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user found',
  verify: 'verify entity'
}

« register:user,sys:user »

Register a new user

Parameters

  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • user : object {unknown:true}
  • user_data : object {unknown:true}

Replies With

{
  ok: '_true_ if user registration succeeded',
  user: 'user entity'
}

« remove:user,sys:user »

Remove a user

Parameters

  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user removed',
  user: 'user entity'
}

« sys:user,update:user »

Update a user

Parameters

  • user : object {presence:optional}
  • id : string {presence:optional}
  • user_id : string {presence:optional}
  • email : string {presence:optional}
  • handle : string {presence:optional}
  • nick : string {presence:optional}
  • q : object {presence:optional}
  • fields : array {presence:optional}

Replies With

{
  ok: '_true_ if user updated',
  user: 'user entity'
}

License

Copyright (c) 2010-2020, Richard Rodger and other contributors. Licensed under MIT.