Code Monkey home page Code Monkey logo

openbadges-bakery's Introduction

openbadges-bakery Build Status

An OpenBadges image baking library that works with PNGs and SVGs

Install

$ npm install openbadges-bakery

CLI Usage

Baking

$ oven [--in ./path/to/image.svg] [--out ./path/to/baked-image.svg] <data>

If --out is not set, the baked image will print to stdout.

The input file can also be piped into stdin.

$ oven <data> <  ./path/to/image.png  > ./path/to/baked-image.png

Extracting

$ oven [--in path/to/image.png] --extract

Same as above, you can also pipe a file to stdin. The data will be printed to stdout.

Libary Usage

bakery.bake(options callback);

Bakes some data into an image.

Options are

  • image: either a buffer or a stream representing the PNG or SVG to bake
  • assertion: assertion to save into the image (optional)
  • signature: JSON Web Signature representing a signed OpenBadges assertion (optional)

You must pass either assertion or signature

callback has the signature function(err, imageData)

bakery.extract(image, callback)

Gets the raw data from the badge. This could be a URL, assertion in JSON format or a signature.

callback has the signature function (err, data)

bakery.debake(image, callback);

bakery.getAssertion(image, callback);

Gets the assertion from the badge. If the assertion is remote, this will require an HTTP request. If the assertion is baked into the badge, either directly or as part of a signature, this will pull the local copy.

image should be a stream or a buffer

callback has the signature function (err, object) where object is expected to be a OpenBadges assertion.

openbadges-bakery's People

Contributors

auralon avatar brianloveswords avatar cmcavoy avatar potch avatar simonwex avatar stenington 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.