@thezelijah/majik-message 1.0.7 → 1.0.9

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.
@@ -33,7 +33,7 @@ export declare class MajikMessageChat {
33
33
  */
34
34
  getCompressedMessage(): string;
35
35
  /**
36
- * Set the message content (already compressed).
36
+ * Set the message content (already encrypted).
37
37
  * Used after encryption to update the message with encrypted payload.
38
38
  */
39
39
  setMessage(compressedMessage: string): void;
@@ -79,11 +79,10 @@ export class MajikMessageChat {
79
79
  return this.message;
80
80
  }
81
81
  /**
82
- * Set the message content (already compressed).
82
+ * Set the message content (already encrypted).
83
83
  * Used after encryption to update the message with encrypted payload.
84
84
  */
85
85
  setMessage(compressedMessage) {
86
- this.validateMessage(compressedMessage);
87
86
  this.message = compressedMessage;
88
87
  }
89
88
  getSender() {
@@ -1,4 +1,3 @@
1
- import { autogenerateID } from "./utils";
2
1
  import { hash } from "@stablelib/sha256";
3
2
  import { arrayToBase64 } from "../../utils/utilities";
4
3
  /**
@@ -67,12 +66,11 @@ export class MajikMessageIdentity {
67
66
  }
68
67
  const label = options?.label || account?.meta?.label || user.displayName;
69
68
  assertString(label, "label");
70
- const generatedID = autogenerateID();
71
69
  const timestamp = new Date().toISOString();
72
70
  const publicKey = account.publicKeyBase64;
73
- const phash = sha256(`${user.id}:${publicKey}:${generatedID}`);
71
+ const phash = sha256(`${user.id}:${publicKey}:${account.id}`);
74
72
  return new MajikMessageIdentity({
75
- id: generatedID,
73
+ id: account.id,
76
74
  userId: user.id,
77
75
  publicKey: publicKey,
78
76
  phash,
@@ -335,6 +335,7 @@ export class MajikMessage {
335
335
  */
336
336
  async decryptEnvelope(envelope, bypassIdentity = false) {
337
337
  const fingerprint = envelope.extractFingerprint();
338
+ console.log("Fingerprint: ", fingerprint);
338
339
  const authorizedAccount = this.listContacts(true).find((a) => a.fingerprint === fingerprint);
339
340
  if (!authorizedAccount) {
340
341
  throw new Error("No matching own account to decrypt this envelope");
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.7",
5
+ "version": "1.0.9",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",