@majikah/majik-signature-client-tauri 1.2.0 → 1.3.4

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/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MajikKeyClientTauri, type MajikKeyClientTauriOptions, type MajikContactMeta, type OpenedSession } from "@majikah/majik-key-client-tauri";
2
- import type { ApiResponse, AppDataSummary, BackupType, BatchDetached, BatchDetachedArgs, BatchSignFilesArgs, BatchSignOutcome, BytesOutput, Cosign, CosignArgs, CreateGroupArgs, CreateStampArgs, Ctx, DetachedSigned, ExpectedSigner, FileChain, FileInput, FileSignatureInfo, HistoryLog, HistorySource, Json, MajikChainAnchor, MajikSignatureJSON, MajikTimestamp, MapFileInfo, MapOrder, MapVerify, OrderArgs, OutputTarget, Permit, ResignArgs, RevisionSet, SealedFile, SelectiveRestoreOptions, SerializedMajikContact, SerializedMajikContactGroup, SigHydrateReport, SigOnlyEventMap, SigOnlyEventType, SignatoriesFilter, SignatureMetadata, SignDetachedArgs, SignedFile, SignerRef, SignFileArgs, SignTextOptions, SignTextResult, SkippedItem, StampAssetKind, StampMeta, TsaBegin, UpdateGroupMetaArgs, UserActivityLog, UserAppPreferences, VerifyDetachedArgs, VerifyFileArgs, VerifyMapArgs, VerifyResult, VerifyTextArgs } from "./types.js";
2
+ import type { ApiResponse, AppDataSummary, BackupType, BatchDetached, BatchDetachedArgs, BatchSignFilesArgs, BatchSignOutcome, BytesOutput, Cosign, CosignArgs, CreateGroupArgs, CreateStampArgs, Ctx, DetachedSigned, ExpectedSigner, FileChain, FileInput, FileSignatureInfo, HistoryLog, HistorySource, Json, MajikChainAnchor, MajikSignatureJSON, MajikTimestamp, MapFileInfo, MapOrder, MapVerify, OrderArgs, OutputTarget, Permit, ResignArgs, RevisionSet, SealedFile, SelectiveRestoreOptions, SerializedMajikContact, SerializedMajikContactGroup, SigHydrateReport, SigOnlyEventMap, SigOnlyEventType, SignatoriesFilter, SignatureMetadata, SignDetachedArgs, SignSessionFileArgs, SessionSigned, EncryptSignRoomFileArgs, EncryptSignRoomFileResult, DecryptSignRoomFileArgs, DecryptSignRoomFileResult, SignedFile, SignerRef, SignFileArgs, SignTextOptions, SignTextResult, SkippedItem, StampAssetKind, StampMeta, TsaBegin, UpdateGroupMetaArgs, UserActivityLog, UserAppPreferences, VerifyDetachedArgs, VerifyFileArgs, VerifyMapArgs, VerifyResult, VerifyTextArgs } from "./types.js";
3
3
  export declare const SIGNATURE_PLUGIN = "majik-signature-client";
4
4
  export declare const SIGNATURE_EVENT_CHANNEL = "majik-signature-client:event";
5
5
  export type MajikSignatureClientTauriOptions = MajikKeyClientTauriOptions;
