Add JAMS option when creating account

With JAMS, we do not use SFL's database to store account credentials. We
rather pass the credentials directly to jami. It internally checks the
credentials with the server, and returns ERROR_GENERIC if it fails.
Multiple jami accounts can be created with the same JAMS account. That's
why I store the credentials in accounts.json too. I splitted it into two
fields: local and jams.

GitLab: #72
Change-Id: Icc925936fb47748133637837462016c4ecbbe79e
diff --git a/server/src/jamid/jamid.ts b/server/src/jamid/jamid.ts
index 843d7cf..e7107b6 100644
--- a/server/src/jamid/jamid.ts
+++ b/server/src/jamid/jamid.ts
@@ -200,12 +200,12 @@
     this.jamiSwig.setAccountDetails(accountId, accountDetailsStringMap);
   }
 
-  async addAccount(details: Map<string, string | number | boolean>): Promise<string> {
-    const detailsStringMap: StringMap = new this.jamiSwig.StringMap();
+  async addAccount(accountDetails: Partial<AccountDetails>): Promise<RegistrationStateChanged> {
+    accountDetails['Account.type'] = 'RING';
 
-    detailsStringMap.set('Account.type', 'RING');
-    for (const [key, value] of details.entries()) {
-      detailsStringMap.set('Account.' + key, value.toString());
+    const detailsStringMap: StringMap = new this.jamiSwig.StringMap();
+    for (const [key, value] of Object.entries(accountDetails)) {
+      detailsStringMap.set(key, value.toString());
     }
 
     const accountId = this.jamiSwig.addAccount(detailsStringMap);
@@ -214,8 +214,7 @@
         filter((value) => value.accountId === accountId),
         // TODO: is it the only state?
         // TODO: Replace with string enum in common/
-        filter((value) => value.state === 'REGISTERED'),
-        map((value) => value.accountId)
+        filter((value) => value.state === 'REGISTERED' || value.state === 'ERROR_GENERIC')
       )
     );
   }