https://github.com/blockstack-packages/blockstack-profiles-py
Blockstack profile creation and verification tools
https://github.com/blockstack-packages/blockstack-profiles-py
Last synced: 6 months ago
JSON representation
Blockstack profile creation and verification tools
- Host: GitHub
- URL: https://github.com/blockstack-packages/blockstack-profiles-py
- Owner: blockstack-packages
- License: mit
- Created: 2016-02-23T16:35:10.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-06T20:37:04.000Z (almost 9 years ago)
- Last Synced: 2025-04-08T16:54:19.893Z (11 months ago)
- Language: Python
- Homepage:
- Size: 74.2 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Blockstack Profiles Python
[](https://circleci.com/gh/blockstack/blockstack-profiles-py)
[](https://pypi.python.org/pypi/blockstack-profiles/)
[](https://pypi.python.org/pypi/blockstack-profiles/)
[](https://pypi.python.org/pypi/blockstack-profiles/)
[](http://slack.blockstack.org/)
### Installation
```bash
$ pip install blockstack-profiles
```
If you have any trouble with the installation, see [the troubleshooting guide](/troubleshooting.md) for guidance on common issues.
### Importing
```python
from blockstack_profiles import (
sign_token, wrap_token, sign_token_records,
validate_token_record, get_profile_from_tokens,
make_zone_file_for_hosted_data,
resolve_zone_file_to_profile
)
```
### Creating Profiles
```python
profile = { "name": "Naval Ravikant", "birthDate": "1980-01-01" }
profile_components = [
{"name": "Naval Ravikant"},
{"birthDate": "1980-01-01"}
]
```
### Tokenizing Profiles
```python
token_records = sign_token_records(profile_components, "89088e4779c49c8c3210caae38df06193359417036d87d3cc8888dcfe579905701")
```
### Verifying Token Records
#### Verifying Against Public Keys
```python
public_key = "030589ee559348bd6a7325994f9c8eff12bd5d73cc683142bd0dd1a17abc99b0dc"
decoded_token = verify_token_record(token_records[0], public_key)
```
#### Verifying Against Addresses
```python
address = "1KbUJ4x8epz6QqxkmZbTc4f79JbWWz6g37"
decoded_token = verify_token_record(token_records[0], address)
```
### Recovering Profiles
```python
profile = get_profile_from_tokens(profile_tokens, "02f1fd79dcd51bd017f71546ddc0fd3c8fb7de673da8661c4ceec0463dc991cc7e")
```
```
>>> print profile
{
"name": "Naval Ravikant",
"birthDate": "1980-01-01"
}
```
### Creating Zone Files
```python
zone_file = make_zone_file_for_hosted_data("naval.id", "https://mq9.s3.amazonaws.com/naval.id/profile.json")
```
```
$ORIGIN naval.id
$TTL 3600
@ IN URI "https://mq9.s3.amazonaws.com/naval.id/profile.json"
```
### Resolving Zone Files to Profiles
```python
profile = resolve_zone_file_to_profile(zone_file)
```