@1auth/authn 0.0.0-alpha.26 → 0.0.0-alpha.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +4 -3
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -84,7 +84,7 @@ export const subject = async (username) => {
84
84
  }
85
85
 
86
86
  export const authenticate = async (username, secret, parentOptions) => {
87
- const timeout = setTimeout(() => {}, options.authenticationDuration)
87
+ const timeout = setTimeout(options.authenticationDuration)
88
88
  const type = parentOptions.id + '-' + parentOptions.secret.type
89
89
 
90
90
  const sub = await subject(username)
@@ -95,7 +95,8 @@ export const authenticate = async (username, secret, parentOptions) => {
95
95
  })
96
96
  let valid, id, encryptionKey
97
97
  for (const credential of credentials) {
98
- if (!credential.verify) continue
98
+ // non-opt credentials must be verified before use
99
+ if (!credential.otp && !credential.verify) continue
99
100
  let { value, encryptionKey: encryptedKey, ...rest } = credential
100
101
  value = await parentOptions.secret.decode(value, encryptedKey, sub)
101
102
  valid = await parentOptions.secret.verify(secret, value, rest)
@@ -135,7 +136,7 @@ export const verifySecret = async (sub, id, parentOptions) => {
135
136
  }
136
137
 
137
138
  export const verify = async (credentialType, sub, token, parentOptions) => {
138
- const timeout = setTimeout(() => {}, options.authenticationDuration)
139
+ const timeout = setTimeout(options.authenticationDuration)
139
140
  const type = parentOptions.id + '-' + parentOptions[credentialType].type
140
141
  let id
141
142
  const credentials = await options.store.selectList(options.table, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1auth/authn",
3
- "version": "0.0.0-alpha.26",
3
+ "version": "0.0.0-alpha.28",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "engines": {
@@ -48,8 +48,8 @@
48
48
  "url": "https://github.com/willfarrell/1auth/issues"
49
49
  },
50
50
  "homepage": "https://github.com/willfarrell/1auth",
51
- "gitHead": "9501bd2647d9dfdbe831068ccfcd7fa3ccc20700",
51
+ "gitHead": "a8ce53307b74b1e4946a100dbaedc5306742909d",
52
52
  "dependencies": {
53
- "@1auth/crypto": "0.0.0-alpha.26"
53
+ "@1auth/crypto": "0.0.0-alpha.28"
54
54
  }
55
55
  }