user 6 år sedan
förälder
incheckning
afd4fbdef2
4 ändrade filer med 11 tillägg och 17 borttagningar
  1. 2 2
      lib/index.d.ts
  2. 4 7
      lib/index.js
  3. 1 1
      lib/index.js.map
  4. 4 7
      src/index.ts

+ 2 - 2
lib/index.d.ts

@@ -1,8 +1,8 @@
+import { ContactItem } from './contact-item';
 import { ContentItem } from './content-item';
 import { Storage } from './storage';
 import { UploadItemParameters } from './upload-item-parameters';
 import { IWebClient } from './webclient';
-import { ContactItem } from './contact-item';
 export declare class BankClient {
     private urlBase;
     private ipfsUrlBase;
@@ -25,7 +25,7 @@ export declare class BankClient {
     upload(params: UploadItemParameters): Promise<any>;
     uploadSlimJSON(item: any): Promise<any>;
     uploadSlimText(item: string): Promise<any>;
-    appendPrivate(dontLogToAll: boolean, peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string): Promise<void>;
+    appendPrivate(peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string): Promise<void>;
     retrievePrivate(peerAddr: string, topic: string): Promise<string>;
     subscribePrivate(peerAddr: string, topic: string, connectCallback: () => void, messageCallback: (data: any) => void): Promise<void>;
     getOrCreateContact(peerId: string, contactAddr: string): Promise<ContactItem>;

+ 4 - 7
lib/index.js

@@ -13,9 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
 Object.defineProperty(exports, "__esModule", { value: true });
 const crypto = require("libp2p-crypto");
 const ws_1 = __importDefault(require("ws"));
+const contact_item_1 = require("./contact-item");
 const content_item_1 = require("./content-item");
 const util_1 = require("./util");
-const contact_item_1 = require("./contact-item");
 class BankClient {
     constructor(urlBase, ipfsUrlBase, storage, webClient) {
         this.urlBase = urlBase;
@@ -186,7 +186,7 @@ class BankClient {
             return uploadResponse.hash;
         });
     }
-    appendPrivate(dontLogToAll, peerAddr, topic, hash, replaceHash, deleteHash) {
+    appendPrivate(peerAddr, topic, hash, replaceHash, deleteHash) {
         return __awaiter(this, void 0, void 0, function* () {
             const nonce = yield this.getNonce();
             const payload = yield this.makePlaintextPayload(JSON.stringify({
@@ -205,9 +205,6 @@ class BankClient {
                 method: 'PUT',
                 url: topicURL
             });
-            if (!dontLogToAll && topic !== 'all' && !deleteHash) {
-                yield this.appendPrivate(true, peerAddr, 'all', hash, undefined, undefined);
-            }
         });
     }
     retrievePrivate(peerAddr, topic) {
@@ -250,7 +247,7 @@ class BankClient {
                 id: contactId
             };
             const newItemHash = yield this.uploadSlimJSON(newItem);
-            yield this.appendPrivate(true, peerId, '📇', newItemHash);
+            yield this.appendPrivate(peerId, '📇', newItemHash);
             return yield this.getContactById(peerId, contactId);
         });
     }
@@ -279,7 +276,7 @@ class BankClient {
             const newItem = util_1.mergeDeep(existing, newProps);
             delete newItem.hash;
             const newItemHash = yield this.uploadSlimJSON(newItem);
-            yield this.appendPrivate(true, peerId, '📇', newItemHash, existing.hash);
+            yield this.appendPrivate(peerId, '📇', newItemHash, existing.hash);
             return yield this.getContactById(peerId, contactId);
         });
     }

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
lib/index.js.map


+ 4 - 7
src/index.ts

@@ -1,5 +1,6 @@
 import crypto = require('libp2p-crypto');
 import WebSocket from 'ws';
+import { ContactItem } from './contact-item';
 import { ContentItem } from './content-item';
 import { ContentParams } from './content-params';
 import RsaPrivateKey = crypto.keys;
@@ -7,7 +8,6 @@ import { Storage } from './storage';
 import { UploadItemParameters } from './upload-item-parameters';
 import { encodeHex, mergeDeep, uuid } from './util';
 import { IWebClient } from './webclient';
-import { ContactItem } from './contact-item';
 
 export class BankClient {
 
@@ -182,7 +182,7 @@ export class BankClient {
       return uploadResponse.hash;
     }
 
-    public async appendPrivate(dontLogToAll: boolean, peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string) {
+    public async appendPrivate(peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string) {
       const nonce = await this.getNonce();
       const payload = await this.makePlaintextPayload(JSON.stringify({
         _date: new Date().toISOString(),
@@ -200,9 +200,6 @@ export class BankClient {
         method: 'PUT',
         url: topicURL
       });
-      if (!dontLogToAll && topic !== 'all' && !deleteHash) {
-        await this.appendPrivate(true, peerAddr, 'all', hash, undefined, undefined);
-      }
     }
 
     public async retrievePrivate(peerAddr: string, topic: string) {
@@ -243,7 +240,7 @@ export class BankClient {
         id: contactId
       };
       const newItemHash = await this.uploadSlimJSON(newItem);
-      await this.appendPrivate(true, peerId, '📇', newItemHash);
+      await this.appendPrivate(peerId, '📇', newItemHash);
       return await this.getContactById(peerId, contactId);
     }
 
@@ -269,7 +266,7 @@ export class BankClient {
       const newItem: any = mergeDeep(existing, newProps);
       delete newItem.hash;
       const newItemHash = await this.uploadSlimJSON(newItem);
-      await this.appendPrivate(true, peerId, '📇', newItemHash, existing.hash);
+      await this.appendPrivate(peerId, '📇', newItemHash, existing.hash);
       return await this.getContactById(peerId, contactId);
     }