Giter Club home page Giter Club logo

foundation-ur-py's Introduction

UR Implementation in Python -- ported from the C++ Reference Implementation by Blockchain Commons

Introduction

URs ("Uniform Resources") are a method for encoding structured binary data for transport in URIs and QR Codes. They are described in BCR-2020-005.

There is also another reference implementation in Swift: URKit, and a demo app that uses it to display and read multi-part animated QR codes: URDemo.

Installation

The code is not yet available in a package format, so just copy the files into your project.

Dependencies

Either hashlib in a normal Python environment or uhashlib in MicroPython must be available.

Use

  1. Include the source folder in your Python project

  2. Import the encoder and decoder:

    from ur_encoder import UREncoder
    from ur_decoder import URDecoder
    
  3. Write some test code:

        ur = make_message_ur(32767)
        max_fragment_len = 1000
        first_seq_num = 100
        encoder = UREncoder(ur, max_fragment_len, first_seq_num)
        decoder = URDecoder()
        while True:
            part = encoder.next_part()
            decoder.receive_part(part)
            if decoder.is_complete():
                break
    
        if decoder.is_success():
            assert(decoder.result == ur)
        else:
            print('{}'.format(decoder.result))
            assert(False)
    

Notes for Maintainers

Before accepting a PR that can affect build or unit tests, make sure the following command succeeds:

python test.py

Ensure that you add new unit tests for new or modified functionality.

Origin, Authors, Copyright & Licenses

Unless otherwise noted (either in this /README.md or in the file's header comments) the contents of this repository are Copyright © 2020 Foundation Devices, Inc., and are licensed under the spdx:BSD-2-Clause Plus Patent License.

This code is a Python port of the original C++ reference implementation by Blockchain Commons. See Blockchain Commons UR Library for the original version.

Contributing

TBD

We encourage public contributions through issues and pull-requests! Please review CONTRIBUTING.md for details on our development process. All contributions to this repository require a GPG signed Contributor License Agreement.

Questions & Support

If you have questions or problems, please use this repository's issues feature.

Credits

The following people directly contributed to this repository. You can add your name here by getting involved — the first step is to learn how to contribute from our CONTRIBUTING.md documentation.

Name Role Github Email GPG Fingerprint
Ken Carpenter Initial Port @FoundationKen <[email protected]> TBD

Responsible Disclosure

We want to keep all our software safe for everyone. If you have discovered a security vulnerability, we appreciate your help in disclosing it to us in a responsible manner. We are unfortunately not able to offer bug bounties at this time.

We do ask that you offer us good faith and use best efforts not to leak information or harm any user, their data, or our developer community. Please give us a reasonable amount of time to fix the issue before you publish it. Do not defraud our users or us in the process of discovery. We promise not to bring legal action against researchers who point out a problem provided they do their best to follow the these guidelines.

Reporting a Vulnerability

Please report suspected security vulnerabilities in private via email to [email protected] (do not use this email for support). Please do NOT create publicly viewable issues for suspected security vulnerabilities.

The following keys may be used to communicate sensitive information to developers:

Name Fingerprint
[email protected] Coming Soon..

You can import a key by running the following command with that individual’s fingerprint: gpg --recv-keys "<fingerprint>" Ensure that you put quotes around fingerprints that contain spaces.

Version History

0.1.0, 08/20/2020 - Initial release

  • Initial testing release.

foundation-ur-py's People

Contributors

foundationken 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.