瀏覽代碼

added onlyHash

user 6 年之前
父節點
當前提交
ea3f474f23
共有 4 個文件被更改,包括 6 次插入4 次删除
  1. 1 1
      lib/index.d.ts
  2. 2 1
      lib/index.js
  3. 1 1
      lib/index.js.map
  4. 2 1
      src/index.ts

+ 1 - 1
lib/index.d.ts

@@ -26,7 +26,7 @@ export declare class BankClient {
     upload(params: UploadItemParameters): Promise<any>;
     uploadSlimJSON(item: any): Promise<any>;
     uploadSlimText(item: string): Promise<any>;
-    appendPrivate(peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string): Promise<void>;
+    appendPrivate(peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string, onlyHash?: 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, addressType: string, addressValue: string, contactBook?: ContactBook): Promise<ContactItem>;

+ 2 - 1
lib/index.js

@@ -189,7 +189,7 @@ class BankClient {
             return uploadResponse.hash;
         });
     }
-    appendPrivate(peerAddr, topic, hash, replaceHash, deleteHash) {
+    appendPrivate(peerAddr, topic, hash, replaceHash, deleteHash, onlyHash) {
         return __awaiter(this, void 0, void 0, function* () {
             const nonce = yield this.getNonce();
             const payload = yield this.makePlaintextPayload(JSON.stringify({
@@ -197,6 +197,7 @@ class BankClient {
                 _nonce: nonce,
                 deleteHash,
                 hash,
+                onlyHash,
                 replaceHash,
             }));
             const topicURL = this.urlBase + '/bank/private/' + encodeURIComponent(peerAddr) + '/' + encodeURIComponent(topic);

文件差異過大導致無法顯示
+ 1 - 1
lib/index.js.map


+ 2 - 1
src/index.ts

@@ -185,13 +185,14 @@ export class BankClient {
       return uploadResponse.hash;
     }
 
-    public async appendPrivate(peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string) {
+    public async appendPrivate(peerAddr: string, topic: string, hash?: string, replaceHash?: string, deleteHash?: string, onlyHash?: string) {
       const nonce = await this.getNonce();
       const payload = await this.makePlaintextPayload(JSON.stringify({
         _date: new Date().toISOString(),
         _nonce: nonce,
         deleteHash,
         hash,
+        onlyHash,
         replaceHash,
       }));
       const topicURL = this.urlBase + '/bank/private/' + encodeURIComponent(peerAddr) + '/' + encodeURIComponent(topic);