Skip to main content

A wrapper library for candid-based temporal authentication

Project description

temporal-lib-py

This library provides a partial wrapper for the Client.connect method from temporalio/sdk-python by adding candid-based authentication and encryption.

Building

This library uses poetry for packaging and managing dependencies. To build the wheel file simply run:

poetry build -f wheel

Usage

The following code shows how a client connection is created using by using the original (vanilla) temporalio sdk:

from temporalio.client import Client
async def main():
    client = await Client.connect("localhost:7233")
    ...

In order to add authorization and encryption capabilities to this client we replace the connect call as following:

from temporallib.connection import Connection, Options
from temporallib.auth import AuthOptions, KeyPair
from temporallib.encryption import EncryptionOptions
async def main():
    # alternatively options could be loaded from a yalm file as the one showed below
    cfg = Options(
        host="localhost:7233",
        auth=AuthOptions(keys=KeyPair(...))
        encryption=EncryptionOptions(key="key")
        ...
    )
    client = await Connection.connect(cfg)
	...

The structure of the YAML file which can be used to construct the Options is as following:

host: 'localhost:7233'
queue: 'test-queue'
namespace: 'test'
encryption:
  key: 'HLCeMJLLiyLrUOukdThNgRfyraIXZk918rtp5VX/uwI='
auth:
  macaroon_url: 'http://localhost:7888/macaroon'
  username: 'test'
  keys:
    private: 'MTIzNDU2NzgxMjM0NTY3ODEyMzQ1Njc4MTIzNDU2Nzg='
    public: 'ODc2NTQzMjE4NzY1NDMyMTg3NjU0MzIxODc2NTQzMjE='
tls_root_cas: |
  'base64 certificate'

Samples

More examples of workflows using this library can be found here:

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

temporal_lib_py-0.1.1-py3-none-any.whl (18.8 kB view hashes)

Uploaded Python 3

Supported by

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