@1auth/authn
Advanced tools
Comparing version 0.0.0-alpha.45 to 0.0.0-alpha.46
27
index.js
@@ -63,3 +63,3 @@ import { setTimeout } from 'node:timers/promises' | ||
const type = makeType(credentialOptions) | ||
const credentials = await options.store.selectList( | ||
const items = await options.store.selectList( | ||
options.table, | ||
@@ -75,4 +75,4 @@ { | ||
const list = [] | ||
for (let i = credentials.length; i--;) { | ||
const credential = credentials[i] | ||
for (let i = items.length; i--;) { | ||
const item = items[i] | ||
// TODO need filter for expire | ||
@@ -82,10 +82,10 @@ // if (credential.expire < now) { | ||
// } | ||
const { encryptionKey: encryptedKey } = credential | ||
delete credential.encryptionKey | ||
const decryptedCredential = symmetricDecryptFields( | ||
credential, | ||
const { encryptionKey: encryptedKey } = item | ||
delete item.encryptionKey | ||
const decryptedItem = symmetricDecryptFields( | ||
item, | ||
{ encryptedKey, sub }, | ||
options.encryptedFields | ||
) | ||
list.push(decryptedCredential) | ||
list.push(decryptedItem) | ||
} | ||
@@ -182,2 +182,3 @@ return list | ||
) | ||
const now = nowInSeconds() | ||
let valid | ||
@@ -201,3 +202,7 @@ for (const credential of credentials) { | ||
if (otp) { | ||
await options.store.remove(options.table, { id, sub }) | ||
await options.store.update( | ||
options.table, | ||
{ id, sub }, | ||
{ update: now, expire: now, lastused: now } | ||
) | ||
} else if (credentialOptions.clean) { | ||
@@ -219,3 +224,5 @@ await credentialOptions.clean(sub, value, values) | ||
await timeout | ||
if (!valid) throw new Error('401 Unauthorized') | ||
if (!valid) { | ||
throw new Error('401 Unauthorized') | ||
} | ||
return sub | ||
@@ -222,0 +229,0 @@ } |
{ | ||
"name": "@1auth/authn", | ||
"version": "0.0.0-alpha.45", | ||
"version": "0.0.0-alpha.46", | ||
"description": "", | ||
@@ -53,4 +53,4 @@ "type": "module", | ||
"dependencies": { | ||
"@1auth/crypto": "0.0.0-alpha.45" | ||
"@1auth/crypto": "0.0.0-alpha.46" | ||
} | ||
} |
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
8444
264
+ Added@1auth/crypto@0.0.0-alpha.46(transitive)
+ Added@node-rs/argon2@2.0.2(transitive)
+ Added@node-rs/argon2-android-arm-eabi@2.0.2(transitive)
+ Added@node-rs/argon2-android-arm64@2.0.2(transitive)
+ Added@node-rs/argon2-darwin-arm64@2.0.2(transitive)
+ Added@node-rs/argon2-darwin-x64@2.0.2(transitive)
+ Added@node-rs/argon2-freebsd-x64@2.0.2(transitive)
+ Added@node-rs/argon2-linux-arm-gnueabihf@2.0.2(transitive)
+ Added@node-rs/argon2-linux-arm64-gnu@2.0.2(transitive)
+ Added@node-rs/argon2-linux-arm64-musl@2.0.2(transitive)
+ Added@node-rs/argon2-linux-x64-gnu@2.0.2(transitive)
+ Added@node-rs/argon2-linux-x64-musl@2.0.2(transitive)
+ Added@node-rs/argon2-wasm32-wasi@2.0.2(transitive)
+ Added@node-rs/argon2-win32-arm64-msvc@2.0.2(transitive)
+ Added@node-rs/argon2-win32-ia32-msvc@2.0.2(transitive)
+ Added@node-rs/argon2-win32-x64-msvc@2.0.2(transitive)
- Removed@1auth/crypto@0.0.0-alpha.45(transitive)
- Removed@node-rs/argon2@2.0.0(transitive)
- Removed@node-rs/argon2-android-arm-eabi@2.0.0(transitive)
- Removed@node-rs/argon2-android-arm64@2.0.0(transitive)
- Removed@node-rs/argon2-darwin-arm64@2.0.0(transitive)
- Removed@node-rs/argon2-darwin-x64@2.0.0(transitive)
- Removed@node-rs/argon2-freebsd-x64@2.0.0(transitive)
- Removed@node-rs/argon2-linux-arm-gnueabihf@2.0.0(transitive)
- Removed@node-rs/argon2-linux-arm64-gnu@2.0.0(transitive)
- Removed@node-rs/argon2-linux-arm64-musl@2.0.0(transitive)
- Removed@node-rs/argon2-linux-x64-gnu@2.0.0(transitive)
- Removed@node-rs/argon2-linux-x64-musl@2.0.0(transitive)
- Removed@node-rs/argon2-wasm32-wasi@2.0.0(transitive)
- Removed@node-rs/argon2-win32-arm64-msvc@2.0.0(transitive)
- Removed@node-rs/argon2-win32-ia32-msvc@2.0.0(transitive)
- Removed@node-rs/argon2-win32-x64-msvc@2.0.0(transitive)
Updated@1auth/crypto@0.0.0-alpha.46