$ pip install blockstack-profiles
If you have any trouble with the installation, see the troubleshooting guide for guidance on common issues.
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
)
profile = { "name": "Naval Ravikant", "birthDate": "1980-01-01" }
profile_components = [
{"name": "Naval Ravikant"},
{"birthDate": "1980-01-01"}
]
token_records = sign_token_records(profile_components, "89088e4779c49c8c3210caae38df06193359417036d87d3cc8888dcfe579905701")
public_key = "030589ee559348bd6a7325994f9c8eff12bd5d73cc683142bd0dd1a17abc99b0dc"
decoded_token = verify_token_record(token_records[0], public_key)
address = "1KbUJ4x8epz6QqxkmZbTc4f79JbWWz6g37"
decoded_token = verify_token_record(token_records[0], address)
profile = get_profile_from_tokens(profile_tokens, "02f1fd79dcd51bd017f71546ddc0fd3c8fb7de673da8661c4ceec0463dc991cc7e")
>>> print profile
{
"name": "Naval Ravikant",
"birthDate": "1980-01-01"
}
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"
profile = resolve_zone_file_to_profile(zone_file)