OathDeviceSettings createDeviceProfile(int minSharedSecretLength){
  Reject.ifFalse(minSharedSecretLength >= 0,"minSharedSecretLength must not be negative");
  int sharedSecretByteLength=Math.max(MIN_SHARED_SECRET_BYTE_LENGTH,(int)Math.ceil(minSharedSecretLength / 2d));
  byte[] secretBytes=new byte[sharedSecretByteLength];
  secureRandom.nextBytes(secretBytes);
  String sharedSecret=DatatypeConverter.printHexBinary(secretBytes);
  return new OathDeviceSettings(sharedSecret,DEVICE_NAME,INITIAL_LAST_LOGIN_TIME,INITIAL_COUNTER_VALUE);
}

OathDeviceSettings createDeviceProfile ( int minSharedSecretLength ) { Reject . ifFalse ( minSharedSecretLength >= 0 , "minSharedSecretLength must not be negative" ) ; int sharedSecretByteLength = Math . max ( MIN_SHARED_SECRET_BYTE_LENGTH , ( int ) Math . ceil ( minSharedSecretLength / 2d ) ) ; byte [ ] secretBytes = new byte [ sharedSecretByteLength ] ; secureRandom . nextBytes ( secretBytes ) ; String sharedSecret = DatatypeConverter . printHexBinary ( secretBytes ) ; return new OathDeviceSettings ( sharedSecret , DEVICE_NAME , INITIAL_LAST_LOGIN_TIME , INITIAL_COUNTER_VALUE ) ; }
creates and saves a fresh device profile for the given user . this will generate a fresh random shared secret for the device , and initialise the counter and last login times to 0 , ensuring a valid device profile is present for device registration .
