mozilla/openbadges-validator — pull request #9 by toolness (2013-08-22 18:44:03+00:00)
Title: A first attempt at validator.getAssertionGUID().

There is currently no way to represent a badge as a globally unique identifier, which means--among other things--that there is no way to definitively ask an OpenBadges-compliant backpack if a user already has a badge.

This PR proposes a new function called `getAssertionGUID` which takes either a hosted assertion URL or a JWS-signed badge assertion as an argument. If the argument is a hosted assertion URL, then the badge's GUID is simply this URL. However, if the argument is a JWS-signed badge assertion, then the JWS is unpacked and its GUID is a URL with the following representation:

signed-assertion:(origin of assertion.verify.url)/#(assertion.uid)

For example, if the signed assertion's public key is hosted at `https://example.org/public-key` and the assertion's UID is `abcd`, then the assertion's GUID will be `signed-assertion:https://example.org/#abcd`.

Still need to:

- [ ] document this in the README
- [ ] add a `guid` property to the object that the `validator` function returns