jberkel / android-plugin

An sbt plugin for Android development in Scala
https://groups.google.com/forum/#!forum/scala-on-android
Other
476 stars 113 forks source link

System keyring integration for apk signing #201

Open naufraghi opened 10 years ago

naufraghi commented 10 years ago

I have seen that there is some integration only with the Os X keyring, perhaps using a library can help a lot. Using Scala + sbt to write seamlessly integrated OSX Apps has a section explaining the use of the Netbeans keyring module (cited from the site):

It consists of two parts: A platform-independent API and implementations of this API for all major operating systems. Currently there are implementations for OSX, Windows, KDE, Gnome, SPI and a fallback using a Java keystore. We start by adding all of that to our build.sbt:

libraryDependencies ++= Seq(
  "org.netbeans.api" % "org-netbeans-modules-keyring" % "RELEASE721",
  "org.netbeans.modules" % "org-netbeans-modules-keyring-impl" % "RELEASE721"
)

resolvers += "netbeans" at "http://bits.netbeans.org/maven2/"

Usage is straightforward, once you know that the keyring only stores char arrays:

private val keyName = "doctivity"

def readToken =
   Keyring.read(keyName) match {
      case null  => None
      case chars => Some(chars.mkString)
   }

 def storeToken(token: String) {
   Keyring.save(keyName, token.toCharArray, "access token for doctivity")
 }

 def deleteToken {
   Keyring.delete(keyName)
 }
pfn commented 10 years ago

Interesting request. However this keyring implementation is unsuitable for use on windows.

naufraghi commented 10 years ago

In fact on windows there is the Windows Credential Vault, it is supported in https://bitbucket.org/kang/python-keyring-lib and I'm using the "spawn-some-service" solution already in gradle: http://stackoverflow.com/a/22597752/317518

On Wed, Jul 16, 2014 at 9:41 PM, Perry notifications@github.com wrote:

Interesting request. However this keyring implementation is unsuitable for use on windows.

— Reply to this email directly or view it on GitHub https://github.com/jberkel/android-plugin/issues/201#issuecomment-49216217 .

Matteo Bertini http://www.slug.it/naufraghi

pfn commented 10 years ago

I'm not saying keychain support in general won't work on windows. I'm pointing out that the keyring library you pointed out is unsuitable for windows.

naufraghi commented 10 years ago

OK, sorry, I often forget that windows is used as a non-only-gaming-but-also-development platform too :)