user 6 years ago
parent
commit
8e29c71124
4 changed files with 8 additions and 12 deletions
  1. 2 2
      lib/index.d.ts
  2. 1 3
      lib/index.js
  3. 1 1
      lib/index.js.map
  4. 4 6
      src/index.ts

+ 2 - 2
lib/index.d.ts

@@ -1,7 +1,7 @@
-import { Storage } from './storage';
-import { IWebClient } from './webclient';
 import { ContentItem } from './content-item';
+import { Storage } from './storage';
 import { UploadItemParameters } from './upload-item-parameters';
+import { IWebClient } from './webclient';
 export declare class BankClient {
     private urlBase;
     private ipfsUrlBase;

+ 1 - 3
lib/index.js

@@ -12,8 +12,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const crypto = require("libp2p-crypto");
-const util = require("util");
-const TextEncoder = util.TextEncoder;
 const ws_1 = __importDefault(require("ws"));
 const content_item_1 = require("./content-item");
 const util_1 = require("./util");
@@ -360,7 +358,7 @@ class BankClient {
         return this.privateKey;
     }
     makePlaintextPayload(message) {
-        const messageBytes = new TextEncoder().encode(message);
+        const messageBytes = Buffer.from(message, 'utf-8');
         return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
             yield this.bootstrap();
             this.privateKey.sign(messageBytes, (signErr, signatureBytes) => __awaiter(this, void 0, void 0, function* () {

File diff suppressed because it is too large
+ 1 - 1
lib/index.js.map


+ 4 - 6
src/index.ts

@@ -1,14 +1,12 @@
 import crypto = require('libp2p-crypto');
-import util = require('util');
-import RsaPrivateKey = crypto.keys;
-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 RsaPrivateKey = crypto.keys;
+import { Storage } from './storage';
 import { UploadItemParameters } from './upload-item-parameters';
 import { encodeHex, mergeDeep, uuid } from './util';
+import { IWebClient } from './webclient';
 
 export class BankClient {
 
@@ -355,7 +353,7 @@ export class BankClient {
     }
 
     private makePlaintextPayload(message: string) {
-      const messageBytes = new TextEncoder().encode(message);
+      const messageBytes = Buffer.from(message, 'utf-8');
   
       return new Promise(async (resolve, reject) => {
         await this.bootstrap();