Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@startupjs/2fa-manager
Advanced tools
Component for using various two-factor authentication methods.
yarn add @startupjs/2fa-manager
Add the following lines to server/index.js
:
import { initTwoFAManager } from '@startupjs/2fa-manager/server'
Add function to startupjsServer
:
initTwoFAManager(ee, {
providers: [YOUR_PROVIDER1, YOUR_PROVIDER2]
})
You can create your own providers using the Provider
class from @startupjs/2fa-manager/Provider
.
Class Provider(name, send, check)
where:
name
- string, provider name.send()
- function of sending a message with a code.check(code)
- function for checking the validity of the code.
code
- the code to check.import { Provider } from '@startupjs/2fa-manager/Provider'
function init (ee, options) {
return null
}
function send () {
console.log('test code')
}
function check (token) {
if (token === 'test code') {
console.log('Right code')
} else {
console.log('Wrong code')
}
}
export default new Provider('testProvider', init, send, check)
Now this Provider
can be registered with initTwoFaManager
and used by the name testProvider
.
initTwoFaManager(ee, options)
ee
- eventEmitter of server.options
- options object. Contains a list of providers:
providers
- array of providers.Singleton class that contains the following methods:
send(model, session, providerName)
- calls the send
method of the provider providerName
.check(model, session, token, providerName)
- calls the check
method of the provider providerName
.getProviders()
- returns an array of the names of the registered providers.Component for displaying a list of registered providers. Accepts the following props:
providers
- array of provider nameschooseProvider
- function, returns the name of the selected providerFAQs
Two factor authentication meta package
We found that @startupjs/2fa-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.