Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

18F/identity-proofer-gem

Repository files navigation

Identity Proofer Ruby Gem

Build Status security

Example proofing session

# Create a proofer subclass:
class FooProofer < Proofer::Base
  vendor_name 'foo:resolution'

  attributes :uuid,
             :first_name,
             :last_name,
             :ssn,
             :dob

  stage :resolution

  proof :foo_proof # this also takes a block

  def foo_proof(applicant, result)
    resolution = get_resolution # resolve the identity

    # if something isn't verified, add an error
    result.add_error(:first_name, 'Does not match')

    # if something goes wrong, raise an error
    raise 'failed to auth with the proofing vendor'
  end
end

# Use a vendor subclass
result = FooProofer.new.proof(
  uuid: '1234-asdf-5678-qwerty',
  first_name: 'Bob',
  last_name: 'Roberts',
  ssn: '123456789',
  dob: '01/01/1980'
)

result.success? # returns true or false
result.failed? # returns true or false
result.errors # returns a hash of errors, e.g. { first_name: ['Does not match'] }
result.exception # returns any object that was raised during the `#proof` call

Public domain

This project is in the worldwide public domain. As stated in CONTRIBUTING:

This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.