Local Authentication and Device ID tips


#1

I am new to Ionic. I want to locally create a user and authenticate them on the local device. This is not at all connected to an API or external service.

It runs like this:

  • Register some user info and credentials including a pin number on first app launch
  • On every app launch after that the user just enters their pin number

This credentials are kept to help keep things in in order locally. But most important is to always know the device by periodically re-generating the device ID to compensate for the iOS world.

We use the user details and App/Device ID to ID the user and update our side with only a hashed API Key.

I hope this makes sense.

Do you know a way to do it?


#2

Hi @theCrab,

Can you clear some stuff up for me?:

  1. When you say device id, are you referring to the uuid or just some random string key that you generate on the device?
  2. You mentioned that this is not connected to an API or external service, but then you mention an API key on “our side”. So are you planning to use this server side?

It would probably help if you wrote a list with your exact planned logic flow. I personally had some trouble determining what you wanted to do.

If you just want to generate a secure key, why don’t you just do the following psuedocode:

preHash = userDefinedPin + device.uuid
postHash = hmac(preHash)

If this is what you were after, take a look at jsSha:

Regards,