Coder Social home page Coder Social logo

pinkdiamond1 / crypto-conditions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rfcs/crypto-conditions

0.0 1.0 0.0 117 KB

Composable cryptographic conditionals (signatures, hashes)

Home Page: https://tools.ietf.org/html/draft-thomas-crypto-conditions-03

JavaScript 100.00%

crypto-conditions's Introduction

Crypto-Conditions

Spec

You can find the spec here: https://tools.ietf.org/html/draft-thomas-crypto-conditions-04

The source code for the spec is in src/spec/crypto-conditions.md

Implementations

Known implementations of Crypto Conditions:

(Note that all of the above implementations currently need testing/updating. As soon as we have run a decent sized test suite against the implementations above, we'll provide the results here.)

If you would like to update this list, please feel free to open a pull request against this repository.

Test Vectors

In order to verify the different implementations, we provide a series of test vectors in JSON format. You can find them in the folder test-vectors. Within that folder, they are organized in the following subfolders:

  • valid - These are examples of valid crypto-conditions and their fulfillments. You should run the following tests against these:

    • Parse conditionBinary, serialize as a URI, should match conditionUri.
    • Parse conditionUri, serialize as binary, should match conditionBinary.
    • Parse fulfillment, serialize fulfillment, should match fulfillment.
    • Parse fulfillment and validate, should return true.
    • Parse fulfillment and generate the fingerprint contents
    • Parse fulfillment, generate the condition, serialize the condition as a URI, should match conditionUri.
    • Create fulfillment from json, serialize fulfillment, should match fulfillment.

    If a message field is provided, the condition should be evaluated against the message. Otherwise, an empty message should be passed to the verification function.

  • invalid - These are examples of intrinsically invalid fulfillments, such as an invalid signature or an encoding error.

    • Parse fulfillment and validate, should return error.

Note that we don't provide any test cases for fulfillments that are valid, but don't match the provided condition, because we can just include them in the valid set, which provides the exact condition that the fulfillment should map to. (Which is stricter than testing one of the nearly infinite possible conditions that it doesn't map to.)

Test Vectors Source

The test vectors themselves are generated from example data in the src/test-vectors/ folder. You should never have to worry about that unless you are adding or editing test vectors.

Generating Tests

The ffasn1dump tool is used to produce DER encodings. It is available from http://bellard.org/ffasn1

Generating the Spec

Uses kramdown-rfc2629, xml2rfc and Grunt with Grunt kramdown_rfc2629 task

From root directory of the repo run:

npm install
grunt kramdown_rfc2629

To watch edits to crypto-conditions.md and auto-generate output when changes are saved run:

grunt watch

crypto-conditions's People

Contributors

adrianhopebailie avatar andrew-g-za avatar ca333 avatar justmoon avatar sappenin avatar sbellem avatar ssadler avatar stevenroose avatar

Watchers

 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.