summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/bitmask/core/web/bitmask.js7
-rw-r--r--www/app/lib/bitmask.js52
2 files changed, 47 insertions, 12 deletions
diff --git a/src/leap/bitmask/core/web/bitmask.js b/src/leap/bitmask/core/web/bitmask.js
index 9ac11b7..ae20951 100644
--- a/src/leap/bitmask/core/web/bitmask.js
+++ b/src/leap/bitmask/core/web/bitmask.js
@@ -27,6 +27,9 @@
* finished or will fail if there was any error. Errors are always user readable
* strings.
*/
+
+import "babel-polyfill";
+
var bitmask = function(){
var event_handlers = {};
@@ -140,7 +143,7 @@ var bitmask = function(){
if (typeof autoconf !== 'boolean') {
autoconf = false;
}
- return call(['bonafide', 'user', 'create', uid, password, autocnof]);
+ return call(['bonafide', 'user', 'create', uid, password, autoconf]);
},
/**
@@ -293,3 +296,5 @@ var bitmask = function(){
}
};
}();
+
+module.exports = bitmask
diff --git a/www/app/lib/bitmask.js b/www/app/lib/bitmask.js
index ecddd16..5ca280c 100644
--- a/www/app/lib/bitmask.js
+++ b/www/app/lib/bitmask.js
@@ -96,6 +96,28 @@ var bitmask = function(){
};
return {
+ bonafide: {
+ provider: {
+ create: function(domain) {
+ return call(['bonafide', 'provider', 'create', domain]);
+ },
+
+ read: function(domain) {
+ return call(['bonafide', 'provider', 'read', domain]);
+ },
+
+ delete: function(domain) {
+ return call(['bonafide', 'provider', 'delete', domain]);
+ },
+
+ list: function(seeded) {
+ if (typeof seeded !== 'boolean') {
+ seeded = false;
+ }
+ return call(['bonafide', 'provider', 'list', seeded]);
+ }
+ },
+
/**
* uids are of the form user@provider.net
*/
@@ -106,7 +128,7 @@ var bitmask = function(){
* @return {Promise<string>} The uid of the active user
*/
active: function() {
- return call(['user', 'active']);
+ return call(['bonafide', 'user', 'active']);
},
/**
@@ -114,19 +136,27 @@ var bitmask = function(){
*
* @param {string} uid The uid to be created
* @param {string} password The user password
+ * @param {boolean} autoconf If the provider should be autoconfigured if it's not allready known
*/
- create: function(uid, password) {
- return call(['user', 'create', uid, password]);
- },
+ create: function(uid, password, autoconf) {
+ if (typeof autoconf !== 'boolean') {
+ autoconf = false;
+ }
+ return call(['bonafide', 'user', 'create', uid, password, autoconf]);
+ },
/**
* Login
*
* @param {string} uid The uid to log in
* @param {string} password The user password
+ * @param {boolean} autoconf If the provider should be autoconfigured if it's not allready known
*/
- auth: function(uid, password) {
- return call(['user', 'authenticate', uid, password]);
+ auth: function(uid, password, autoconf) {
+ if (typeof autoconf !== 'boolean') {
+ autoconf = false;
+ }
+ return call(['bonafide', 'user', 'authenticate', uid, password, autoconf]);
},
/**
@@ -136,11 +166,11 @@ var bitmask = function(){
* If no uid is provided the active user will be used
*/
logout: function(uid) {
- if (typeof uid !== 'string') {
- uid = "";
- }
- return call(['user', 'logout', uid]);
- }
+ if (typeof uid !== 'string') {
+ uid = "";
+ }
+ return call(['bonafide', 'user', 'logout', uid]);
+ }
},
mail: {