mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
bug fixes and documentation
This commit is contained in:
@@ -24,14 +24,15 @@ data stored using credentials originally obtained at ripple.com
|
|||||||
|
|
||||||
vaultClient.register(options, callback);
|
vaultClient.register(options, callback);
|
||||||
|
|
||||||
|
vaultClient.rename(options, callback);
|
||||||
# Blob Client Methods
|
|
||||||
|
|
||||||
blobClient.get(url, id, crypt, callback);
|
vaultClient.changePassword(options, callback);
|
||||||
|
|
||||||
blobClient.create(options, callback);
|
vaultClient.recoverBlob(options, callback);
|
||||||
|
|
||||||
blobClient.verify(url, username, token, callback);
|
vaultClient.verify(username, token, callback);
|
||||||
|
|
||||||
|
vaultClient.resendEmail(options, callback);
|
||||||
|
|
||||||
|
|
||||||
# Blob Methods
|
# Blob Methods
|
||||||
|
|||||||
@@ -829,7 +829,7 @@ BlobClient.get = function (url, id, crypt, fn) {
|
|||||||
|
|
||||||
BlobClient.verify = function(url, username, token, fn) {
|
BlobClient.verify = function(url, username, token, fn) {
|
||||||
url += '/v1/user/' + username + '/verify/' + token;
|
url += '/v1/user/' + username + '/verify/' + token;
|
||||||
request.get(url, function(err, resp){
|
request.get(url, function(err, resp) {
|
||||||
if (err) {
|
if (err) {
|
||||||
fn(new Error("Failed to verify the account - XHR error"));
|
fn(new Error("Failed to verify the account - XHR error"));
|
||||||
} else if (resp.body && resp.body.result === 'success') {
|
} else if (resp.body && resp.body.result === 'success') {
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ Crypt.signString = function(secret, data) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Crypt.deriveRecoveryEncryptionKeyFromSecret = function(secret) {
|
Crypt.deriveRecoveryEncryptionKeyFromSecret = function(secret) {
|
||||||
var seed = ripple.Seed.from_json(secret).to_bits();
|
var seed = Seed.from_json(secret).to_bits();
|
||||||
var hmac = new sjcl.misc.hmac(seed, sjcl.hash.sha512);
|
var hmac = new sjcl.misc.hmac(seed, sjcl.hash.sha512);
|
||||||
var key = hmac.mac('ripple/hmac/recovery_encryption_key/v1');
|
var key = hmac.mac('ripple/hmac/recovery_encryption_key/v1');
|
||||||
key = sjcl.bitArray.bitSlice(key, 0, 256);
|
key = sjcl.bitArray.bitSlice(key, 0, 256);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ VaultClient.prototype.getAuthInfo = function (username, callback) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
VaultClient.prototype._deriveLoginKeys = function (authInfo, password, callback) {
|
VaultClient.prototype._deriveLoginKeys = function (authInfo, password, callback) {
|
||||||
|
|
||||||
//derive login keys
|
//derive login keys
|
||||||
crypt.derive(authInfo.pakdf, 'login', authInfo.username.toLowerCase(), password, function(err, keys) {
|
crypt.derive(authInfo.pakdf, 'login', authInfo.username.toLowerCase(), password, function(err, keys) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -326,7 +327,7 @@ VaultClient.prototype.exists = function(username, callback) {
|
|||||||
VaultClient.prototype.verify = function(username, token, callback) {
|
VaultClient.prototype.verify = function(username, token, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.getAuthInfo(username, function (err, authinfo){
|
self.getAuthInfo(username, function (err, authInfo){
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
@@ -339,6 +340,11 @@ VaultClient.prototype.verify = function(username, token, callback) {
|
|||||||
* resendEmail
|
* resendEmail
|
||||||
* send a new verification email
|
* send a new verification email
|
||||||
* @param {object} options
|
* @param {object} options
|
||||||
|
* @param {string} options.id
|
||||||
|
* @param {string} options.username
|
||||||
|
* @param {string} options.account_id
|
||||||
|
* @param {string} options.email
|
||||||
|
* @param {string} options.activateLink
|
||||||
* @param {function} fn - Callback
|
* @param {function} fn - Callback
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -425,6 +431,8 @@ VaultClient.prototype.rename = function (options, fn) {
|
|||||||
|
|
||||||
if (authInfo && authInfo.exists) {
|
if (authInfo && authInfo.exists) {
|
||||||
return callback(new Error('username already taken.'));
|
return callback(new Error('username already taken.'));
|
||||||
|
} else {
|
||||||
|
authInfo.username = new_username;
|
||||||
}
|
}
|
||||||
|
|
||||||
return callback (err, authInfo, password);
|
return callback (err, authInfo, password);
|
||||||
|
|||||||
Reference in New Issue
Block a user