@1auth/authn
Advanced tools
Comparing version 0.0.0-alpha.17 to 0.0.0-alpha.18
@@ -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 @@ } |
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 @@ } |
{ | ||
"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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12075
336
+ Added@1auth/crypto@0.0.0-alpha.18(transitive)
- Removed@1auth/crypto@0.0.0-alpha.17(transitive)
Updated@1auth/crypto@0.0.0-alpha.18