Skip to content

About

Identisure API client for Java/Kotlin

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Identisure JVM Client

Maven Central Documentation MIT license

API client for the Identisure REST API on the JVM (Java, Kotlin, Scala).

Documentation: identisure.github.io/api-client-jvm

Requirements

Java 17 or later.

Supported providers

  • BankID SE: auth, sign, phone auth and sign, QR verify, age verification
  • BankID NO: auth, backchannel auth, sign, age verification
  • Freja eID: auth, backchannel auth, sign, backchannel sign, age verification
  • MitID: auth, backchannel auth, sign, age verification
  • FTN (Finnish Trust Network): auth, age verification
  • Vipps MobilePay: auth, backchannel auth
  • Documents: upload and download documents for signing

Installation

Gradle (Kotlin DSL)

// Java only
implementation("com.identisure:identisure-client:0.1.0")

// Kotlin coroutines extensions
implementation("com.identisure:identisure-client-kotlin:0.1.0")

Maven

<dependency>
    <groupId>com.identisure</groupId>
    <artifactId>identisure-client</artifactId>
    <version>0.1.0</version>
</dependency>

Usage

import com.identisure.client.Environment;
import com.identisure.client.IdentisureClientBuilder;
import com.identisure.client.models.BankIdSeAuthRequest;
import com.identisure.client.models.BankIdSeStatus;

void main() {
    var client = new IdentisureClientBuilder("client_id", "client_secret")
        .environment(Environment.STAGING)
        .build();
    var bankIdSe = client.bankIdSe();

    bankIdSe.auth(new BankIdSeAuthRequest())
        .thenCompose(session -> bankIdSe.waitForAuth(((BankIdSeStatus.Pending) session).id))
        .thenAccept(result -> System.out.println(result))
        .join();
}

Kotlin

import com.identisure.client.*
import com.identisure.client.models.*

suspend fun main() {
    val client = identisureClient("client_id", "client_secret") {
        environment(Environment.STAGING)
    }

    val session = client.bankIdSe().authAsync(BankIdSeAuthRequest()) as BankIdSeStatus.Pending
    val result = client.bankIdSe().waitForAuthAsync(session.id)
    println(result)
}

Verifying callbacks

boolean valid = CallbackSignature.verify(rawBody, request.getHeader("X-Signature-SHA256"), hmacSecret);

Development

Prerequisites

The tests use shared fixtures from a git submodule. Clone with --recurse-submodules, or run git submodule update --init in an existing clone:

$ git clone --recurse-submodules https://github.com/identisure/api-client-jvm.git

Build

To compile the project, simply issue the following command:

$ gradle compileJava
$ gradle compileKotlin

Test

Unit Testing
$ gradle test

Format and lint

Formatting is checked with Spotless (palantir-java-format for Java, ktfmt for Kotlin). Compiler warnings fail the build.

$ gradle spotlessCheck
$ gradle spotlessApply

Release

Set the version in gradle.properties and core/src/main/java/com/identisure/client/IdentisureClientBuilder.java and commit. Then push a tag:

$ git tag v0.1.0
$ git push origin v0.1.0

The release workflow checks that the tag matches the version, runs CI, publishes to Maven Central and creates a GitHub release.

Other languages

C#, Dart, Go, TypeScript/JavaScript, PHP, Python, Ruby, Rust, Swift

About

Identisure API client for Java/Kotlin

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages