Skip to main content

TUPAS URL verification and signing

Project description

[![Build Status](https://api.travis-ci.org/adarshk7/tupas_verisigner.png)](https://api.travis-ci.org/adarshk7/tupas_verisigner)

# TUPAS Verisigner

## Introduction

This package can be used to:

* Receive a TUPAS request URL and parse it.
* Calculate the signature using a shared input secret and query params.
* Compare it to the signature in the URL.
* And, generate a response URL with new signature based on an shared output secret.


## Usage

```
from tupas_versigner import TupasVerisigner

signer = TupasVerisigner(
input_secret, # Shared input secret.
output_secret, # Shared output secret.
base_output_url, # Base URL for the response.
error_url # Error URL to return if signature verification fails.
encoding='Windows-1252' # Optional, default: 'Windows-1252'
)

signer.verify_and_sign_url(url)
```

For example,

```
from tupas_versigner import TupasVerisigner

signer = TupasVerisigner(
'inputsecret',
'outputsecret'
'http://otherserver.com',
'http://otherserver.com/error.html'
)

url = (
'http://someserver.com/?B02K_VERS=0003&B02K_TIMESTMP=50020181017141433899056&'
'B02K_IDNBR=2512408990&B02K_STAMP=20010125140015123456&B02K_CUSTNAME=FIRST%20'
'LAST&B02K_KEYVERS=0001&B02K_ALG=03&B02K_CUSTID=9984&B02K_CUSTTYPE=02&B02K_MA'
'C=EBA959A76B87AE8996849E7C0C08D4AC44B053183BE12C0DAC2AD0C86F9F2542'
)

signer.verify_and_sign_url(url)
```

> http://otherserver.com/?firstname=First&lastname=Last&hash= 4f6536ca2a23592d9037a4707bb44980b9bd2d4250fc1c833812068ccb000712


## Tests

`pip install -r requirements.txt`


### Unit tests

`pytest`


### Linting

`flake8 .`
`isort --recursive --diff . && isort --recursive --check-only .`


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

tupas_verisigner-0.0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

tupas_verisigner-0.0.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file tupas_verisigner-0.0.1.tar.gz.

File metadata

  • Download URL: tupas_verisigner-0.0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for tupas_verisigner-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8a5a9fa8e099e6f34b386af69143d3fede0e2a4b7b3dfe2cfce961e8e93d6e88
MD5 083d83769e28e0c3816ceb1f57ea5521
BLAKE2b-256 4be627128b57b1b3f220dd920917051b4509d81e0310685846995d0b3703aa3d

See more details on using hashes here.

File details

Details for the file tupas_verisigner-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tupas_verisigner-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for tupas_verisigner-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 15805cced2c2887096267c2a5b31fb0c3f789167057813af4b66467d8e4e65db
MD5 1b6b94fab4dafadc5638e270735649cc
BLAKE2b-256 0b2c79877c675046b611c4e603593622cb8596e327203a7cdcf1c45309042b0c

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