totpgenerator

Generate TOTP verification codes based on encrypted GPG files.
git clone git://git.wimdupont.com/totpgenerator.git
Log | Files | Refs | README | LICENSE

Main.java (738B)


      1 package com.wimdupont;
      2 
      3 import com.bastiaanjansen.otp.TOTPGenerator;
      4 import com.wimdupont.service.ApplicationProperties;
      5 import com.wimdupont.service.GpgService;
      6 
      7 public class Main {
      8 
      9     public static void main(String[] args) {
     10         try {
     11             System.out.println(TOTPGenerator
     12                     .withDefaultValues(new GpgService(ApplicationProperties.getInstance())
     13                             .decrypt(getFileArg(args)))
     14                     .now());
     15         } catch (Exception e) {
     16             e.printStackTrace();
     17         } finally {
     18             System.exit(0);
     19         }
     20     }
     21 
     22     private static String getFileArg(String... args) {
     23         return args.length > 0
     24                 ? args[0]
     25                 : null;
     26     }
     27 }