Guest User

Untitled

a guest
Oct 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. $ git clone https://github.com/physion/osx-keychain-java
  2. $ mvn install
  3. $ cp dist/osxkeychain.jar ~/myproject/external
  4.  
  5. <dependency>
  6. <groupId>us.physion</groupId>
  7. <artifactId>osx-keychain</artifactId>
  8. <version>1.0</version>
  9. <scope>system</scope>
  10. <systemPath>${project.basedir}/external/osxkeychain.jar</systemPath>
  11. </dependency>
  12.  
  13. osx-keychain-java$ jshell -cp ./dist/osxkeychain.jar
  14.  
  15. jshell> import com.mcdermottroe.apple.*;
  16. jshell> OSXKeychain keychain = OSXKeychain.getInstance();
  17. keychain ==> com.mcdermottroe.apple.OSXKeychain@2286778
  18.  
  19. jshell> keychain.addGenericPassword("aardvark", "a", "b");
  20.  
  21. jshell> keychain.findGenericPassword("aardvark", "a");
  22. $4 ==> "b"
  23.  
  24. <dependency>
  25. <groupId>net.east301</groupId>
  26. <artifactId>java-keyring</artifactId>
  27. <version>1.0.0</version>
  28. </dependency>
  29.  
  30. import net.east301.keyring.Keyring;
  31. import net.east301.keyring.PasswordRetrievalException;
  32.  
  33. Keyring keyring = Keyring.create();
  34. String pw = keyring.getPassword(service, account);
  35.  
  36. compile 'pt.davidafsilva.apple:jkeychain:1.0.0'
  37.  
  38. final OSXKeychain keychain = OSXKeychain.getInstance();
  39. final Optional<String> mySecret = keychain.findGenericPassword("mySecret", "username");
Add Comment
Please, Sign In to add comment