davidafsilva / jkeychain

Simple Java API to operate on macOS keychain generic passwords

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jKeychain

Master Build Status Latest Release License

This is a fork of conormcd/osx-keychain-java, which has been updated and published to an OSS repository.

The exposed keychain API has been compiled to support both x86/64 and arm64 architectures.

Usage

Import

  1. Add maven central repository to your configuration
  2. Import the library

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("pt.davidafsilva.apple:jkeychain:1.1.0")
}

Maven

<dependencies>
    <dependency>
        <groupId>pt.davidafsilva.apple</groupId>
        <artifactId>jkeychain</artifactId>
        <version>1.1.0</version>
    </dependency>
</dependencies>

Example:

final OSXKeychain keychain = OSXKeychain.getInstance();
final Optional<String> appKey = keychain.findGenericPassword("application", "key");

Build

To build locally, you need JavaJDK >= 1.8 and macOS >= 11. Make sure that you have a softlink to your jdk at /Library/Java/JavaVirtualMachines/openjdk.jdk. Please run the command below to execute the tests and build the final package (jar).

$ ./gradlew build

Integration

To test the integration with locally modified versions of the API, you can:

  1. Commit the changes to your local branch (fork)
  2. Build and publish a new snapshot version to your local maven repository
  3. Import the snapshot version in your project.

To accomplish 2. please run the command below.

$ ./gradlew publishToMavenLocal

About

Simple Java API to operate on macOS keychain generic passwords

License:BSD 2-Clause "Simplified" License


Languages

Language:C 48.6%Language:Java 28.4%Language:Kotlin 23.0%