@thezelijah/majik-message 1.0.2 → 1.0.4

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.
@@ -1,5 +1,6 @@
1
- import crypto from "crypto";
2
1
  import { autogenerateID } from "./utils";
2
+ import { hash } from "@stablelib/sha256";
3
+ import { arrayToBase64 } from "../../utils/utilities";
3
4
  /**
4
5
  * Utility assertions
5
6
  */
@@ -15,7 +16,8 @@ function assertISODate(value, field) {
15
16
  assert(!isNaN(date.getTime()), `${field} must be a valid ISO timestamp`);
16
17
  }
17
18
  function sha256(input) {
18
- return crypto.createHash("sha256").update(input).digest("hex");
19
+ const hashed = hash(new TextEncoder().encode(input));
20
+ return arrayToBase64(hashed);
19
21
  }
20
22
  /**
21
23
  * MajikMessageIdentity
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@thezelijah/majik-message",
3
3
  "type": "module",
4
4
  "description": "Encrypt and decrypt messages on any website. Secure chats with keypairs and seed-based accounts. Open source.",
5
- "version": "1.0.2",
5
+ "version": "1.0.4",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",