@majikah/majik-message 0.2.12 → 0.2.13
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/majik-message.d.ts +5 -5
- package/dist/majik-message.js +28 -22
- package/package.json +3 -3
package/dist/majik-message.d.ts
CHANGED
|
@@ -720,13 +720,13 @@ export declare class MajikMessage {
|
|
|
720
720
|
key?: MajikKey;
|
|
721
721
|
expectedSignerId?: string;
|
|
722
722
|
}): Promise<Array<VerificationResult & {
|
|
723
|
-
handler: string |
|
|
724
|
-
mimeType: string |
|
|
723
|
+
handler: string | undefined;
|
|
724
|
+
mimeType: string | undefined;
|
|
725
725
|
error: Error | null;
|
|
726
726
|
}>>;
|
|
727
727
|
/**
|
|
728
728
|
* Extract the embedded MajikSignature from a file.
|
|
729
|
-
* Returns
|
|
729
|
+
* Returns an array of fully typed MajikSignature instances, or empty if none found.
|
|
730
730
|
*
|
|
731
731
|
* Does not verify — use verifyFile() to verify.
|
|
732
732
|
*
|
|
@@ -736,7 +736,7 @@ export declare class MajikMessage {
|
|
|
736
736
|
*/
|
|
737
737
|
extractSignature(file: Blob, options?: {
|
|
738
738
|
mimeType?: string;
|
|
739
|
-
}): Promise<MajikSignature
|
|
739
|
+
}): Promise<MajikSignature[]>;
|
|
740
740
|
/**
|
|
741
741
|
* Return a clean copy of the file with any embedded signature removed.
|
|
742
742
|
* The returned bytes are exactly what was originally signed.
|
|
@@ -817,7 +817,7 @@ export declare class MajikMessage {
|
|
|
817
817
|
*/
|
|
818
818
|
getFileSignatureInfo(file: Blob, options?: {
|
|
819
819
|
mimeType?: string;
|
|
820
|
-
}): Promise<MajikSignature
|
|
820
|
+
}): Promise<MajikSignature[]>;
|
|
821
821
|
/**
|
|
822
822
|
* Resolve MajikSignerPublicKeys from whichever signer hint was provided.
|
|
823
823
|
* Returns null if no hint was given (caller should fall back to self-reported keys).
|
package/dist/majik-message.js
CHANGED
|
@@ -1550,16 +1550,18 @@ export class MajikMessage {
|
|
|
1550
1550
|
try {
|
|
1551
1551
|
const publicKeys = await this._resolveSignerPublicKeys(options);
|
|
1552
1552
|
if (publicKeys) {
|
|
1553
|
-
|
|
1553
|
+
const results = await MajikSignature.verifyFile(file, publicKeys, {
|
|
1554
1554
|
expectedSignerId: options?.expectedSignerId,
|
|
1555
1555
|
mimeType: options?.mimeType,
|
|
1556
|
-
});
|
|
1556
|
+
}, true);
|
|
1557
|
+
return results[0];
|
|
1557
1558
|
}
|
|
1558
|
-
// No signer provided — extract and use self-reported keys
|
|
1559
|
+
// No signer provided — extract and use self-reported keys from first signature.
|
|
1560
|
+
// For full multi-sig verification, pass a contactId or publicKeyBase64.
|
|
1559
1561
|
const extracted = await MajikSignature.extractFrom(file, {
|
|
1560
1562
|
mimeType: options?.mimeType,
|
|
1561
1563
|
});
|
|
1562
|
-
if (!extracted) {
|
|
1564
|
+
if (!extracted.length) {
|
|
1563
1565
|
return {
|
|
1564
1566
|
valid: false,
|
|
1565
1567
|
signerId: "",
|
|
@@ -1568,10 +1570,12 @@ export class MajikMessage {
|
|
|
1568
1570
|
reason: "No embedded signature found",
|
|
1569
1571
|
};
|
|
1570
1572
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
+
const firstSig = extracted[0];
|
|
1574
|
+
const results = await MajikSignature.verifyFile(file, firstSig.extractPublicKeys(), {
|
|
1575
|
+
expectedSignerId: firstSig.signerId,
|
|
1573
1576
|
mimeType: options?.mimeType,
|
|
1574
|
-
});
|
|
1577
|
+
}, true);
|
|
1578
|
+
return results[0];
|
|
1575
1579
|
}
|
|
1576
1580
|
catch (err) {
|
|
1577
1581
|
this.emit("error", err, { context: "verifyFile" });
|
|
@@ -1609,34 +1613,36 @@ export class MajikMessage {
|
|
|
1609
1613
|
try {
|
|
1610
1614
|
let result;
|
|
1611
1615
|
if (publicKeys) {
|
|
1612
|
-
|
|
1616
|
+
const results = await MajikSignature.verifyFile(file, publicKeys, {
|
|
1613
1617
|
mimeType,
|
|
1614
1618
|
expectedSignerId,
|
|
1615
1619
|
});
|
|
1620
|
+
result = results[0];
|
|
1616
1621
|
}
|
|
1617
1622
|
else {
|
|
1618
|
-
// No signer hint — use self-reported keys from each file's envelope
|
|
1619
1623
|
const extracted = await MajikSignature.extractFrom(file, {
|
|
1620
1624
|
mimeType,
|
|
1621
1625
|
});
|
|
1622
|
-
if (!extracted) {
|
|
1626
|
+
if (!extracted.length) {
|
|
1623
1627
|
return {
|
|
1624
1628
|
valid: false,
|
|
1625
|
-
signerId:
|
|
1626
|
-
contentHash:
|
|
1629
|
+
signerId: undefined,
|
|
1630
|
+
contentHash: undefined,
|
|
1627
1631
|
timestamp: new Date().toISOString(),
|
|
1628
1632
|
reason: "No embedded signature found",
|
|
1629
|
-
handler:
|
|
1630
|
-
mimeType
|
|
1633
|
+
handler: undefined,
|
|
1634
|
+
mimeType,
|
|
1631
1635
|
error: null,
|
|
1632
1636
|
};
|
|
1633
1637
|
}
|
|
1634
|
-
|
|
1638
|
+
const firstSig = extracted[0];
|
|
1639
|
+
const results = await MajikSignature.verifyFile(file, firstSig.extractPublicKeys(), { mimeType, expectedSignerId: firstSig.signerId });
|
|
1640
|
+
result = results[0];
|
|
1635
1641
|
}
|
|
1636
1642
|
return {
|
|
1637
1643
|
...result,
|
|
1638
|
-
handler: result.handler
|
|
1639
|
-
mimeType
|
|
1644
|
+
handler: result.handler,
|
|
1645
|
+
mimeType,
|
|
1640
1646
|
error: null,
|
|
1641
1647
|
};
|
|
1642
1648
|
}
|
|
@@ -1644,11 +1650,11 @@ export class MajikMessage {
|
|
|
1644
1650
|
this.emit("error", err, { context: "batchVerifyFiles" });
|
|
1645
1651
|
return {
|
|
1646
1652
|
valid: false,
|
|
1647
|
-
signerId:
|
|
1648
|
-
contentHash:
|
|
1653
|
+
signerId: undefined,
|
|
1654
|
+
contentHash: undefined,
|
|
1649
1655
|
timestamp: new Date().toISOString(),
|
|
1650
|
-
handler:
|
|
1651
|
-
mimeType
|
|
1656
|
+
handler: undefined,
|
|
1657
|
+
mimeType,
|
|
1652
1658
|
error: err instanceof Error ? err : new Error(String(err)),
|
|
1653
1659
|
};
|
|
1654
1660
|
}
|
|
@@ -1657,7 +1663,7 @@ export class MajikMessage {
|
|
|
1657
1663
|
// ── Signature Utilities ───────────────────────────────────────────────────
|
|
1658
1664
|
/**
|
|
1659
1665
|
* Extract the embedded MajikSignature from a file.
|
|
1660
|
-
* Returns
|
|
1666
|
+
* Returns an array of fully typed MajikSignature instances, or empty if none found.
|
|
1661
1667
|
*
|
|
1662
1668
|
* Does not verify — use verifyFile() to verify.
|
|
1663
1669
|
*
|
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.13",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@bokuweb/zstd-wasm": "^0.0.27",
|
|
83
83
|
"@majikah/majik-envelope": "^0.0.1",
|
|
84
|
-
"@majikah/majik-file": "^0.0.
|
|
84
|
+
"@majikah/majik-file": "^0.0.21",
|
|
85
85
|
"@majikah/majik-key": "^0.2.3",
|
|
86
|
-
"@majikah/majik-signature": "^0.0.
|
|
86
|
+
"@majikah/majik-signature": "^0.0.14",
|
|
87
87
|
"@noble/hashes": "^2.0.1",
|
|
88
88
|
"@noble/post-quantum": "^0.5.4",
|
|
89
89
|
"@scure/bip39": "^1.6.0",
|