@majikah/majik-message 0.3.6 → 0.3.8
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/README.md +3 -3
- package/dist/core/client-state-manager.d.ts +105 -0
- package/dist/core/client-state-manager.js +250 -0
- package/dist/core/contacts/majik-contact-directory.d.ts +0 -5
- package/dist/core/contacts/majik-contact-directory.js +0 -12
- package/dist/core/contacts/majik-contact-groups.d.ts +1 -0
- package/dist/core/contacts/majik-contact-groups.js +5 -0
- package/dist/core/contacts/majik-contact-manager.d.ts +99 -185
- package/dist/core/contacts/majik-contact-manager.js +469 -289
- package/dist/core/contacts/types.d.ts +1 -0
- package/dist/core/crypto/keystore-manager.d.ts +166 -0
- package/dist/core/crypto/keystore-manager.js +371 -0
- package/dist/core/storage/chats/_types.d.ts +8 -0
- package/dist/core/storage/chats/_types.js +1 -0
- package/dist/core/storage/chats/adapter-idb.d.ts +3 -0
- package/dist/core/storage/chats/adapter-idb.js +5 -0
- package/dist/core/storage/chats/adapter-memory.d.ts +23 -0
- package/dist/core/storage/chats/adapter-memory.js +44 -0
- package/dist/core/storage/chats/adapter-sql.d.ts +17 -0
- package/dist/core/storage/chats/adapter-sql.js +85 -0
- package/dist/core/storage/client-state/_types.d.ts +37 -0
- package/dist/core/storage/client-state/_types.js +16 -0
- package/dist/core/storage/client-state/adapter-idb.d.ts +17 -0
- package/dist/core/storage/client-state/adapter-idb.js +19 -0
- package/dist/core/storage/client-state/adapter-memory.d.ts +20 -0
- package/dist/core/storage/client-state/adapter-memory.js +44 -0
- package/dist/core/storage/client-state/adapter-sql.d.ts +41 -0
- package/dist/core/storage/client-state/adapter-sql.js +104 -0
- package/dist/core/storage/contact-directory/contacts/_types.d.ts +3 -0
- package/dist/core/storage/contact-directory/contacts/_types.js +1 -0
- package/dist/core/storage/contact-directory/contacts/adapter-idb.d.ts +3 -0
- package/dist/core/storage/contact-directory/contacts/adapter-idb.js +5 -0
- package/dist/core/storage/contact-directory/contacts/adapter-memory.d.ts +14 -0
- package/dist/core/storage/contact-directory/contacts/adapter-memory.js +32 -0
- package/dist/core/storage/contact-directory/contacts/adapter-sql.d.ts +18 -0
- package/dist/core/storage/contact-directory/contacts/adapter-sql.js +97 -0
- package/dist/core/storage/contact-directory/groups/_types.d.ts +3 -0
- package/dist/core/storage/contact-directory/groups/_types.js +1 -0
- package/dist/core/storage/contact-directory/groups/adapter-idb.d.ts +3 -0
- package/dist/core/storage/contact-directory/groups/adapter-idb.js +5 -0
- package/dist/core/storage/contact-directory/groups/adapter-memory.d.ts +14 -0
- package/dist/core/storage/contact-directory/groups/adapter-memory.js +32 -0
- package/dist/core/storage/contact-directory/groups/adapter-sql.d.ts +16 -0
- package/dist/core/storage/contact-directory/groups/adapter-sql.js +72 -0
- package/dist/core/storage/idb-adapter.d.ts +21 -0
- package/dist/core/storage/idb-adapter.js +107 -0
- package/dist/core/storage/index.d.ts +24 -0
- package/dist/core/storage/index.js +19 -0
- package/dist/core/storage/keystore/_types.d.ts +3 -0
- package/dist/core/storage/keystore/_types.js +1 -0
- package/dist/core/storage/keystore/adapter-idb.d.ts +3 -0
- package/dist/core/storage/keystore/adapter-idb.js +5 -0
- package/dist/core/storage/keystore/adapter-memory.d.ts +14 -0
- package/dist/core/storage/keystore/adapter-memory.js +32 -0
- package/dist/core/storage/keystore/adapter-sql.d.ts +18 -0
- package/dist/core/storage/keystore/adapter-sql.js +93 -0
- package/dist/core/storage/sql-db-manager.d.ts +13 -0
- package/dist/core/storage/sql-db-manager.js +59 -0
- package/dist/core/storage/sql-schema.d.ts +25 -0
- package/dist/core/storage/sql-schema.js +122 -0
- package/dist/core/storage/storage-adapter.d.ts +22 -0
- package/dist/core/storage/storage-adapter.js +1 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2 -4
- package/dist/majik-message.d.ts +114 -174
- package/dist/majik-message.js +449 -675
- package/package.json +5 -6
package/dist/index.d.ts
CHANGED
|
@@ -5,13 +5,11 @@ export * from "./core/contacts/majik-contact-directory";
|
|
|
5
5
|
export * from "./core/contacts/majik-contact-groups";
|
|
6
6
|
export * from "./core/crypto/constants";
|
|
7
7
|
export * from "./core/crypto/crypto-provider";
|
|
8
|
-
export * from "./core/crypto/encryption-engine";
|
|
9
|
-
export * from "./core/crypto/keystore";
|
|
10
8
|
export * from "./core/messages/message-envelope";
|
|
11
9
|
export * from "./core/messages/envelope-cache";
|
|
12
|
-
export * from "./core/scanner/scanner-engine";
|
|
13
|
-
export * from "./core/utils/APITranscoder";
|
|
14
10
|
export * from "./core/utils/utilities";
|
|
11
|
+
export * from "./core/crypto/keystore-manager";
|
|
12
|
+
export * from "./core/storage";
|
|
15
13
|
export * from "./core/database/chat/majik-message-chat";
|
|
16
14
|
export type * from "./core/database/chat/types";
|
|
17
15
|
export * from "./core/database/system/identity";
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,11 @@ export * from "./core/contacts/majik-contact-directory";
|
|
|
4
4
|
export * from "./core/contacts/majik-contact-groups";
|
|
5
5
|
export * from "./core/crypto/constants";
|
|
6
6
|
export * from "./core/crypto/crypto-provider";
|
|
7
|
-
export * from "./core/crypto/encryption-engine";
|
|
8
|
-
export * from "./core/crypto/keystore";
|
|
9
7
|
export * from "./core/messages/message-envelope";
|
|
10
8
|
export * from "./core/messages/envelope-cache";
|
|
11
|
-
export * from "./core/scanner/scanner-engine";
|
|
12
|
-
export * from "./core/utils/APITranscoder";
|
|
13
9
|
export * from "./core/utils/utilities";
|
|
10
|
+
export * from "./core/crypto/keystore-manager";
|
|
11
|
+
export * from "./core/storage";
|
|
14
12
|
export * from "./core/database/chat/majik-message-chat";
|
|
15
13
|
export * from "./core/database/system/identity";
|
|
16
14
|
export * from "./core/compressor/majik-compressor";
|
package/dist/majik-message.d.ts
CHANGED
|
@@ -1,29 +1,48 @@
|
|
|
1
1
|
import { MajikContact, MajikContactGroup, MajikContactGroupMeta, 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
|
-
import { MajikKeyStore } from "./core/crypto/keystore";
|
|
5
4
|
import type { DecryptFileOptions, EncryptFileOptions, EncryptFileResult, MAJIK_API_RESPONSE, MajikMessagePublicKey } from "./core/types";
|
|
6
5
|
import { MajikMessageChat } from "./core/database/chat/majik-message-chat";
|
|
7
6
|
import { MajikMessageIdentity } from "./core/database/system/identity";
|
|
8
7
|
import { MajikKey } from "@majikah/majik-key";
|
|
8
|
+
import { type MajikRecipient } from "@majikah/majik-envelope";
|
|
9
9
|
import { MajikFile, MajikFileJSON } from "@majikah/majik-file";
|
|
10
10
|
import { EnvelopeInfo, ExpectedSigner, MajikSignature, SealInfo, SealVerificationResult, SignatoriesFilter, SignatoriesResult, SignatoryInfo, type MajikSignatureJSON, type MajikSignerPublicKeys, type VerificationResult } from "@majikah/majik-signature";
|
|
11
|
-
import { MajikContactManager } from "./core/contacts/majik-contact-manager";
|
|
11
|
+
import { MajikContactManager, MajikContactManagerAdapters } from "./core/contacts/majik-contact-manager";
|
|
12
12
|
import { MajikContactManagerJSON } from "./core/contacts/types";
|
|
13
|
+
import { ClientStateStorageAdapter, MajikKeyStorageAdapter, SQLiteDatabase } from "./core/storage";
|
|
14
|
+
import { MajikKeyManager } from "./core/crypto/keystore-manager";
|
|
15
|
+
import { ClientStateManager } from "./core/client-state-manager";
|
|
13
16
|
type MajikMessageEvents = "message" | "envelope" | "untrusted" | "error" | "new-account" | "new-contact" | "new-contact-group" | "removed-account" | "removed-contact" | "removed-contact-group" | "contact-group-change" | "active-account-change";
|
|
14
|
-
interface MajikMessageStatic<T extends MajikMessage> {
|
|
15
|
-
new (config: MajikMessageConfig, id?: string): T;
|
|
16
|
-
fromJSON(json: MajikMessageJSON): Promise<T>;
|
|
17
|
-
}
|
|
18
17
|
export interface MajikMessageConfig {
|
|
19
|
-
|
|
18
|
+
dbSQL?: SQLiteDatabase;
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Pass one when restoring state from fromJSON() or loadState().
|
|
20
|
+
* Shared contact directory.
|
|
21
|
+
* Pass the same instance used by MajikMessage to keep contacts in sync.
|
|
24
22
|
*/
|
|
25
23
|
contactManager?: MajikContactManager;
|
|
24
|
+
/**
|
|
25
|
+
* Pre-constructed key manager. If provided, adapters.keys is ignored.
|
|
26
|
+
* Pass the same instance used by MajikMessage / MajikSignatureClient
|
|
27
|
+
* to share a single keystore across clients.
|
|
28
|
+
*/
|
|
29
|
+
keyManager?: MajikKeyManager;
|
|
26
30
|
envelopeCache?: EnvelopeCache;
|
|
31
|
+
/**
|
|
32
|
+
* Pre-constructed client state manager. If provided, adapters.clientState
|
|
33
|
+
* is ignored.
|
|
34
|
+
*/
|
|
35
|
+
clientStateManager?: ClientStateManager;
|
|
36
|
+
adapters?: {
|
|
37
|
+
contacts?: MajikContactManagerAdapters;
|
|
38
|
+
keys?: MajikKeyStorageAdapter;
|
|
39
|
+
/**
|
|
40
|
+
* Adapter for client-level state (account order, invoice defaults, etc.).
|
|
41
|
+
* Defaults to IDB_ADAPTER_CLIENT_STATE in browser environments.
|
|
42
|
+
* Pass InMemoryClientStateAdapter for tests or non-browser runtimes.
|
|
43
|
+
*/
|
|
44
|
+
clientState?: ClientStateStorageAdapter;
|
|
45
|
+
};
|
|
27
46
|
}
|
|
28
47
|
export interface MajikMessageJSON {
|
|
29
48
|
id: string;
|
|
@@ -36,21 +55,48 @@ export interface MajikMessageJSON {
|
|
|
36
55
|
}
|
|
37
56
|
type EventCallback = (...args: any[]) => void;
|
|
38
57
|
export declare class MajikMessage {
|
|
39
|
-
private
|
|
40
|
-
private
|
|
41
|
-
private
|
|
58
|
+
private readonly _id;
|
|
59
|
+
private _db;
|
|
60
|
+
private _contacts;
|
|
61
|
+
private _keys;
|
|
62
|
+
private _state;
|
|
42
63
|
private envelopeCache;
|
|
43
|
-
private
|
|
44
|
-
|
|
45
|
-
private
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
private _listeners;
|
|
65
|
+
/** MajikContact instances for accounts this client owns. */
|
|
66
|
+
private _ownAccounts;
|
|
67
|
+
/**
|
|
68
|
+
* Ordered list of own account IDs — head is the active account.
|
|
69
|
+
* Source of truth is ClientStateManager; this array is the in-memory
|
|
70
|
+
* working copy kept in sync on every mutation.
|
|
71
|
+
*/
|
|
72
|
+
private _ownAccountsOrder;
|
|
73
|
+
private _autosaveOrderTimer;
|
|
74
|
+
constructor(config: MajikMessageConfig, id?: string);
|
|
75
|
+
/** Expose the key manager so callers can share it with other clients. */
|
|
76
|
+
get keyManager(): MajikKeyManager;
|
|
77
|
+
/** Expose the client state manager for direct access if needed. */
|
|
78
|
+
get stateManager(): ClientStateManager;
|
|
79
|
+
/**
|
|
80
|
+
* Load all domains from their adapters and restore client state.
|
|
81
|
+
* Call once on startup.
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* const client = new MajikBuwizClient({ adapters: { keys: idbAdapter, ... } });
|
|
85
|
+
* await client.hydrate();
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
hydrate(): Promise<void>;
|
|
89
|
+
private _hydrateOwnAccounts;
|
|
90
|
+
private _restoreAccountOrder;
|
|
91
|
+
private _scheduleOrderSave;
|
|
92
|
+
private _persistAccountOrder;
|
|
93
|
+
/**
|
|
94
|
+
* Construct a client and immediately hydrate it.
|
|
95
|
+
*/
|
|
96
|
+
static create<T extends MajikMessage>(this: new (config: MajikMessageConfig) => T, config?: MajikMessageConfig): Promise<T>;
|
|
51
97
|
/**
|
|
52
98
|
* Resolve a list of account/contact IDs into MajikRecipient objects.
|
|
53
|
-
* Each recipient needs their ML-KEM public key from
|
|
99
|
+
* Each recipient needs their ML-KEM public key from this.keyManager.
|
|
54
100
|
*/
|
|
55
101
|
private _resolveRecipientsByPublicKey;
|
|
56
102
|
/**
|
|
@@ -79,180 +125,78 @@ export declare class MajikMessage {
|
|
|
79
125
|
private _resolveFileRecipientsByPublicKey;
|
|
80
126
|
/** Canonical source for the scanner hostname tag. */
|
|
81
127
|
private get _source();
|
|
82
|
-
generateMnemonic(): string;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
128
|
+
generateMnemonic(strength?: 128 | 256): string;
|
|
129
|
+
createAccount(mnemonic: string, passphrase: string, label?: string): Promise<{
|
|
130
|
+
id: string;
|
|
131
|
+
fingerprint: string;
|
|
132
|
+
backup: string;
|
|
133
|
+
}>;
|
|
88
134
|
importAccountFromMnemonicBackup(backupBase64: string, mnemonic: string, passphrase: string, label?: string): Promise<{
|
|
89
135
|
id: string;
|
|
90
136
|
fingerprint: string;
|
|
91
137
|
}>;
|
|
92
|
-
|
|
93
|
-
* Create a new account from a mnemonic, store it encrypted with passphrase.
|
|
94
|
-
*/
|
|
95
|
-
createAccountFromMnemonic(mnemonic: string, passphrase: string, label?: string): Promise<{
|
|
138
|
+
replaceAccountFromMnemonicBackup(backupBase64: string, mnemonic: string, passphrase: string, label?: string): Promise<{
|
|
96
139
|
id: string;
|
|
97
140
|
fingerprint: string;
|
|
98
|
-
backup: string;
|
|
99
141
|
}>;
|
|
142
|
+
exportAccountMnemonicBackup(id: string, mnemonic: string): Promise<string>;
|
|
100
143
|
addOwnAccount(account: MajikContact): void;
|
|
101
|
-
|
|
144
|
+
removeOwnAccount(id: string): Promise<boolean>;
|
|
102
145
|
getOwnAccountById(id: string): MajikContact | undefined;
|
|
103
|
-
setActiveAccount(id: string, bypassIdentity?: boolean): Promise<boolean>;
|
|
104
146
|
getActiveAccount(): MajikContact | null;
|
|
147
|
+
getActiveAccountKey(): MajikKey | null;
|
|
105
148
|
isAccountActive(id: string): boolean;
|
|
106
|
-
|
|
149
|
+
setActiveAccount(id: string, bypassIdentity?: boolean): Promise<boolean>;
|
|
150
|
+
listOwnAccounts(majikahOnly?: boolean): MajikContact[];
|
|
151
|
+
isContactMajikahRegistered(id: string): boolean;
|
|
152
|
+
isContactMajikahIdentityChecked(id: string): boolean;
|
|
153
|
+
setContactMajikahStatus(id: string, status: boolean): void;
|
|
107
154
|
hasOwnIdentity(fingerprint: string): Promise<boolean>;
|
|
108
|
-
updatePassphrase(currentPassphrase: string, newPassphrase: string, id?: string): Promise<void>;
|
|
109
155
|
getContactByID(id: string): MajikContact | null;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
156
|
+
getContactByPublicKey(publicKeyBase64: string): Promise<MajikContact | null>;
|
|
157
|
+
getContactsByID(ids: string[], strict?: boolean): MajikContact[];
|
|
158
|
+
getContactsByPublicKey(publicKeys: string[]): Promise<MajikContact[]>;
|
|
159
|
+
getMajikRecipientsByPublicKey(publicKeys: string[], strict?: boolean): Promise<MajikRecipient[]>;
|
|
160
|
+
getExpectedSignersByPublicKey(publicKeys: string[], strict?: boolean): Promise<ExpectedSigner[]>;
|
|
161
|
+
exportContactAsJSON(id: string): Promise<string | null>;
|
|
162
|
+
exportContactAsString(id: string): Promise<string | null>;
|
|
115
163
|
importContactFromJSON(jsonStr: string): Promise<MAJIK_API_RESPONSE>;
|
|
116
164
|
importContactFromString(base64Str: string): Promise<MAJIK_API_RESPONSE>;
|
|
117
165
|
exportContactCompressed(contact: MajikContact): Promise<string>;
|
|
118
166
|
importContactCompressed(base64Str: string): Promise<MajikContact>;
|
|
119
|
-
addContact(contact: MajikContact): void
|
|
120
|
-
removeContact(id: string): void
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
isContactMajikahIdentityChecked(id: string): boolean;
|
|
127
|
-
setContactMajikahStatus(id: string, status: boolean): void;
|
|
128
|
-
/**
|
|
129
|
-
* Creates and registers a new user-defined group.
|
|
130
|
-
* Throws if a group with the same ID already exists.
|
|
131
|
-
*/
|
|
132
|
-
createGroup(id: string, name: string, meta?: Partial<Omit<MajikContactGroupMeta, "name">>, initialMemberIds?: string[]): this;
|
|
133
|
-
/**
|
|
134
|
-
* Registers an already-constructed MajikContactGroup instance.
|
|
135
|
-
* Throws if a group with the same ID already exists.
|
|
136
|
-
*/
|
|
137
|
-
addGroup(group: MajikContactGroup): this;
|
|
138
|
-
/**
|
|
139
|
-
* Removes a user group by ID.
|
|
140
|
-
* System groups (Favorites, Blocked) cannot be deleted.
|
|
141
|
-
*/
|
|
142
|
-
removeGroup(id: string): MAJIK_API_RESPONSE;
|
|
143
|
-
/**
|
|
144
|
-
* Returns a group by ID, or undefined if not found.
|
|
145
|
-
*/
|
|
167
|
+
addContact(contact: MajikContact): Promise<void>;
|
|
168
|
+
removeContact(id: string): Promise<void>;
|
|
169
|
+
listContacts(includeOwnAccounts?: boolean): MajikContact[];
|
|
170
|
+
updateContactMeta(id: string, meta: Partial<MajikContactMeta>): Promise<void>;
|
|
171
|
+
createGroup(id: string, name: string, meta?: Partial<Omit<MajikContactGroupMeta, "name">>, initialMemberIds?: string[]): Promise<this>;
|
|
172
|
+
addGroup(group: MajikContactGroup): Promise<this>;
|
|
173
|
+
removeGroup(id: string): Promise<MAJIK_API_RESPONSE>;
|
|
146
174
|
getContactGroup(id: string): MajikContactGroup | undefined;
|
|
147
|
-
/**
|
|
148
|
-
* Returns a group by ID. Throws if not found.
|
|
149
|
-
*/
|
|
150
175
|
getGroupOrThrow(id: string): MajikContactGroup;
|
|
151
|
-
/**
|
|
152
|
-
* Returns true if a group with the given ID exists.
|
|
153
|
-
*/
|
|
154
176
|
hasGroup(id: string): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Returns all groups.
|
|
157
|
-
*
|
|
158
|
-
* @param includeSystem Include system groups (Favorites, Blocked). Default: true.
|
|
159
|
-
* @param sortedByName Sort results alphabetically by group name. Default: false.
|
|
160
|
-
*/
|
|
161
177
|
listContactGroups(includeSystem?: boolean, sortedByName?: boolean): MajikContactGroup[];
|
|
162
|
-
/**
|
|
163
|
-
* Returns only user-created groups (excludes Favorites and Blocked).
|
|
164
|
-
* Sorted alphabetically by name.
|
|
165
|
-
*/
|
|
166
178
|
listUserGroups(sortedByName?: boolean): MajikContactGroup[];
|
|
167
|
-
/**
|
|
168
|
-
* Returns only system groups (Favorites and Blocked).
|
|
169
|
-
*/
|
|
170
179
|
listSystemGroups(): MajikContactGroup[];
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Adds a contact to a group.
|
|
178
|
-
* Validates the contact exists in the directory.
|
|
179
|
-
* If the group is the system Blocked group, also calls contact.block().
|
|
180
|
-
* Throws if the contact is already a member — use addContactToGroupIfAbsent for idempotent.
|
|
181
|
-
*/
|
|
182
|
-
addContactToGroup(groupID: string, contactID: string): this;
|
|
183
|
-
/**
|
|
184
|
-
* Adds multiple contacts to a group in one call (all-or-nothing).
|
|
185
|
-
*/
|
|
186
|
-
addContactsToGroup(groupID: string, contactIds: string[]): this;
|
|
187
|
-
/**
|
|
188
|
-
* Removes a contact from a group.
|
|
189
|
-
* If the group is the system Blocked group, also calls contact.unblock().
|
|
190
|
-
* Throws if the contact is not a member — use removeContactFromGroupIfPresent for idempotent.
|
|
191
|
-
*/
|
|
192
|
-
removeContactFromGroup(groupID: string, contactID: string): this;
|
|
193
|
-
/**
|
|
194
|
-
* Moves a contact from one group to another atomically.
|
|
195
|
-
* Throws if the contact is not a member of the source group.
|
|
196
|
-
*/
|
|
197
|
-
moveContactBetweenGroups(contactID: string, fromGroupId: string, toGroupId: string): this;
|
|
198
|
-
/**
|
|
199
|
-
* Returns all hydrated MajikContact instances in the given group.
|
|
200
|
-
* Contacts removed from the directory since last save are silently skipped.
|
|
201
|
-
*/
|
|
180
|
+
updateGroupMeta(id: string, meta: Partial<Pick<MajikContactGroupMeta, "name" | "description" | "color">>): Promise<this>;
|
|
181
|
+
addContactToGroup(groupID: string, contactID: string): Promise<this>;
|
|
182
|
+
addContactsToGroup(groupID: string, contactIds: string[]): Promise<this>;
|
|
183
|
+
removeContactFromGroup(groupID: string, contactID: string): Promise<this>;
|
|
184
|
+
moveContactBetweenGroups(contactID: string, fromGroupId: string, toGroupId: string): Promise<this>;
|
|
202
185
|
getContactsInGroup(groupID: string): MajikContact[];
|
|
203
|
-
/**
|
|
204
|
-
* Returns hydrated contacts in the group, sorted by label (or ID if no label).
|
|
205
|
-
*/
|
|
206
186
|
getContactsInGroupSorted(groupID: string): MajikContact[];
|
|
207
|
-
/**
|
|
208
|
-
* Returns true if the contact is a member of the given group.
|
|
209
|
-
*/
|
|
210
187
|
isContactInGroup(groupID: string, contactID: string): boolean;
|
|
211
|
-
/**
|
|
212
|
-
* Returns all groups the contact belongs to.
|
|
213
|
-
*/
|
|
214
188
|
getGroupsForContact(contactID: string): MajikContactGroup[];
|
|
215
|
-
/**
|
|
216
|
-
* Returns all group IDs the contact belongs to.
|
|
217
|
-
*/
|
|
218
189
|
getGroupIdsForContact(contactID: string): string[];
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
*/
|
|
222
|
-
addContactToFavorites(contactID: string): this;
|
|
223
|
-
/**
|
|
224
|
-
* Removes the contact from the Favorites group (idempotent).
|
|
225
|
-
*/
|
|
226
|
-
removeContactFromFavorites(contactID: string): this;
|
|
227
|
-
/**
|
|
228
|
-
* Returns true if the contact is in the Favorites group.
|
|
229
|
-
*/
|
|
190
|
+
addContactToFavorites(contactID: string): Promise<this>;
|
|
191
|
+
removeContactFromFavorites(contactID: string): Promise<this>;
|
|
230
192
|
isContactFavorite(contactID: string): boolean;
|
|
231
|
-
/**
|
|
232
|
-
* Returns true if the contact is in the Blocked group.
|
|
233
|
-
*/
|
|
234
193
|
isContactBlocked(contactID: string): boolean;
|
|
235
|
-
/**
|
|
236
|
-
* Returns the Favorites system group instance.
|
|
237
|
-
*/
|
|
238
194
|
getFavoritesGroup(): MajikContactGroup;
|
|
239
|
-
/**
|
|
240
|
-
* Returns the Blocked system group instance.
|
|
241
|
-
*/
|
|
242
195
|
getBlockedGroup(): MajikContactGroup;
|
|
243
|
-
/**
|
|
244
|
-
* Returns all contacts in the Favorites group as hydrated MajikContact instances.
|
|
245
|
-
*/
|
|
246
196
|
getFavoriteContacts(): MajikContact[];
|
|
247
|
-
/**
|
|
248
|
-
* Returns all contacts in the Blocked group as hydrated MajikContact instances.
|
|
249
|
-
*/
|
|
250
197
|
getBlockedContacts(): MajikContact[];
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
* System groups are preserved (re-bootstrapped by the group manager).
|
|
254
|
-
*/
|
|
255
|
-
clearDirectory(): this;
|
|
198
|
+
clearDirectory(): Promise<this>;
|
|
199
|
+
resolveSignerLabel(signerId: string): string;
|
|
256
200
|
/**
|
|
257
201
|
* Compose and encrypt a message for one or more recipients.
|
|
258
202
|
* Single recipient → solo envelope. Two or more → group envelope.
|
|
@@ -680,7 +624,7 @@ export declare class MajikMessage {
|
|
|
680
624
|
clearCachedEnvelopes(): Promise<boolean>;
|
|
681
625
|
/**
|
|
682
626
|
* Ensure an identity is unlocked.
|
|
683
|
-
* Delegates entirely to
|
|
627
|
+
* Delegates entirely to this.keyManager.ensureUnlocked() — passphrase prompting
|
|
684
628
|
* is handled there via onUnlockRequested or the optional promptFn.
|
|
685
629
|
*/
|
|
686
630
|
ensureIdentityUnlocked(id: string, promptFn?: (id: string) => string | Promise<string>): Promise<CryptoKey | {
|
|
@@ -689,7 +633,7 @@ export declare class MajikMessage {
|
|
|
689
633
|
isPassphraseValid(passphrase: string, id?: string): Promise<boolean>;
|
|
690
634
|
on(event: MajikMessageEvents, callback: EventCallback): void;
|
|
691
635
|
off(event: MajikMessageEvents, callback?: EventCallback): void;
|
|
692
|
-
private
|
|
636
|
+
private _emit;
|
|
693
637
|
/**
|
|
694
638
|
* Sign raw bytes or a string using the active account.
|
|
695
639
|
*
|
|
@@ -1123,15 +1067,11 @@ export declare class MajikMessage {
|
|
|
1123
1067
|
* throughout MajikMessage — consistent account/contact resolution in one place.
|
|
1124
1068
|
*/
|
|
1125
1069
|
private _resolveSignerPublicKeys;
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
private
|
|
1132
|
-
saveState(): Promise<void>;
|
|
1133
|
-
loadState(): Promise<void>;
|
|
1134
|
-
static loadOrCreate<T extends MajikMessage>(this: MajikMessageStatic<T>, config: MajikMessageConfig, userProfile?: string): Promise<T>;
|
|
1135
|
-
resetData(userProfile?: string): Promise<void>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Wipe all data from every adapter and reset in-memory state.
|
|
1072
|
+
* The client remains usable — call hydrate() or add new accounts after reset.
|
|
1073
|
+
*/
|
|
1074
|
+
resetData(): Promise<void>;
|
|
1075
|
+
private _registerOwnAccount;
|
|
1136
1076
|
}
|
|
1137
1077
|
export {};
|