Skip to main content

Simplified SDK for MOSIP Authentication

Project description

Mosip Authentication SDK

MOSIP Authentication SDK is a Python wrapper for interacting with the MOSIP Authentication Service, enabling developers to integrate authentication workflows into their systems. The SDK simplifies the interaction with MOSIP's backend authentication services, providing methods to authenticate individuals based on demographic data, biometrics, and other identifiers.

Controllers

MOSIP provides two main authentication controllers:

  1. kyc-auth-controller
    Used for Know Your Customer (KYC) authentication, which includes verifying identity using demographic data and biometrics.
    API Documentation

  2. auth-controller
    Used for general authentication of individuals, allowing for verification based on a variety of identifiers and biometric data.
    API Documentation

Methods

kyc Method

kyc(individual_id: str, individual_id_type: str, demographic_data: DemographicsModel, otp_value: str = None, biometrics: list[BiometricModel] = None, consent: bool = False) -> Response

auth Method

auth(individual_id: str, individual_id_type: str, demographic_data: DemographicsModel, otp_value: Optional[str] = None, biometrics: Optional[List[BiometricModel]] = None, consent: bool = False) -> Response

Common Parameters

  • individual_id (str): The unique ID of the individual to authenticate (e.g., VID, UIN)
  • individual_id_type (str): The type of the ID being used (e.g., VID, UIN)
  • demographic_data (DemographicsModel): The demographic data for the individual (e.g., name, address)
  • otp_value (Optional[str]): The One-Time Password (OTP) value, if applicable (default is None)
  • consent (bool): Indicates whether consent has been obtained for authentication (default is False)

Installation

pip install mosip_auth_sdk

Usage

from mosip_auth_sdk import MOSIPAuthenticator
from mosip_auth_sdk.models import DemographicsModel, BiometricModel

# Initialize the authenticator with configuration settings
authenticator = MOSIPAuthenticator(config={
    # Your configuration settings go here.
    # Refer to authenticator-config.toml for the required values.
})

# Prepare demographic data
demographics_data = DemographicsModel(
    # Provide demographic details based on your needs
)

# Make a KYC request
response = authenticator.kyc(
    individual_id='<some_id>',  # Replace with actual ID
    individual_id_type='VID',  # Replace with the type of ID being used
    demographic_data=demographics_data,
    otp_value='<otp_value>',  # Optional
    biometrics=biometrics,  # Optional
    consent=True  # Indicates if consent has been obtained
)

# Handle the response
response_body = response.json()
errors = response_body.get('errors', [])

if errors:
    # Handle errors
    pass
else:
    # Process the successful response
    decrypted_response = authenticator.decrypt_response(response_body)
    # Further processing with decrypted_response

Development Setup

Prerequisites

  • Python 3 (tested on 3.10.7)
  • Poetry (recommended, optional)

Install Poetry

python3 -m pip install poetry

Install Dependencies

Using Poetry:

python3 -m poetry install

Using pip:

python3 -m pip install -r requirements.txt

Build

python3 -m poetry build

Publish

python3 -m poetry publish

Testing

Example code is available in the examples folder. To test:

python examples/main.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mosip_auth_sdk-0.5.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mosip_auth_sdk-0.5.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file mosip_auth_sdk-0.5.0.tar.gz.

File metadata

  • Download URL: mosip_auth_sdk-0.5.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.7 Linux/5.10.0-33-amd64

File hashes

Hashes for mosip_auth_sdk-0.5.0.tar.gz
Algorithm Hash digest
SHA256 86ef4a88e6b87f945ea1243c20f181fd830b92685a7992d1428bfca779f76c58
MD5 563ae9cc2703f6b9f0c5a04535ac798e
BLAKE2b-256 075faa10f1e5af04c6c93351c17f5012c0c1d481365ec90c78283c95dd9c77b5

See more details on using hashes here.

File details

Details for the file mosip_auth_sdk-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: mosip_auth_sdk-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.7 Linux/5.10.0-33-amd64

File hashes

Hashes for mosip_auth_sdk-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ffb37dc255d0c10dc6d1ee9734e103416d6c252566f0dfbf93d3847875b8f96a
MD5 fd6c09947e01fdda3d56d13dfc4a811f
BLAKE2b-256 e5b7168c753739fea752441e151f6d33faf3f1ad70b15634338aabb419046c6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page