@majikah/majik-signature-client 0.6.4 → 0.6.5
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/storage/client-state/_types.d.ts +1 -8
- package/dist/core/storage/client-state/_types.js +2 -1
- package/dist/core/storage/client-state/adapter-idb.d.ts +1 -1
- package/dist/core/storage/client-state/adapter-memory.d.ts +2 -1
- package/dist/core/storage/client-state/adapter-sql.d.ts +2 -1
- package/dist/majik-signature-client.js +9 -9
- package/package.json +1 -1
|
@@ -7,15 +7,8 @@
|
|
|
7
7
|
* ClientStateManager owns all serialisation / deserialisation logic; the
|
|
8
8
|
* adapter only moves bytes.
|
|
9
9
|
*/
|
|
10
|
+
import { ClientStateEntry } from "@majikah/majik-key-client";
|
|
10
11
|
import { MajikStorageAdapter } from "../storage-adapter";
|
|
11
|
-
export interface ClientStateEntry {
|
|
12
|
-
/** Stable string key that identifies this piece of state. */
|
|
13
|
-
id: string;
|
|
14
|
-
/** JSON-serialised value. Always a string on the wire / in storage. */
|
|
15
|
-
value: string;
|
|
16
|
-
/** ISO 8601 datetime — set by the adapter on every write where supported. */
|
|
17
|
-
updatedAt?: string;
|
|
18
|
-
}
|
|
19
12
|
export declare const CLIENT_STATE_KEYS: {
|
|
20
13
|
readonly ACCOUNT_ORDER: "user_account_order";
|
|
21
14
|
readonly USER_APP_PREFERENCES: "user_app_preferences";
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* ClientStateManager owns all serialisation / deserialisation logic; the
|
|
8
8
|
* adapter only moves bytes.
|
|
9
9
|
*/
|
|
10
|
+
import { BASE_CLIENT_STATE_KEYS } from "@majikah/majik-key-client";
|
|
10
11
|
// ---------------------------------------------------------------------------
|
|
11
12
|
// Well-known state keys
|
|
12
13
|
// ---------------------------------------------------------------------------
|
|
13
14
|
export const CLIENT_STATE_KEYS = {
|
|
14
|
-
|
|
15
|
+
...BASE_CLIENT_STATE_KEYS,
|
|
15
16
|
USER_APP_PREFERENCES: "user_app_preferences",
|
|
16
17
|
};
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* Each entry is stored with `id` as the keyPath — identical to the invoice
|
|
13
13
|
* and contact adapters.
|
|
14
14
|
*/
|
|
15
|
-
import type { ClientStateEntry } from "
|
|
15
|
+
import type { ClientStateEntry } from "@majikah/majik-key-client";
|
|
16
16
|
import { IDBGenericAdapter } from "../idb-adapter";
|
|
17
17
|
export declare const IDB_ADAPTER_CLIENT_STATE: IDBGenericAdapter<ClientStateEntry>;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* Default adapter — zero-config, non-persistent. State is lost on page reload
|
|
6
6
|
* or process restart. Useful for tests, SSR, and headless environments.
|
|
7
7
|
*/
|
|
8
|
-
import type { ClientStateEntry
|
|
8
|
+
import type { ClientStateEntry } from "@majikah/majik-key-client";
|
|
9
|
+
import type { ClientStateStorageAdapter } from "./_types";
|
|
9
10
|
export declare class InMemoryClientStateAdapter implements ClientStateStorageAdapter {
|
|
10
11
|
private _store;
|
|
11
12
|
save(entry: ClientStateEntry): Promise<void>;
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
* needed) and mapped to the `id` field of ClientStateEntry in TypeScript so
|
|
18
18
|
* the adapter contract is identical to the IDB and memory variants.
|
|
19
19
|
*/
|
|
20
|
-
import type {
|
|
20
|
+
import type { ClientStateStorageAdapter } from "./_types";
|
|
21
21
|
import type { SQLiteDatabase } from "../sql-db-manager";
|
|
22
|
+
import type { ClientStateEntry } from "@majikah/majik-key-client";
|
|
22
23
|
/** DDL — pass to your migration runner or call createSchema() directly. */
|
|
23
24
|
export declare const MAJIK_CLIENT_STATE_SCHEMA: string;
|
|
24
25
|
export declare class SQLiteClientStateAdapter implements ClientStateStorageAdapter {
|
|
@@ -110,44 +110,44 @@ export class MajikSignatureClient extends MajikKeyClient {
|
|
|
110
110
|
* Retrieve persisted user app prefernces, or `null` if none have been saved.
|
|
111
111
|
*/
|
|
112
112
|
async getUserAppPreferences() {
|
|
113
|
-
return this.
|
|
113
|
+
return this.stateManager.getUserAppPreferences();
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Persist user app prefernces.
|
|
117
117
|
*/
|
|
118
118
|
async setUserAppPreferences(preferences) {
|
|
119
|
-
await this.
|
|
119
|
+
await this.stateManager.setUserAppPreferences(preferences);
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Remove persisted user app prefernces.
|
|
123
123
|
*/
|
|
124
124
|
async removeUserAppPreferences() {
|
|
125
|
-
await this.
|
|
125
|
+
await this.stateManager.removeUserAppPreferences();
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Reset persisted user app prefernces to default settings.
|
|
129
129
|
*/
|
|
130
130
|
async resetUserAppPreferences() {
|
|
131
|
-
await this.
|
|
131
|
+
await this.stateManager.resetUserAppPreferences();
|
|
132
132
|
}
|
|
133
133
|
async isAnalyticsEnabled() {
|
|
134
|
-
const appPreferences = await this.
|
|
134
|
+
const appPreferences = await this.stateManager.getUserAppPreferences();
|
|
135
135
|
return appPreferences.privacy.shareAnalytics ?? false;
|
|
136
136
|
}
|
|
137
137
|
async isAutoSealEnabled() {
|
|
138
|
-
const appPreferences = await this.
|
|
138
|
+
const appPreferences = await this.stateManager.getUserAppPreferences();
|
|
139
139
|
return appPreferences.signing.autoSeal ?? false;
|
|
140
140
|
}
|
|
141
141
|
async isAutoLockOnMinimizeEnabled() {
|
|
142
|
-
const appPreferences = await this.
|
|
142
|
+
const appPreferences = await this.stateManager.getUserAppPreferences();
|
|
143
143
|
return appPreferences.security?.key?.autoLockOnMinimize ?? false;
|
|
144
144
|
}
|
|
145
145
|
async autoLockInterval() {
|
|
146
|
-
const appPreferences = await this.
|
|
146
|
+
const appPreferences = await this.stateManager.getUserAppPreferences();
|
|
147
147
|
return appPreferences.security?.key?.autoLockInterval;
|
|
148
148
|
}
|
|
149
149
|
async isOnetimeUnlockEnabled() {
|
|
150
|
-
const appPreferences = await this.
|
|
150
|
+
const appPreferences = await this.stateManager.getUserAppPreferences();
|
|
151
151
|
return appPreferences.security?.key?.onetimeUnlock ?? true;
|
|
152
152
|
}
|
|
153
153
|
// ==========================================================================
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@majikah/majik-signature-client",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Majik Signature Client is a hybrid post-quantum content signing and verification library for the Majikah ecosystem. Built on top of Majik Key Client, it provides tamper-proof, forgery-resistant digital signatures for any content format — using a dual-algorithm architecture that combines classical Ed25519 with post-quantum ML-DSA-87 (FIPS-204).",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|