@things-factory/auth-base 7.0.1-alpha.97 → 7.0.1-alpha.99

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/auth-base",
3
- "version": "7.0.1-alpha.97",
3
+ "version": "7.0.1-alpha.99",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -45,5 +45,5 @@
45
45
  "passport-local": "^1.0.0",
46
46
  "popsicle-cookie-jar": "^1.0.0"
47
47
  },
48
- "gitHead": "419f85d2d71cda3be37664fc7cc52f2ec73018fe"
48
+ "gitHead": "78a7b8cb64a9c096f779ae19ebac00e2962c2f23"
49
49
  }
@@ -13,7 +13,7 @@ passport.use(
13
13
  new WebAuthnStrategy(
14
14
  { store },
15
15
  async function verify(id: string, userHandle: Uint8Array, cb) {
16
- const user = await getRepository(User).findOne({ where: { email: userHandle.toString() } })
16
+ const user = await getRepository(User).findOne({ where: { id: userHandle.toString() } })
17
17
  if (!user) {
18
18
  return cb(null, false, { errorCode: AuthError.ERROR_CODES.USER_NOT_FOUND })
19
19
  }
@@ -27,7 +27,7 @@ passport.use(
27
27
  return cb(null, user, credential.publicKey)
28
28
  },
29
29
  async function register(user, id, publicKey, cb) {
30
- const userObject = await getRepository(User).findOne({ where: { email: user.id.toString() } })
30
+ const userObject = await getRepository(User).findOne({ where: { id: user.id.toString() } })
31
31
  const webAuthRepository = getRepository(WebAuthCredential)
32
32
 
33
33
  const oldCredential = await webAuthRepository.findOne({
@@ -1,7 +1,6 @@
1
1
  import util from 'util'
2
2
  import Router from 'koa-router'
3
3
 
4
- import { accepts } from '../utils/accepts'
5
4
  import { setAccessTokenCookie } from '../utils/access-token-cookie'
6
5
  import { store, webAuthnMiddleware } from '../middlewares/webauthn-middleware'
7
6
 
@@ -34,20 +33,20 @@ webAuthnGlobalPublicRouter.post('/auth/signin-webauthn', webAuthnMiddleware, asy
34
33
 
35
34
  webAuthnGlobalPrivateRouter.post('/auth/register-webauthn/challenge', async (context, next) => {
36
35
  const { user } = context.state
37
- const { email, name } = user || {}
36
+ const { id, name } = user || {}
38
37
 
39
38
  const challenge = await challengeAsync(
40
39
  { ...context.request, session: context.session },
41
40
  {
42
41
  user: {
43
- id: email
42
+ id
44
43
  }
45
44
  }
46
45
  )
47
46
 
48
47
  context.body = {
49
48
  user: {
50
- id: Buffer.from(email).toString('base64'),
49
+ id: Buffer.from(id).toString('base64'),
51
50
  name: name,
52
51
  displayName: name
53
52
  },