global

def add_recovery_code

def add_recovery_code
  # This should never raise uniqueness violations unless the recovery code is the same, and the odds of that
  # are 1/256**32 assuming a good random number generator.  Still, attempt to handle that case by retrying
  # on such a uniqueness violation.
  retry_on_uniqueness_violation do
    recovery_codes_ds.insert(recovery_codes_id_column=>session_value, recovery_codes_column=>new_recovery_code)
  end
end