@@ -62,6 +62,13 @@ export declare class MajikSignatureClientTauri extends MajikKeyClientTauri {
62
62
  endSigningSession(): Promise<void>;
63
63
  forceEndSigningSession(): Promise<void>;
64
64
  isSigningSessionActive(): Promise<boolean>;
65
+ /** Resolve the account's domain-separated Majik Key Solana signer address. */
66
+ getSolanaSignerAddress(accountId?: string): Promise<string>;
67
+ /**
68
+ * Sign exact message bytes with the Majik Key Solana signer.
69
+ * Only the 64-byte signature is returned; private key material remains in Rust.
70
+ */
71
+ signSolanaMessage(message: Uint8Array, accountId?: string): Promise<Uint8Array>;
65
72
  listContacts(sortedByLabel?: boolean, majikahOnly?: boolean): Promise<SerializedMajikContact[]>;
66
73
  getContact(id: string): Promise<SerializedMajikContact | null>;
67
74
  getContactByFingerprint(fingerprint: string): Promise<SerializedMajikContact | null>;
@@ -117,6 +124,12 @@ export declare class MajikSignatureClientTauri extends MajikKeyClientTauri {
117
124
  signFile(args: SignFileArgs): Promise<SignedFile>;
118
125
  /** Sign `input` and produce a separate `.mjksig` envelope. */
119
126
  signFileDetached(args: SignDetachedArgs): Promise<DetachedSigned>;
127
+ /** Sign a SignRoom document using the issued challenge and revision-chain commitment. */
128
+ signSessionFile(args: SignSessionFileArgs): Promise<SessionSigned>;
129
+ /** Encrypt a SignRoom source with the owner's public key and pinned recipients. */
130
+ encryptSignRoomFile(args: EncryptSignRoomFileArgs): Promise<EncryptSignRoomFileResult>;
131
+ /** Decrypt and verify a SignRoom MJKB with the selected local Majik Key. */
132
+ decryptSignRoomFile(args: DecryptSignRoomFileArgs): Promise<DecryptSignRoomFileResult>;
120
133
  resignFile(args: ResignArgs): Promise<SignedFile>;
121
134
  batchSignFiles(args: BatchSignFilesArgs): Promise<BatchSignOutcome[]>;
122
135
  /** Step 1 of a timestamped signature: sign, then POST `tsaRequest` to the TSA. */
package/dist/client.js CHANGED
@@ -126,6 +126,23 @@ export class MajikSignatureClientTauri extends MajikKeyClientTauri {
126
126
  isSigningSessionActive() {
127
127
  return this.invoke("is_signing_session_active");
128
128
  }
129
+ /** Resolve the account's domain-separated Majik Key Solana signer address. */
130
+ getSolanaSignerAddress(accountId) {
131
+ return this.invoke("get_solana_signer_address", compact({ accountId }));
132
+ }
133
+ /**
134
+ * Sign exact message bytes with the Majik Key Solana signer.
135
+ * Only the 64-byte signature is returned; private key material remains in Rust.
136
+ */
137
+ async signSolanaMessage(message, accountId) {
138
+ const signature = await this.invoke("sign_solana_message", compact({ message: Array.from(message), accountId }));
139
+ if (!Array.isArray(signature) ||
140
+ signature.length !== 64 ||
141
+ !signature.every((byte) => Number.isInteger(byte) && byte >= 0 && byte <= 255)) {
142
+ throw new Error("Rust returned an invalid Solana Ed25519 signature.");
143
+ }
144
+ return Uint8Array.from(signature);
145
+ }
129
146
  listContacts(sortedByLabel, majikahOnly) {
130
147
  return this.invoke("list_contacts", compact({ sortedByLabel, majikahOnly }));
131
148
  }
@@ -268,6 +285,18 @@ export class MajikSignatureClientTauri extends MajikKeyClientTauri {
268
285
  signFileDetached(args) {
269
286
  return this.invoke("sign_file_detached", compact({ args }));
270
287
  }
288
+ /** Sign a SignRoom document using the issued challenge and revision-chain commitment. */
289
+ signSessionFile(args) {
290
+ return this.invoke("sign_session_file", compact({ args }));
291
+ }
292
+ /** Encrypt a SignRoom source with the owner's public key and pinned recipients. */
293
+ encryptSignRoomFile(args) {
294
+ return this.invoke("encrypt_signroom_file", compact({ args }));
295
+ }
296
+ /** Decrypt and verify a SignRoom MJKB with the selected local Majik Key. */
297
+ decryptSignRoomFile(args) {
298
+ return this.invoke("decrypt_signroom_file", compact({ args }));
299
+ }
271
300
  resignFile(args) {
272
301
  return this.invoke("resign_file", compact({ args }));
273
302
  }
package/dist/types.d.ts CHANGED
@@ -151,6 +151,82 @@ export interface SignDetachedArgs {
151
151
  options?: SignDetachedOptions;
152
152
  ctx?: Ctx;
153
153
  }
154
+ /** Authoritative SignRoom context issued by the session service. */
155
+ export interface SessionSigningContext {
156
+ sessionId: string;
157
+ challengeId: string;
158
+ policyHash: string;
159
+ }
160
+ /** Immutable SignRoom document-revision entry committed by the signature. */
161
+ export interface FileVersion {
162
+ version: number;
163
+ timestamp: string;
164
+ contentHash: string;
165
+ createdBy: string;
166
+ previousVersionHash?: string;
167
+ message?: string;
168
+ }
169
+ export interface SignSessionFileOptions {
170
+ sessionContext: SessionSigningContext;
171
+ contentType?: string;
172
+ timestamp?: string;
173
+ mimeType?: string;
174
+ expectedSigners?: SignerRef[];
175
+ validUntil?: string;
176
+ existingEnvelope?: FileInput;
177
+ fileVersion?: FileVersion;
178
+ priorFile?: FileInput;
179
+ message?: string;
180
+ }
181
+ export interface SignSessionFileArgs {
182
+ input: FileInput;
183
+ options: SignSessionFileOptions;
184
+ ctx?: Ctx;
185
+ }
186
+ export interface SessionSigned {
187
+ signature: MajikSignatureJSON;
188
+ handler: string;
189
+ mimeType: string;
190
+ }
191
+ export interface SignRoomPublicEncryptionIdentity {
192
+ fingerprint: string;
193
+ publicKey: string;
194
+ mlKemPublicKey: string;
195
+ }
196
+ export interface SignRoomPublicRecipient {
197
+ fingerprint: string;
198
+ publicKey: string;
199
+ mlKemPublicKey: string;
200
+ }
201
+ export interface EncryptSignRoomFileArgs {
202
+ input: FileInput;
203
+ owner: SignRoomPublicEncryptionIdentity;
204
+ recipients?: SignRoomPublicRecipient[];
205
+ output?: OutputTarget;
206
+ }
207
+ export interface EncryptSignRoomFileResult {
208
+ file: BytesOutput;
209
+ contentHash: string;
210
+ originalName: string;
211
+ contentType: string;
212
+ sizeBytes: number;
213
+ }
214
+ export interface DecryptSignRoomFileArgs {
215
+ input: FileInput;
216
+ accountId: string;
217
+ expectedOriginalName: string;
218
+ expectedContentType: string;
219
+ expectedSizeBytes: number;
220
+ expectedContentHash: string;
221
+ output?: OutputTarget;
222
+ }
223
+ export interface DecryptSignRoomFileResult {
224
+ file: BytesOutput;
225
+ originalName: string;
226
+ contentType: string;
227
+ sizeBytes: number;
228
+ contentHash: string;
229
+ }
154
230
  export interface ResignArgs {
155
231
  previousSignedFile: FileInput;
156
232
  newFile: FileInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majikah/majik-signature-client-tauri",
3
- "version": "1.2.0",
3
+ "version": "1.3.4",
4
4
  "description": "Typed TypeScript facade over tauri-plugin-majik-signature-client. Extends the key client facade; keys, contacts, stamps, logs and signing live in Rust.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -46,4 +46,4 @@
46
46
  "typescript": "^7.0.2",
47
47
  "vitest": "^5.1.0"
48
48
  }
49
- }
49
+ }