import IDCard from '../native/IDCard';
import { tryIt } from '../utils/helper';

export const scan = async () => {
  try {
    await IDCard.open();
    await tryIt(10, async () => IDCard.authenticate(150), 10);
    return await tryIt(10, async () => IDCard.read(2300), 10);
  } finally {
    await IDCard.close();
  }
};
