Signature

Required Class: Signature Class

Generating a Signature

Smile ID requires you to transmit a unique signature and timestamp with every job you undertake. While executing jobs using any of our libraries automatically calculates the signature, there may be occasions when you need to utilise our REST API directly or generate signatures independently. For such scenarios, the following sample code can be employed to calculate a signature:

from smile_id_core import Signature

# Initialise
partner_id = "<Put your partner ID here>"  # Log in to the Smile ID portal to find your partner ID
api_key = "<Put your API key here>"  # Retrieve your API key from the Smile ID portal

signature = Signature(partner_id, api_key)

# Generate a signature
signature_dict = signature.generate_signature("<put your custom timestamp>")  # Timestamp is optional

Response

The response will be a dictionary:

{
  'signature': '<the generated signature>',
  'timestamp': '2022-04-03T21:31:47.296Z'
}

Confirming an Incoming Signature

To verify the authenticity of the response received from your callback as genuinely originating from Smile ID, you can confirm the returned signature and timestamp. The sample code provided below can be used to confirm the signature:

from smile_id_core import Signature

# Initialise
partner_id = "<Put your partner ID here>"  # Log in to the Smile ID portal to view your partner ID
api_key = "<Put your API key here>"  # Retrieve your API key from the Smile ID portal

signature = Signature(partner_id, api_key)

# Confirm a signature
confirmed_signature = signature.confirm_signature("<put the received timestamp>", "<put the received signature>")

Response

The response will be a boolean value:

True or False

Last updated