@majikah/majik-message 0.1.13 → 0.1.14
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,8 +1,12 @@
|
|
|
1
1
|
import { MajikMessageIdentityJSON } from "../database/system/identity";
|
|
2
2
|
import { ISODateString } from "../types";
|
|
3
|
-
export type SerializedMajikContact =
|
|
3
|
+
export type SerializedMajikContact = {
|
|
4
|
+
id: string;
|
|
5
|
+
fingerprint: string;
|
|
6
|
+
meta?: MajikContactMeta;
|
|
4
7
|
publicKeyBase64: string;
|
|
5
8
|
mlKey: string;
|
|
9
|
+
majikah_registered?: boolean;
|
|
6
10
|
};
|
|
7
11
|
export interface MajikContactMeta {
|
|
8
12
|
label?: string;
|
|
@@ -46,6 +50,7 @@ export declare class MajikContact {
|
|
|
46
50
|
raw: Uint8Array;
|
|
47
51
|
}, mlKey: string, fingerprint: string, meta?: Partial<MajikContactMeta>): MajikContact;
|
|
48
52
|
private assertId;
|
|
53
|
+
private assertMLKey;
|
|
49
54
|
private assertPublicKey;
|
|
50
55
|
private assertFingerprint;
|
|
51
56
|
private updateTimestamp;
|
|
@@ -23,6 +23,7 @@ export class MajikContact {
|
|
|
23
23
|
constructor(data) {
|
|
24
24
|
this.assertId(data.id);
|
|
25
25
|
this.assertPublicKey(data.publicKey);
|
|
26
|
+
this.assertMLKey(data.mlKey);
|
|
26
27
|
this.assertFingerprint(data.fingerprint);
|
|
27
28
|
this.id = data.id;
|
|
28
29
|
this.publicKey = data.publicKey;
|
|
@@ -50,6 +51,11 @@ export class MajikContact {
|
|
|
50
51
|
throw new MajikContactError("Contact ID must be a non-empty string");
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
assertMLKey(key) {
|
|
55
|
+
if (!key || typeof key !== "string") {
|
|
56
|
+
throw new MajikContactError("ML Key must be a non-empty string");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
53
59
|
assertPublicKey(key) {
|
|
54
60
|
// Accept either a WebCrypto CryptoKey (with .type === 'public')
|
|
55
61
|
// or a raw-key wrapper object that contains a Uint8Array `raw` field.
|
package/dist/majik-message.js
CHANGED
|
@@ -136,8 +136,9 @@ export class MajikMessage {
|
|
|
136
136
|
if (this.getOwnAccountById(key.id)) {
|
|
137
137
|
throw new Error("Account with the same ID already exists");
|
|
138
138
|
}
|
|
139
|
-
const keyContact =
|
|
140
|
-
const
|
|
139
|
+
const keyContact = key.toContact();
|
|
140
|
+
const contactJSON = await keyContact.toJSON();
|
|
141
|
+
const reParsedContact = MajikContact.fromJSON(contactJSON);
|
|
141
142
|
this.addOwnAccount(reParsedContact);
|
|
142
143
|
return { id: key.id, fingerprint: key.fingerprint };
|
|
143
144
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@majikah/majik-message",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Encrypt and decrypt messages on any website or platform. Secure chats with keypairs and seed-based accounts. Open source.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.14",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@bokuweb/zstd-wasm": "^0.0.27",
|
|
83
|
-
"@majikah/majik-key": "^0.1.
|
|
83
|
+
"@majikah/majik-key": "^0.1.8",
|
|
84
84
|
"@noble/hashes": "^2.0.1",
|
|
85
85
|
"@noble/post-quantum": "^0.5.4",
|
|
86
86
|
"@scure/bip39": "^1.6.0",
|