user 6 yıl önce
ebeveyn
işleme
3efc7838e3
4 değiştirilmiş dosya ile 12 ekleme ve 11 silme
  1. 2 2
      lib/index.d.ts
  2. 4 3
      lib/index.js
  3. 1 1
      lib/index.js.map
  4. 5 5
      src/index.ts

+ 2 - 2
lib/index.d.ts

@@ -1,7 +1,7 @@
 import { Storage } from './storage';
 import { IWebClient } from './webclient';
-import { UploadItemParameters } from './upload-item-parameters';
 import { ContentItem } from './content-item';
+import { UploadItemParameters } from './upload-item-parameters';
 export declare class BankClient {
     private urlBase;
     private ipfsUrlBase;
@@ -27,7 +27,7 @@ export declare class BankClient {
     appendBank(bankAddress: string, bankTopic: string, itemHash: string): Promise<void>;
     retrievePrivate(peerAddr: string, topic: string): Promise<string>;
     subscribePrivate(peerAddr: string, topic: string, callback: () => void): Promise<unknown>;
-    appendPrivate(peerAddr: string, topic: string, hash: string, replaceHash?: string): Promise<void>;
+    appendPrivate(peerAddr: string, topic: string, hash: string, replaceHash?: string, deleteHash?: string): Promise<void>;
     getOrCreateContact(peerId: string, contactAddr: string): Promise<any>;
     getContactById(peerId: string, contactId: string): Promise<any>;
     updateContact(peerId: string, contactId: string, newProperties: any): Promise<any>;

+ 4 - 3
lib/index.js

@@ -16,9 +16,9 @@ const util = require("util");
 const storage_1 = require("./storage");
 const TextEncoder = util.TextEncoder;
 const ws_1 = __importDefault(require("ws"));
+const content_item_1 = require("./content-item");
 const util_1 = require("./util");
 const webclient_node_1 = __importDefault(require("./webclient-node"));
-const content_item_1 = require("./content-item");
 class BankClient {
     constructor(urlBase, ipfsUrlBase, storage = new storage_1.Storage('bankClient'), webClient = new webclient_node_1.default()) {
         this.urlBase = urlBase;
@@ -249,14 +249,15 @@ class BankClient {
             });
         }));
     }
-    appendPrivate(peerAddr, topic, hash, replaceHash) {
+    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({
                 _date: new Date().toISOString(),
                 _nonce: nonce,
+                deleteHash,
                 hash,
-                replaceHash
+                replaceHash,
             }));
             const topicURL = this.urlBase + '/bank/private/' + encodeURIComponent(peerAddr) + '/' + encodeURIComponent(topic);
             const result = yield this.webClient.request({

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
lib/index.js.map


+ 5 - 5
src/index.ts

@@ -5,12 +5,11 @@ import { Storage } from './storage';
 import { IWebClient } from './webclient';
 const TextEncoder = util.TextEncoder;
 import WebSocket from 'ws';
+import { ContentItem } from './content-item';
+import { ContentParams } from './content-params';
 import { UploadItemParameters } from './upload-item-parameters';
 import { encodeHex, mergeDeep, uuid } from './util';
 import WebClientNode from './webclient-node';
-import { reject, resolve } from 'bluebird';
-import { ContentParams } from './content-params';
-import { ContentItem } from './content-item';
 
 export class BankClient {
 
@@ -246,13 +245,14 @@ export class BankClient {
       });
     }
 
-    public async appendPrivate(peerAddr: string, topic: string, hash: string, replaceHash?: 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(),
         _nonce: nonce,
+        deleteHash,
         hash,
-        replaceHash
+        replaceHash,
       }));
       const topicURL = this.urlBase + '/bank/private/' + encodeURIComponent(peerAddr) + '/' + encodeURIComponent(topic);
       const result = await this.webClient.request({