Python SDK for atPlatform
Project description
The atPlatform for Python developers - (Beta Version)
This repo contains library, samples and examples for developers who wish to work with the atPlatform from Python code.
Python 3.8 deprecation
This SDK was created to support Python 3.8 (specifically 3.8.1 due to some dependency requirements). As of 7 Oct 2024 Python 3.8 is end-of-life, and will no longer receive security patches. Occordingly we have decided to continue support for 3.8 for another 6 months (on a best efforts basis). From 7 Apr 2025 Python 3.8 will be removed from the test matrix, and pyproject.toml will be bumped to require Python 3.9.
Older versions of this package will of course remain available on PyPI, though they may lack features, fixes and security updates; so it is recommended that you try to update to a more recent Python.
Getting Started
1. Installation
This package can be installed from PyPI with:
pip install atsdk
Alternatively clone this repo and from the repo root:
pip install -r requirements.txt
pip install .
2. Setting up your .atKeys
To run the examples save .atKeys file in the '~/.atsign/keys/' directory.
3. Sending and Receiving Data
There are 3 ways in which data can be sent and received from at server.
-
Using PublicKey
from at_client import AtClient from at_client.common import AtSign from at_client.common.keys import PublicKey atsign = AtSign("@bob") atclient = AtClient(atsign) pk = PublicKey("key", atsign) # Sending data response = atclient.put(pk, "value") print(response) # Receiving Data response = atclient.get(pk) print(response) # Deleting data response = atclient.delete(pk) print(response)
-
Using SelfKey
from at_client import AtClient from at_client.common import AtSign from at_client.common.keys import SelfKey atsign = AtSign("@bob") atclient = AtClient(atsign) sk = SelfKey("key", atsign) # Sending data response = atclient.put(sk, "value") print(response) # Receiving Data response = atclient.get(sk) print(response) # Deleting data response = atclient.delete(sk) print(response)
-
Using SharedKey
from at_client import AtClient from at_client.common import AtSign from at_client.common.keys import SharedKey bob = AtSign("@bob") alice = AtSign("@alice") bob_atclient = AtClient(bob) sk = SharedKey("key", bob, alice) # Sending data response = bob_atclient.put(sk, "value") print(response) # Receiving Data alice_atclient = AtClient(alice) response = alice_atclient.get(sk) print(response) # Deleting data response = bob_atclient.delete(sk) print(response)
CLI Tools
-
REPL - you can use this to type atPlatform commands and see responses; but the best thing about the REPL currently is that it shows the data notifications as they are received. The REPL code has the essentials of what a 'receiving' client needs to do - i.e.
- create an AtClient (assigning a Queue object to its queue parameter)
- start two new threads
- one for the AtClient.start_monitor() task: receives data update/delete notification events (the event data contains the ciphertext)
- the other one calls handle_event() method, which will read the upcoming events in the queue and handle them:
- calling AtClient.handle_event() (to decrypt the notifications and introducing the result as a new event in the queue)
- reading the new event, which contains the decrypted result
- Instructions to run the REPL:
- Run repl.py and choose an atSign using option
1
- Select option
2
. REPL will start and activate monitor mode automatically in a different thread. You can still send commands/verbs. You will start seeing your own notifications (from yourself to yourself) and heartbeat working (noop verb is sent from time to time as a keepalive) - Use
at_talk
or any other tool to send notifications to your atSign from a different atSign. You should be able to see the complete notification, and the encrypted and decrypted value of it.
- Run repl.py and choose an atSign using option
-
REGISTER - use this cli to register new free atsign. Uses onboarding cli to create atkey files.
-
Use following command to run the REGISTER cli using email:
python register.py -e <email>
-
Use following command to run the REGISTER cli using api-key:
python register.py -k <api-key>
-
-
ONBOARDING - use this cli to onboard a new atSign. Once onboarding is complete it creates the all-important keys file. Onboard is a subset of Register.
-
Use following command to run the ONBOARDING cli:
python onboarding.py -a <atsign> -c <cram-secret>
-
-
SHARE - use this cli to share data between 2 atsigns.
-
Use following command to run the SHARE cli:
python share.py -a <atsign> -o <other-atsign> -k <key-name> -s <value>
-
-
GET - use this cli to get shared data between 2 atsigns.
-
Use following command to run the GET cli:
python get.py -a <atsign> -o <other-atsign> -k <key-name>
-
-
DELETE - use this cli to delete any key shared between 2 atsigns.
-
Use following command to run the DELETE cli:
python delete.py -a <atsign> -o <other-atsign> -k <key-name>
-
Open source usage and contributions
This is open source code, so feel free to use it as is, suggest changes or enhancements or create your own version. See CONTRIBUTING.md for detailed guidance on how to setup tools, tests and make a pull request.
Maintainers
This project was created by Umang Shah and is maintained by Chris Swan and Xavier Lin
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file atsdk-0.2.32.tar.gz
.
File metadata
- Download URL: atsdk-0.2.32.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd3cec1614db68d2fb0107f829f2c4c6c840a5885596d1a43a2d581a8ac36c3c |
|
MD5 | 17a23cd1a99821ca209b04a36cb6920c |
|
BLAKE2b-256 | b9be993b743549b18203902a9474c1cb9c97d2a1ebc2bfeac6ae5577d339d640 |
Provenance
The following attestation bundles were made for atsdk-0.2.32.tar.gz
:
Publisher:
build-publish.yml
on atsign-foundation/at_python
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
atsdk-0.2.32.tar.gz
- Subject digest:
cd3cec1614db68d2fb0107f829f2c4c6c840a5885596d1a43a2d581a8ac36c3c
- Sigstore transparency entry: 148415130
- Sigstore integration time:
- Predicate type:
File details
Details for the file atsdk-0.2.32-py3-none-any.whl
.
File metadata
- Download URL: atsdk-0.2.32-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bc2a34e92accde19608a66cc038fe585753ce16bd1cd002054d8744dbf40952 |
|
MD5 | 8cca216e695162f94946c8e84d7094e6 |
|
BLAKE2b-256 | 248bb9b8065d112e51c774e0f60b42184c0daccccf6871eb29ef9b23f7a4c613 |
Provenance
The following attestation bundles were made for atsdk-0.2.32-py3-none-any.whl
:
Publisher:
build-publish.yml
on atsign-foundation/at_python
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
atsdk-0.2.32-py3-none-any.whl
- Subject digest:
8bc2a34e92accde19608a66cc038fe585753ce16bd1cd002054d8744dbf40952
- Sigstore transparency entry: 148415131
- Sigstore integration time:
- Predicate type: