Giter Club home page Giter Club logo

blockstack-profiles-py's Introduction

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)

blockstack-profiles-py's People

Contributors

jcnelson avatar muneeb-ali avatar shea256 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.