Display a message for users whose have wallet:: but not profile::
This commit is contained in:
parent
bfdfc68d83
commit
2c07ad6dd7
7 changed files with 94 additions and 8 deletions
|
|
@ -59,8 +59,12 @@ function Identity(opts) {
|
|||
this.wallets = opts.wallets || {};
|
||||
};
|
||||
|
||||
Identity.getStoragePrefix = function() {
|
||||
return 'profile::';
|
||||
};
|
||||
|
||||
Identity.getKeyForEmail = function(email) {
|
||||
return 'profile::' + bitcore.util.sha256ripe160(email).toString('hex');
|
||||
return Identity.getStoragePrefix() + bitcore.util.sha256ripe160(email).toString('hex');
|
||||
};
|
||||
|
||||
Identity.prototype.getId = function() {
|
||||
|
|
@ -482,6 +486,19 @@ Identity.prototype.addWallet = function(wallet, cb) {
|
|||
this.storage.setItem(wallet.getStorageKey(), wallet.toObj(), cb);
|
||||
};
|
||||
|
||||
/**
|
||||
* check if any profile exists on storage
|
||||
* @param opts.storageOpts
|
||||
* @param cb
|
||||
*/
|
||||
Identity.checkIfExistsAny = function(opts, cb) {
|
||||
var storage = opts.storage || opts.pluginManager.get('DB');
|
||||
storage.getFirst(Identity.getStoragePrefix(), {
|
||||
onlyKey: true
|
||||
}, function(err, v, k) {
|
||||
return cb(k ? true : false);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc Checks if a version is compatible with the current version
|
||||
|
|
|
|||
|
|
@ -165,14 +165,32 @@ Wallet.COPAYER_PAIR_LIMITS = {
|
|||
12: 1,
|
||||
};
|
||||
|
||||
Wallet.getStoragePrefix = function() {
|
||||
return 'wallet::';
|
||||
};
|
||||
|
||||
Wallet.getStorageKey = function(str) {
|
||||
return 'wallet::' + str;
|
||||
return Wallet.getStoragePrefix() + str;
|
||||
};
|
||||
|
||||
Wallet.prototype.getStorageKey = function() {
|
||||
return Wallet.getStorageKey(this.getId());
|
||||
};
|
||||
|
||||
/**
|
||||
* check if any wallet exists on storage
|
||||
* @param opts.storageOpts
|
||||
* @param cb
|
||||
*/
|
||||
Wallet.checkIfExistsAny = function(opts, cb) {
|
||||
var storage = opts.storage || opts.pluginManager.get('DB');
|
||||
storage.getFirst(Wallet.getStoragePrefix(), {
|
||||
onlyKey: true
|
||||
}, function(err, v, k) {
|
||||
return cb(k ? true : false);
|
||||
});
|
||||
};
|
||||
|
||||
/* for stubbing */
|
||||
Wallet._newInsight = function(opts) {
|
||||
return new Insight(opts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue