Skip to main content

SingleSource Python SDK

The high level software development kit (SDK) to participate in the decentralised SingleSource identity eco-system in Python.

Overview

High level helpers available for:

  • Identity Request Service (idrs) - Support for generating ephemeral encryption key pairs (X25519 ECDH), messaging service topics and serialisation/deserialisation of these.
  • Attestations (attestations) - Making (foreign) claim sets and making attestations on them.

Installation

To install use pip:

$ pip install pysinglesource

Or clone the repo:

$ git clone git@bitbucket.org:mysinglesource/pysinglesource.git
$ python setup.py install

Set up and activate for Python 3:

virtualenv ${HOME}/.virtualenvs/pysinglesource \
           --system-site-packages --python=/usr/bin/python3
source ${HOME}/.virtualenvs/pysinglesource/bin/activate

Install required packages:

pip install -e .

For installing the additional development, testing or documentation dependencies, add a qualifier with one or more of these commands:

pip install -e .[dev]       # Development dependencies
pip install -e .[test]      # Testing dependencies
pip install -e .[dev,test]  # All dependencies together

Usage

Identity Request Service Handler

When using the ID Request Service to create well-formed (selective disclosure) requests, usually also a messaging service is used in conjunction. Due to the sensitive nature, responses usually need to be end-to-end encrypted, as the messaging service is not under the user's control.

For this purpose an 'ephemeral handler' is available. It will generate an ephemeral encryption key pair as well as a suitable messaging service topic. The ephemeral handler can be serialised and deserialised at ease to be persisted using strings (e.g. in any used DB system).

Notes:

  • The handler is supposed to be unguessable and for single-use and a particular purpose on the messaging service only. After completion, a new handler is to be used.
  • The serialised data is confidential and needs to be protected. It MUST NOT leak out, or the communication can be retrospectively decrypted by anybody who has intercepted the message and this serialised handler.

A receiving side would continuously poll on the messaging service (e.g. every 2 seconds) using the handler's topic, checking for a submitted response. The message returned then would contain encrypted content, for which the ephemeral (private) key is required to access it. Therefore, it makes sense to store the messaging service topic under an indexed field, and the serialised handler value in the same record.

from singlesource import EphemeralHandler

handler = EphemeralHandler()

# Get the messaging topic for the Identity Request Service.
topic = handler.messaging_topic
# Get the serialised handler for storage (with the topic) in a DB.
serialised_data = handler.serialise()

# After receiving a response message with encrypted content, use the
# serialised handler to re-build it.
handler = EphemeralHandler(serialised_data)
# Get the encryption JWK object for use with encrypted message data.
jwk = handler.jwk

Contributing

TBD

Example

TBD

Licence

Copyright 2018-2019 by SingleSource Limited, Auckland, New Zealand

This work is licensed under the Apache 2.0 open source licence. Terms and conditions apply.

Metadata

Release files for pysinglesource 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysinglesource 0.1.3
File Size Uploaded Provenance
pysinglesource-0.1.3.tar.gz 14.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pysinglesource 0.1.3
File Interpreter ABI Platform
pysinglesource-0.1.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 39.1 kB

Release files / pysinglesource-0.1.3.tar.gz

Download URL pysinglesource-0.1.3.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f55711edfadc28f4aa514067fc94d56c923fca828d7b10adc3b5da50c9aa2830
BLAKE2b-256 checksum
How to use checksums
c7dd3bad46db19f3a45d030b23b92efff7ad96f64a876397de0945d1d799b2d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release files / pysinglesource-0.1.3-py2.py3-none-any.whl

Download URL pysinglesource-0.1.3-py2.py3-none-any.whl
Size 24.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b2735e52ee0f374274e3b3808847cc4986c3b36357454965a7c2ac9093c97756
BLAKE2b-256 checksum
How to use checksums
f222a78833866a97928f41b1a8099dbbab27ccf5cb15ad2491761c37514738c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Security for pysinglesource 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page