box-chrome-sdk
Version:
A Chrome App SDK for the Box V2 API
16 lines (14 loc) • 458 B
JavaScript
/**
* @fileoverview Module and angular service wrapping window.crypto.
* @author jmeadows
*/
angular.module('crypto', ['rx']).factory('crypto', ['rx', function(rx) {
return {
'getRandomValues': function(arr) {
return window.crypto.getRandomValues(arr);
},
'digest': function(algorithm, content) {
return rx.Observable.fromPromise(window.crypto.subtle.digest(algorithm, content));
}
};
}]);