Skip to content

blockstack-packages/blockstack-profiles-py

Repository files navigation

Blockstack Profiles Python

CircleCI PyPI PyPI PyPI Slack

Installation

$ pip install blockstack-profiles

If you have any trouble with the installation, see the troubleshooting guide for guidance on common issues.

Importing

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

profile = { "name": "Naval Ravikant", "birthDate": "1980-01-01" }
profile_components = [
    {"name": "Naval Ravikant"},
    {"birthDate": "1980-01-01"}
]

Tokenizing Profiles

token_records = sign_token_records(profile_components, "89088e4779c49c8c3210caae38df06193359417036d87d3cc8888dcfe579905701")

Verifying Token Records

Verifying Against Public Keys

public_key = "030589ee559348bd6a7325994f9c8eff12bd5d73cc683142bd0dd1a17abc99b0dc"
decoded_token = verify_token_record(token_records[0], public_key)

Verifying Against Addresses

address = "1KbUJ4x8epz6QqxkmZbTc4f79JbWWz6g37"
decoded_token = verify_token_record(token_records[0], address)

Recovering Profiles

profile = get_profile_from_tokens(profile_tokens, "02f1fd79dcd51bd017f71546ddc0fd3c8fb7de673da8661c4ceec0463dc991cc7e")
>>> print profile
{
  "name": "Naval Ravikant", 
  "birthDate": "1980-01-01"
}

Creating Zone Files

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

profile = resolve_zone_file_to_profile(zone_file)

About

Blockstack profile creation and verification tools

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages