Ref and add pbkdf2 as angular module

This commit is contained in:
Gustavo Maximiliano Cortez 2016-08-10 16:08:11 -03:00
parent 4c55b8b541
commit 4bb2375ed0
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
7 changed files with 26 additions and 5 deletions

1
.gitignore vendored
View File

@ -59,6 +59,7 @@ build/Release
node_modules
bower_components
angular-bitcore-wallet-client/angular-bitcore-wallet-client.js
angular-pbkdf2/angular-pbkdf2.js
# Users Environment Variables
.lock-wscript

View File

@ -105,6 +105,7 @@ module.exports = function(grunt) {
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/ng-csv/build/ng-csv.js',
'bower_components/angular-mocks/angular-mocks.js',
'angular-pbkdf2/angular-pbkdf2.js',
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
],
dest: 'public/lib/angular.js'
@ -260,7 +261,8 @@ module.exports = function(grunt) {
browserify: {
dist: {
files: {
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js']
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
'angular-pbkdf2/angular-pbkdf2.js': ['angular-pbkdf2/index.js']
},
}
}

View File

@ -1,6 +1,5 @@
var bwcModule = angular.module('bwcModule', []);
var Client = require('../node_modules/bitcore-wallet-client');
var pbkdf2Sync = require('pbkdf2').pbkdf2Sync;
bwcModule.constant('MODULE_VERSION', '1.0.0');
@ -25,7 +24,6 @@ bwcModule.provider("bwcService", function() {
service.buildTx = Client.buildTx;
service.parseSecret = Client.parseSecret;
service.Client = Client;
service.pbkdf2Sync = pbkdf2Sync;
service.getUtils = function() {
return Client.Utils;

18
angular-pbkdf2/index.js vendored Normal file
View File

@ -0,0 +1,18 @@
var pbkdf2Module = angular.module('pbkdf2Module', []);
var pbkdf2Sync = require('../node_modules/pbkdf2').pbkdf2Sync;
pbkdf2Module.constant('MODULE_VERSION', '1.0.0');
pbkdf2Module.provider("pbkdf2Service", function() {
var provider = {};
provider.$get = function() {
var service = {};
service.pbkdf2Sync = pbkdf2Sync;
return service;
};
return provider;
});

View File

@ -10,6 +10,7 @@ var modules = [
'ngSanitize',
'ngCsv',
'bwcModule',
'pbkdf2Module',
'copayApp.filters',
'copayApp.services',
'copayApp.controllers',

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $rootScope, $timeout, $log, $ionicModal, lodash, bitpayCardService, configService, profileService, walletService, fingerprintService, ongoingProcess, bwcError, bitcore, bwcService, moment, platformInfo) {
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $rootScope, $timeout, $log, $ionicModal, lodash, bitpayCardService, configService, profileService, walletService, fingerprintService, ongoingProcess, bwcError, bitcore, pbkdf2Service, moment, platformInfo) {
var self = this;
var client;
@ -295,7 +295,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
var data = {
emailAddress : $scope.email,
hashedPassword : bwcService.pbkdf2Sync($scope.password, '..............', 200, 64).toString('hex')
hashedPassword : pbkdf2Service.pbkdf2Sync($scope.password, '..............', 200, 64).toString('hex')
};
// POST /authenticate

View File

@ -27,6 +27,7 @@ module.exports = function(config) {
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/ng-csv/build/ng-csv.js',
'bower_components/angular-mocks/angular-mocks.js',
'angular-pbkdf2/angular-pbkdf2.js',
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js',
'src/js/**/*.js',
'test/helpers.js',