Identisure Ruby Client

Gem version Documentation MIT license

API client for the Identisure REST API.

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

Requirements

Ruby 3.2 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

gem install identisure-client

Or add to your Gemfile:

gem 'identisure-client', '~> 0.1'

Usage

require 'identisure/client'

client = Identisure::ClientBuilder.new('client_id', 'client_secret')
                                  .environment(Identisure::Environment::STAGING)
                                  .build

session = client.bank_id_se.auth(Identisure::BankIdSe::AuthRequest.new)
puts "Session ID: #{session.id}" if session.is_a?(Identisure::BankIdSe::Pending)

result = client.bank_id_se.wait_for_auth(session.id)

case result
in Identisure::BankIdSe::Completed(ssn:, name:)
  puts "Authenticated: #{name} (#{ssn})"
in Identisure::BankIdSe::Failed(error:)
  puts "Failed: #{error}"
end

Verifying callbacks

Verify the X-Signature-SHA256 header against the raw request body before parsing it:

valid = Identisure.verify_callback_signature(raw_body, signature_header, 'hmac_secret')

Development

Prerequisites

  • Ruby 3.2+
  • Bundler

Setup / Build / Test

The test fixtures live in a Git submodule. Clone with --recurse-submodules, or run git submodule update --init in an existing clone.

bundle install
bundle exec rake test

Release

Set the version in lib/identisure/version.rb 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 RubyGems and creates a GitHub release.

Other languages

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