@majikah/majik-message 0.2.17 → 0.2.19
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.
- package/dist/core/contacts/majik-contact-directory.d.ts +1 -1
- package/dist/core/contacts/majik-contact-directory.js +1 -1
- package/dist/core/database/system/identity.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/majik-message.d.ts +2 -1
- package/dist/majik-message.js +9 -8
- package/package.json +5 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MessageEnvelope } from "../messages/message-envelope";
|
|
2
2
|
import { MAJIK_API_RESPONSE } from "../types";
|
|
3
|
-
import { MajikContact, MajikContactData, SerializedMajikContact } from "
|
|
3
|
+
import { MajikContact, MajikContactData, SerializedMajikContact } from "@majikah/majik-contact";
|
|
4
4
|
export interface MajikContactDirectoryData {
|
|
5
5
|
contacts: SerializedMajikContact[];
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KEY_ALGO } from "../crypto/constants";
|
|
2
2
|
import { base64ToArrayBuffer } from "../utils/utilities";
|
|
3
|
-
import { MajikContact, } from "
|
|
3
|
+
import { MajikContact, } from "@majikah/majik-contact";
|
|
4
4
|
/* -------------------------------
|
|
5
5
|
* Errors
|
|
6
6
|
* ------------------------------- */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MajikUser } from "@thezelijah/majik-user";
|
|
2
|
-
import { SerializedMajikContact } from "
|
|
2
|
+
import { SerializedMajikContact } from "@majikah/majik-contact";
|
|
3
3
|
export interface MajikMessageIdentityJSON {
|
|
4
4
|
id: string;
|
|
5
5
|
user_id: string;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/majik-message.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MajikContact, type MajikContactMeta, type SerializedMajikContact } from "
|
|
1
|
+
import { MajikContact, type MajikContactMeta, type SerializedMajikContact } from "@majikah/majik-contact";
|
|
2
2
|
import { MessageEnvelope } from "./core/messages/message-envelope";
|
|
3
3
|
import { EnvelopeCache, type EnvelopeCacheItem, type EnvelopeCacheJSON } from "./core/messages/envelope-cache";
|
|
4
4
|
import { MajikKeyStore } from "./core/crypto/keystore";
|
|
@@ -103,6 +103,7 @@ export declare class MajikMessage {
|
|
|
103
103
|
hasOwnIdentity(fingerprint: string): Promise<boolean>;
|
|
104
104
|
updatePassphrase(currentPassphrase: string, newPassphrase: string, id?: string): Promise<void>;
|
|
105
105
|
getContactByID(id: string): MajikContact | null;
|
|
106
|
+
hasContact(id: string): boolean;
|
|
106
107
|
getContactByPublicKey(publicKeyBase64: string): Promise<MajikContact | null>;
|
|
107
108
|
exportContactAsJSON(contactId: string): Promise<string | null>;
|
|
108
109
|
exportContactAsString(contactId: string): Promise<string | null>;
|
package/dist/majik-message.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// MajikMessage.ts
|
|
2
|
-
import { MajikContact, } from "
|
|
2
|
+
import { MajikContact, } from "@majikah/majik-contact";
|
|
3
3
|
import { KEY_ALGO } from "./core/crypto/constants";
|
|
4
4
|
import { ScannerEngine } from "./core/scanner/scanner-engine";
|
|
5
5
|
import { MessageEnvelope } from "./core/messages/message-envelope";
|
|
@@ -197,10 +197,7 @@ export class MajikMessage {
|
|
|
197
197
|
throw new Error("Account with the same ID already exists");
|
|
198
198
|
}
|
|
199
199
|
const keyContact = key.toContact();
|
|
200
|
-
|
|
201
|
-
const reParsedContact = MajikContact.fromJSON(contactJSON);
|
|
202
|
-
console.log("Account: ", key);
|
|
203
|
-
this.addOwnAccount(reParsedContact);
|
|
200
|
+
this.addOwnAccount(keyContact);
|
|
204
201
|
return { id: key.id, fingerprint: key.fingerprint };
|
|
205
202
|
}
|
|
206
203
|
/**
|
|
@@ -209,9 +206,8 @@ export class MajikMessage {
|
|
|
209
206
|
async createAccountFromMnemonic(mnemonic, passphrase, label) {
|
|
210
207
|
const key = await MajikKey.create(mnemonic, passphrase, label);
|
|
211
208
|
await MajikKeyStore.addMajikKey(key);
|
|
212
|
-
const keyContact =
|
|
213
|
-
|
|
214
|
-
this.addOwnAccount(reParsedContact);
|
|
209
|
+
const keyContact = key.toContact();
|
|
210
|
+
this.addOwnAccount(keyContact);
|
|
215
211
|
return { id: key.id, fingerprint: key.fingerprint, backup: key.backup };
|
|
216
212
|
}
|
|
217
213
|
addOwnAccount(account) {
|
|
@@ -304,6 +300,11 @@ export class MajikMessage {
|
|
|
304
300
|
throw new Error("Invalid contact ID");
|
|
305
301
|
return this.contactDirectory.getContact(id) ?? null;
|
|
306
302
|
}
|
|
303
|
+
hasContact(id) {
|
|
304
|
+
if (!id?.trim())
|
|
305
|
+
throw new Error("Invalid contact ID");
|
|
306
|
+
return this.contactDirectory.hasContact(id);
|
|
307
|
+
}
|
|
307
308
|
async getContactByPublicKey(publicKeyBase64) {
|
|
308
309
|
if (!publicKeyBase64?.trim())
|
|
309
310
|
throw new Error("Invalid public key");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@majikah/majik-message",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Post-quantum end-to-end encryption with ML-KEM-768. Seed phrase–based accounts. Auto-expiring messages. Offline-ready. Exportable encrypted messages. Tamper-proof threads with blockchain-like integrity. Quantum-resistant messaging.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.19",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|
|
@@ -80,10 +80,11 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@bokuweb/zstd-wasm": "^0.0.27",
|
|
83
|
+
"@majikah/majik-contact": "^0.0.1",
|
|
83
84
|
"@majikah/majik-envelope": "^0.0.1",
|
|
84
|
-
"@majikah/majik-file": "^0.0.
|
|
85
|
-
"@majikah/majik-key": "^0.2.
|
|
86
|
-
"@majikah/majik-signature": "^0.0.
|
|
85
|
+
"@majikah/majik-file": "^0.0.23",
|
|
86
|
+
"@majikah/majik-key": "^0.2.4",
|
|
87
|
+
"@majikah/majik-signature": "^0.0.16",
|
|
87
88
|
"@noble/hashes": "^2.0.1",
|
|
88
89
|
"@noble/post-quantum": "^0.5.4",
|
|
89
90
|
"@scure/bip39": "^1.6.0",
|