Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An OpenBadges image baking library that works with PNGs and SVGs
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
test
.gitignore
.jshintrc
.npmignore
.travis.yml
LICENSE-MPL-2.0
Makefile
README.md
index.js
package.json

README.md

openbadges-bakery Build Status

Install

$ npm install openbadges-bakery

CLI Usage

Baking

$ oven [--in ./path/to/image.png] [--out ./path/to/baked-image.png] <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 to bake
  • data: the data to put into the badge. At this point, it should likely be a URL pointing to a badge assertion

callback has the signature function(err, imageData)

bakery.debake(image, callback);

Gets the URL from a baked badge and attempts to retreive the assertion at the other end.

image should be a stream or a buffer

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

bakery.extract(image, callback)

Gets the data from the baked badge.

callback has the signature function (err, data)

Something went wrong with that request. Please try again.