Gathering detailed insights and metrics for pouchorm-auth
Gathering detailed insights and metrics for pouchorm-auth
Gathering detailed insights and metrics for pouchorm-auth
Gathering detailed insights and metrics for pouchorm-auth
Authentication methods for PouchORM collections, using the Pouch Server Auth module.
npm install pouchorm-auth
Typescript
Module System
Node Version
NPM Version
55.9
Supply Chain
89.2
Quality
67.7
Maintenance
25
Vulnerability
98.4
License
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
8 Commits
1 Watchers
13 Branches
1 Contributors
Updated on Jan 26, 2020
Latest Version
1.0.0
Package Id
pouchorm-auth@1.0.0
Unpacked Size
30.83 kB
Size
8.82 kB
File Count
18
NPM Version
6.13.1
Node Version
13.3.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
A plugin for PouchORM - the definitive ORM for working with PouchDB.
This plugin makes it easy to use a PouchORM collection as an authentication backend. This leverages the great PouchDB-Auth plugin written for PouchDB Server.
npm i pouchorm-auth
or if you prefer yarn:
yarn add pouchorm-auth
Make sure to also install pouchorm
as a dependency of your project using npm
or yarn
.
Consider this definition of a collection which uses the built-in exported model PouchUser
.
1// Person.ts 2 3 import { PouchCollection, PouchORM } from 'pouchorm'; 4 import { PouchUser, createPouchAuthCollection } from 'pouchorm-auth' 5 6 PouchORM.LOGGING = true; // enable diagnostic logging if desired 7 8 export class UserCollection extends PouchCollection<PouchUser> { 9 } 10
Now that we have defined our Collection for that model, here is how we instantiate authentication collections.
1 2 // instantiate a collection by giving it the dbname it should use 3 let userCollection = new UserCollection('usersdb'); 4 5 // Transform the collection. 6 userCollection = createPouchAuthCollection<PouchUser>(userCollection) 7 8 export userCollection 9
From this point:
We are ready to start authenticating!
1 import { PouchUser } from 'pouchorm-auth' 2 import { userCollection } from '...' 3 4 // Using collections 5 let somePerson: PouchUser = await userCollection.signUp( 6 'jeanluc@picard.net', 7 'Darmok and Jalad at Tanagra', 8 { 9 age: 24, 10 email: 'jeanluc@picard.net' 11 } 12 ) 13 14 somePerson = await personCollection.logIn('jeanluc@picard.net', 'Darmok and Jalad at Tanagra'); 15 16 // somePerson has been persisted and will now also have some metafields like _id, _rev, etc. 17 18 // Some data to be updated, which would need an upsert merge deltaFunction 19 // so that the password is not lost from the existing record 20 somePerson.age = 45; 21 somePerson = await personCollection.upsert(somePerson, (existing) => { ...existing, ...somePerson }); 22 23 // changes to somePerson has been persisted. _rev would have also changed. 24 25 const result: PouchUser[] = await personCollection.find({age: 45}) 26 27 // result.length === 1 28
Consider that T
is the provided type or class definition of your model. It is recommended that User models extend from class PouchUser
to retain special logic designed to work with Pouch and Couch.
createPouchAuthCollection<T>(collection: PouchCollection<T>)
These methods were added to provide collection-specific functionality
userId(username: string) => string
checkAuthInit() => Promise<void>
useAsAuthCollection() => Promise<void>
stopUsingAsAuthCollection() => void
These methods are wrappers for functionality provided by pouchdb-auth
; see their documentation for specifics
signUp(username: string, password: string, options?: PouchAuth.SignUpOptions) => Promise<T>
logIn(username: string, password: string) => Promise<T> | Promise<void>
logOut() => Promise<PouchAuth.LoginResponse>
session() => Promise<PouchAuth.SessionResponse>
PRs are welcome. NOTE: Tests required for new PR acceptance. Those are easy to make as well.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/8 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
48 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More