Skip to content

peacemakr-io/peacemakr-python-sdk

Repository files navigation



Peacemakr E2E-Encryption-as-a-Service Python SDK

Build Status

Peacemakr's E2E-Encryption-as-a-Service SDK simplifies your data security with E2E-Encryption service and automated key lifecycle management.

You can easily encrypt your data without worrying about backward compatibility, cross platform portability, or changing security requirements.

Our Zero-Trust capability allows you to customize your security strength to meet the highest standard without having to place your trust in Peacemakr as we don’t have the capacity to get your keys and decrypt your data.

We take security and trust very seriously. If you believe you have found a security issue, please responsibly disclose by contacting us.

License

The content of this SDK is open source under Apache License 2.0.

Documentation

See the API docs

Installation

Install from pip

pip install --upgrade peacemakr

Install from pip3 on mac,

python3 -m pip install peacemakr

Install from source

python setup.py install

FAQ

  1. In Linux, peacemakr-core-crypto-cpp.so is not found but the file is there.
  • Solution: "export LD_LIBRARY_PATH=:/usr/local/lib" >> ~/.bashrc

Requirements

Python 3.6+

Usage

The library requires your API key from the dashboard which is available at https://admin.peacemakr.io/.

Set the API key and initialize the persister to start using the SDK.

import peacemakr as p
import peacemakr.factory as factory

api_key = "api-key"
persister = p.InMemoryPersister()
sdk = factory.get_crypto_sdk(api_key=api_key,
                                client_name="hello world",
                                peacemakr_hostname="https://api.peacemakr.io",
                                persister=persister
                                )

# Required call. Registers your client. Requires network connectivity.
sdk.register()

# Optional call, used to sync configs. Requires network connectivity.
sdk.sync()

Protecting your Data with Peacemakr's E2E-Encryption-as-a-Service

It's straightforward to encrypt and decrypt anything with peacmekar library

import os

random_bytes = os.urandom(100)

# To protect data, invoke encrypt. Does not require network connectivity.
encrypted_bytes = sdk.encrypt(random_bytes)
print(encrypted_bytes)

# To operate on protected data, invoke decrypt. Does not require network connectivity.
decrypted_bytes = sdk.decrypt(encrypted_bytes)
print(decrypted_bytes)

Contributing

We appreciate all contributions. Some basic guidelines are here, for more informaton see CONTRIBUTING.md

Issues:

  • Please include a minimal example that reproduces your issue
  • Please use the tags to help us help you
  • If you file an issue and you want to work on it, fantastic! Please assign it to yourself.

PRs:

  • All PRs must be reviewed and pass CI
  • New functionality must include new tests