Add lib/db.js [from mozilla/badgekit-api]