Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@1auth/authn

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@1auth/authn - npm Package Compare versions

Comparing version 0.0.0-alpha.17 to 0.0.0-alpha.18

20

./index.js

@@ -7,3 +7,5 @@ import { setTimeout } from 'node:timers/promises'

notify: undefined,
table: 'credentials',
table: 'authentications',
idGenerate: true,
idPrefix: 'authn',
authenticationDuration: 500, // min duration authentication should take (ms)

@@ -13,3 +15,3 @@ usernameExists: [] // hooks to allow what to be used as a username

export default (params) => {
Object.assign(options, params)
Object.assign(options, { id: randomId }, params)
}

@@ -23,4 +25,2 @@ export const getOptions = () => options

) => {
const now = nowInSeconds()
id ??= await randomId.create()
const type = parentOptions.id + '-' + parentOptions[credentialType].type

@@ -38,6 +38,6 @@ const otp = parentOptions[credentialType].otp

)
await options.store.insert(options.table, {
const now = nowInSeconds()
const params = {
expire,
...rest,
id,
sub,

@@ -50,3 +50,9 @@ type,

update: now
})
}
if (options.idGenerate) {
id ??= await options.id.create(options.idPrefix)
params.id = id
}
// TODO returning id
await options.store.insert(options.table, params)
return id

@@ -53,0 +59,0 @@ }

@@ -7,3 +7,5 @@ import { setTimeout } from 'node:timers/promises'

notify: undefined,
table: 'credentials',
table: 'authentications',
idGenerate: true,
idPrefix: 'authn',
authenticationDuration: 500, // min duration authentication should take (ms)

@@ -13,3 +15,3 @@ usernameExists: [] // hooks to allow what to be used as a username

export default (params) => {
Object.assign(options, params)
Object.assign(options, { id: randomId }, params)
}

@@ -23,4 +25,2 @@ export const getOptions = () => options

) => {
const now = nowInSeconds()
id ??= await randomId.create()
const type = parentOptions.id + '-' + parentOptions[credentialType].type

@@ -38,6 +38,6 @@ const otp = parentOptions[credentialType].otp

)
await options.store.insert(options.table, {
const now = nowInSeconds()
const params = {
expire,
...rest,
id,
sub,

@@ -50,3 +50,9 @@ type,

update: now
})
}
if (options.idGenerate) {
id ??= await options.id.create(options.idPrefix)
params.id = id
}
// TODO returning id
await options.store.insert(options.table, params)
return id

@@ -53,0 +59,0 @@ }

{
"name": "@1auth/authn",
"version": "0.0.0-alpha.17",
"version": "0.0.0-alpha.18",
"description": "",

@@ -53,4 +53,4 @@ "type": "module",

"dependencies": {
"@1auth/crypto": "0.0.0-alpha.17"
"@1auth/crypto": "0.0.0-alpha.18"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc