@firmachain/firma-js 0.2.19 → 0.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,7 @@ export declare class FirmaUtil {
15
15
  static getUFCTStringFromFCT(fctAmount: number): string;
16
16
  static getFCTStringFromUFCT(uFctAmount: number): string;
17
17
  static getFileHash(filePath: string): Promise<string>;
18
+ static getFileHashFromBuffer(buffer: Uint8Array): Promise<string>;
18
19
  static isValidAddress(address: string): boolean;
19
20
  static getValOperAddressFromAccAddress(address: string): string;
20
21
  static getAccAddressFromValOperAddress(address: string): string;
@@ -100,6 +100,15 @@ var FirmaUtil = /** @class */ (function () {
100
100
  });
101
101
  });
102
102
  };
103
+ FirmaUtil.getFileHashFromBuffer = function (buffer) {
104
+ return __awaiter(this, void 0, void 0, function () {
105
+ var data;
106
+ return __generator(this, function (_a) {
107
+ data = CryptoJS.lib.WordArray.create(buffer);
108
+ return [2 /*return*/, sha256(data).toString(encHex)];
109
+ });
110
+ });
111
+ };
103
112
  FirmaUtil.isValidAddress = function (address) {
104
113
  try {
105
114
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firmachain/firma-js",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "The Official FirmaChain Javascript SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",