summaryrefslogtreecommitdiff
path: root/www/app/lib/bitmask.js
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-09-07 10:19:49 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-09-07 10:19:49 -0400
commit268a4e0b252b0d3f59645e937293ac4cb65cce83 (patch)
tree4585df3c25e2623914d7a243ea7e7c07345a82fd /www/app/lib/bitmask.js
parent7a6e187e0a970ad6fb722fc9dfd3be784b254c06 (diff)
[refactor] update www/app/lib/bitmask.js
- fix a typo - Mantaining two copies looks like a very bad idea. I'll probably make this a symlink.
Diffstat (limited to 'www/app/lib/bitmask.js')
-rw-r--r--www/app/lib/bitmask.js52
1 files changed, 41 insertions, 11 deletions
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: {