@agora-sdk/secure-chat-core 0.7.0 → 0.8.0
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/cjs/content/builders.d.ts +40 -0
- package/dist/cjs/content/builders.js +85 -0
- package/dist/cjs/content/builders.js.map +1 -0
- package/dist/cjs/content/cbor.d.ts +48 -0
- package/dist/cjs/content/cbor.js +298 -0
- package/dist/cjs/content/cbor.js.map +1 -0
- package/dist/cjs/content/frame.d.ts +24 -0
- package/dist/cjs/content/frame.js +39 -0
- package/dist/cjs/content/frame.js.map +1 -0
- package/dist/cjs/content/mimi-content.d.ts +194 -0
- package/dist/cjs/content/mimi-content.js +289 -0
- package/dist/cjs/content/mimi-content.js.map +1 -0
- package/dist/cjs/hooks/message-fold.d.ts +91 -0
- package/dist/cjs/hooks/message-fold.js +218 -0
- package/dist/cjs/hooks/message-fold.js.map +1 -0
- package/dist/cjs/hooks/useSecureMessages.d.ts +30 -18
- package/dist/cjs/hooks/useSecureMessages.js +190 -238
- package/dist/cjs/hooks/useSecureMessages.js.map +1 -1
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +27 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/persistence/repository.d.ts +11 -11
- package/dist/cjs/persistence/repository.js +19 -19
- package/dist/cjs/persistence/repository.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/content/builders.d.ts +40 -0
- package/dist/esm/content/builders.js +77 -0
- package/dist/esm/content/builders.js.map +1 -0
- package/dist/esm/content/cbor.d.ts +48 -0
- package/dist/esm/content/cbor.js +292 -0
- package/dist/esm/content/cbor.js.map +1 -0
- package/dist/esm/content/frame.d.ts +24 -0
- package/dist/esm/content/frame.js +34 -0
- package/dist/esm/content/frame.js.map +1 -0
- package/dist/esm/content/mimi-content.d.ts +194 -0
- package/dist/esm/content/mimi-content.js +283 -0
- package/dist/esm/content/mimi-content.js.map +1 -0
- package/dist/esm/hooks/message-fold.d.ts +91 -0
- package/dist/esm/hooks/message-fold.js +214 -0
- package/dist/esm/hooks/message-fold.js.map +1 -0
- package/dist/esm/hooks/useSecureMessages.d.ts +30 -18
- package/dist/esm/hooks/useSecureMessages.js +192 -240
- package/dist/esm/hooks/useSecureMessages.js.map +1 -1
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/persistence/repository.d.ts +11 -11
- package/dist/esm/persistence/repository.js +19 -19
- package/dist/esm/persistence/repository.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -2
package/dist/cjs/index.d.ts
CHANGED
|
@@ -31,5 +31,12 @@ export { padPlaintext, unpadPlaintext, nextBucket } from "./util/padding.js";
|
|
|
31
31
|
export type { PaddingPolicy } from "./util/padding.js";
|
|
32
32
|
export { computeSafetyNumber } from "./util/safety-number.js";
|
|
33
33
|
export type { SafetyNumber } from "./util/safety-number.js";
|
|
34
|
+
export { encodeMimiContent, decodeMimiContent, contentHash, Cardinality, Disposition, HashAlg, PartSemantics, MIMI_LIMITS, } from "./content/mimi-content.js";
|
|
35
|
+
export type { MimiContent, Part, NullPart, SinglePart, ExternalPart, MultiPart, Expiration, } from "./content/mimi-content.js";
|
|
36
|
+
export { buildPost, buildReply, buildEdit, buildDelete, buildReaction, buildUnreact, } from "./content/builders.js";
|
|
37
|
+
export { frameContent, unframe, ContentKind } from "./content/frame.js";
|
|
38
|
+
export type { RenderedContent } from "./hooks/message-fold.js";
|
|
39
|
+
export { encode as encodeCbor, decode as decodeCbor, CborTag } from "./content/cbor.js";
|
|
40
|
+
export type { CborValue, CborMap, CborLimits } from "./content/cbor.js";
|
|
34
41
|
export { setSecureChatDebug, isSecureChatDebugEnabled } from "./util/debug.js";
|
|
35
42
|
export type { SecureChatDebugLevel, SecureChatDebugLogger } from "./util/debug.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// injection of a `SecureChatCrypto`. Platform packages (@agora-sdk/secure-chat-react-js, etc.)
|
|
6
6
|
// re-export this and add the concrete crypto + persistence.
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.isSecureChatDebugEnabled = exports.setSecureChatDebug = exports.computeSafetyNumber = exports.nextBucket = exports.unpadPlaintext = exports.padPlaintext = exports.bytesToUtf8 = exports.utf8ToBytes = exports.fromBase64 = exports.toBase64 = exports.SecureChatRepository = exports.MemoryStore = exports.SecureChatDecryptError = exports.SecureChatSocketClient = exports.SecureChatRestClient = exports.estimatePassphraseStrength = exports.useSecureSafetyNumber = exports.useSecureBackup = exports.useSecureHandshakes = exports.useSecureMessages = exports.useSecureConversations = exports.useSecureDevice = exports.useSecureChat = exports.SecureChatProvider = exports.VERSION = void 0;
|
|
8
|
+
exports.isSecureChatDebugEnabled = exports.setSecureChatDebug = exports.CborTag = exports.decodeCbor = exports.encodeCbor = exports.ContentKind = exports.unframe = exports.frameContent = exports.buildUnreact = exports.buildReaction = exports.buildDelete = exports.buildEdit = exports.buildReply = exports.buildPost = exports.MIMI_LIMITS = exports.PartSemantics = exports.HashAlg = exports.Disposition = exports.Cardinality = exports.contentHash = exports.decodeMimiContent = exports.encodeMimiContent = exports.computeSafetyNumber = exports.nextBucket = exports.unpadPlaintext = exports.padPlaintext = exports.bytesToUtf8 = exports.utf8ToBytes = exports.fromBase64 = exports.toBase64 = exports.SecureChatRepository = exports.MemoryStore = exports.SecureChatDecryptError = exports.SecureChatSocketClient = exports.SecureChatRestClient = exports.estimatePassphraseStrength = exports.useSecureSafetyNumber = exports.useSecureBackup = exports.useSecureHandshakes = exports.useSecureMessages = exports.useSecureConversations = exports.useSecureDevice = exports.useSecureChat = exports.SecureChatProvider = exports.VERSION = void 0;
|
|
9
9
|
// ── version (generated from package.json; see scripts/write-version.mjs) ──────
|
|
10
10
|
var version_js_1 = require("./version.js");
|
|
11
11
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_js_1.VERSION; } });
|
|
@@ -52,6 +52,32 @@ Object.defineProperty(exports, "unpadPlaintext", { enumerable: true, get: functi
|
|
|
52
52
|
Object.defineProperty(exports, "nextBucket", { enumerable: true, get: function () { return padding_js_1.nextBucket; } });
|
|
53
53
|
var safety_number_js_1 = require("./util/safety-number.js");
|
|
54
54
|
Object.defineProperty(exports, "computeSafetyNumber", { enumerable: true, get: function () { return safety_number_js_1.computeSafetyNumber; } });
|
|
55
|
+
// ── MIMI content (CBOR message content + routing frame + fold) ─────────────────
|
|
56
|
+
var mimi_content_js_1 = require("./content/mimi-content.js");
|
|
57
|
+
Object.defineProperty(exports, "encodeMimiContent", { enumerable: true, get: function () { return mimi_content_js_1.encodeMimiContent; } });
|
|
58
|
+
Object.defineProperty(exports, "decodeMimiContent", { enumerable: true, get: function () { return mimi_content_js_1.decodeMimiContent; } });
|
|
59
|
+
Object.defineProperty(exports, "contentHash", { enumerable: true, get: function () { return mimi_content_js_1.contentHash; } });
|
|
60
|
+
Object.defineProperty(exports, "Cardinality", { enumerable: true, get: function () { return mimi_content_js_1.Cardinality; } });
|
|
61
|
+
Object.defineProperty(exports, "Disposition", { enumerable: true, get: function () { return mimi_content_js_1.Disposition; } });
|
|
62
|
+
Object.defineProperty(exports, "HashAlg", { enumerable: true, get: function () { return mimi_content_js_1.HashAlg; } });
|
|
63
|
+
Object.defineProperty(exports, "PartSemantics", { enumerable: true, get: function () { return mimi_content_js_1.PartSemantics; } });
|
|
64
|
+
Object.defineProperty(exports, "MIMI_LIMITS", { enumerable: true, get: function () { return mimi_content_js_1.MIMI_LIMITS; } });
|
|
65
|
+
var builders_js_1 = require("./content/builders.js");
|
|
66
|
+
Object.defineProperty(exports, "buildPost", { enumerable: true, get: function () { return builders_js_1.buildPost; } });
|
|
67
|
+
Object.defineProperty(exports, "buildReply", { enumerable: true, get: function () { return builders_js_1.buildReply; } });
|
|
68
|
+
Object.defineProperty(exports, "buildEdit", { enumerable: true, get: function () { return builders_js_1.buildEdit; } });
|
|
69
|
+
Object.defineProperty(exports, "buildDelete", { enumerable: true, get: function () { return builders_js_1.buildDelete; } });
|
|
70
|
+
Object.defineProperty(exports, "buildReaction", { enumerable: true, get: function () { return builders_js_1.buildReaction; } });
|
|
71
|
+
Object.defineProperty(exports, "buildUnreact", { enumerable: true, get: function () { return builders_js_1.buildUnreact; } });
|
|
72
|
+
var frame_js_1 = require("./content/frame.js");
|
|
73
|
+
Object.defineProperty(exports, "frameContent", { enumerable: true, get: function () { return frame_js_1.frameContent; } });
|
|
74
|
+
Object.defineProperty(exports, "unframe", { enumerable: true, get: function () { return frame_js_1.unframe; } });
|
|
75
|
+
Object.defineProperty(exports, "ContentKind", { enumerable: true, get: function () { return frame_js_1.ContentKind; } });
|
|
76
|
+
// Low-level CBOR codec (advanced; the IUC control channel reuses it under kind 1).
|
|
77
|
+
var cbor_js_1 = require("./content/cbor.js");
|
|
78
|
+
Object.defineProperty(exports, "encodeCbor", { enumerable: true, get: function () { return cbor_js_1.encode; } });
|
|
79
|
+
Object.defineProperty(exports, "decodeCbor", { enumerable: true, get: function () { return cbor_js_1.decode; } });
|
|
80
|
+
Object.defineProperty(exports, "CborTag", { enumerable: true, get: function () { return cbor_js_1.CborTag; } });
|
|
55
81
|
// ── dev logging (off by default; see util/debug) ──────────────────────────────
|
|
56
82
|
var debug_js_1 = require("./util/debug.js");
|
|
57
83
|
Object.defineProperty(exports, "setSecureChatDebug", { enumerable: true, get: function () { return debug_js_1.setSecureChatDebug; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,8FAA8F;AAC9F,EAAE;AACF,6FAA6F;AAC7F,+FAA+F;AAC/F,4DAA4D;;;AAE5D,iFAAiF;AACjF,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAEhB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AW,OAAA;AAAE,4GAAA,aAAa,OAAA;AAAE,2GAAA,YAAY,OAAA;AAE5E,+CAAwE;AAA/D,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,uGAAA,WAAW,OAAA;AAE3C,mFAAmF;AACnF,6CAAwF;AAA/E,qGAAA,MAAM,OAAc;AAAE,qGAAA,MAAM,OAAc;AAAE,kGAAA,OAAO,OAAA;AAG5D,iFAAiF;AACjF,4CAA+E;AAAtE,8GAAA,kBAAkB,OAAA;AAAE,oHAAA,wBAAwB,OAAA"}
|
|
@@ -28,29 +28,29 @@ export declare class SecureChatRepository {
|
|
|
28
28
|
/** List the conversation ids that have persisted group state. */
|
|
29
29
|
listGroupConversationIds(): Promise<string[]>;
|
|
30
30
|
/**
|
|
31
|
-
* Persist the decrypted
|
|
31
|
+
* Persist the decrypted content-frame bytes of a message (local-only, decrypt-once history).
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* Stores the `[kind][payload]` frame exactly as decrypted (raw bytes — NOT text): MLS application
|
|
34
|
+
* keys are single-use (forward secrecy), so a message decrypts exactly once; this stored copy is what
|
|
35
|
+
* the hook re-decodes + re-folds on every later reload. The blind server never receives this; it lives
|
|
36
36
|
* only in the platform store (web: IndexedDB; tests: MemoryStore).
|
|
37
37
|
*
|
|
38
38
|
* @param conversationId - The conversation the message belongs to.
|
|
39
39
|
* @param messageId - The globally-unique server message id.
|
|
40
|
-
* @param
|
|
40
|
+
* @param content - The decrypted content-frame bytes (`[kind][payload]`, post-unpadding).
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
saveMessageContent(conversationId: string, messageId: string, content: Uint8Array): Promise<void>;
|
|
43
43
|
/**
|
|
44
|
-
* Load a message's previously-decrypted
|
|
44
|
+
* Load a message's previously-decrypted content-frame bytes, or `null` if never stored.
|
|
45
45
|
*
|
|
46
|
-
* A non-null result lets the decrypt path short-circuit BEFORE touching the MLS ratchet —
|
|
47
|
-
*
|
|
46
|
+
* A non-null result lets the decrypt path short-circuit BEFORE touching the MLS ratchet — re-decrypting
|
|
47
|
+
* would throw `"Desired gen in the past"` (the key is gone after first use).
|
|
48
48
|
*
|
|
49
49
|
* @param conversationId - The conversation the message belongs to.
|
|
50
50
|
* @param messageId - The globally-unique server message id.
|
|
51
|
-
* @returns The stored
|
|
51
|
+
* @returns The stored content-frame bytes, or `null` on a miss.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
loadMessageContent(conversationId: string, messageId: string): Promise<Uint8Array | null>;
|
|
54
54
|
/** Load this device row's persisted handshake delivery cursor (`seq`), or `null`. */
|
|
55
55
|
loadHandshakeCursor(deviceRowId: string): Promise<string | null>;
|
|
56
56
|
/** Persist this device row's handshake delivery cursor (`seq`). */
|
|
@@ -15,11 +15,12 @@ const GROUP_PREFIX = "group:";
|
|
|
15
15
|
// and receives its own Welcome. A global key let a stale cursor outlive its device and mask the
|
|
16
16
|
// Welcome whose `seq` it had already passed (the handshakes query is strictly `seq > since`).
|
|
17
17
|
const CURSOR_PREFIX = "handshake:cursor:";
|
|
18
|
-
// Decrypted
|
|
19
|
-
// unique server uuid). This is the durable conversation history: MLS
|
|
20
|
-
// (forward secrecy), so a message can be decrypted exactly once —
|
|
21
|
-
// reload
|
|
22
|
-
//
|
|
18
|
+
// Decrypted content-frame bytes (`[kind][payload]`), keyed `msg:<conversationId>:<messageId>`
|
|
19
|
+
// (messageId is a globally-unique server uuid). This is the durable conversation history: MLS
|
|
20
|
+
// application keys are single-use (forward secrecy), so a message can be decrypted exactly once —
|
|
21
|
+
// we persist these bytes so reload re-decodes + re-folds from the store instead of replaying the
|
|
22
|
+
// (consumed) ratchet. Stored LOCAL ONLY; the blind server never sees it. See store.ts for the
|
|
23
|
+
// at-rest posture.
|
|
23
24
|
const MESSAGE_PREFIX = "msg:";
|
|
24
25
|
/** Typed persistence for device identity, per-conversation group state, and the handshake cursor. */
|
|
25
26
|
class SecureChatRepository {
|
|
@@ -65,33 +66,32 @@ class SecureChatRepository {
|
|
|
65
66
|
return keys.map((k) => k.slice(GROUP_PREFIX.length));
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
68
|
-
* Persist the decrypted
|
|
69
|
+
* Persist the decrypted content-frame bytes of a message (local-only, decrypt-once history).
|
|
69
70
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* Stores the `[kind][payload]` frame exactly as decrypted (raw bytes — NOT text): MLS application
|
|
72
|
+
* keys are single-use (forward secrecy), so a message decrypts exactly once; this stored copy is what
|
|
73
|
+
* the hook re-decodes + re-folds on every later reload. The blind server never receives this; it lives
|
|
73
74
|
* only in the platform store (web: IndexedDB; tests: MemoryStore).
|
|
74
75
|
*
|
|
75
76
|
* @param conversationId - The conversation the message belongs to.
|
|
76
77
|
* @param messageId - The globally-unique server message id.
|
|
77
|
-
* @param
|
|
78
|
+
* @param content - The decrypted content-frame bytes (`[kind][payload]`, post-unpadding).
|
|
78
79
|
*/
|
|
79
|
-
async
|
|
80
|
-
await this.store.set(MESSAGE_PREFIX + conversationId + ":" + messageId,
|
|
80
|
+
async saveMessageContent(conversationId, messageId, content) {
|
|
81
|
+
await this.store.set(MESSAGE_PREFIX + conversationId + ":" + messageId, content);
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
|
-
* Load a message's previously-decrypted
|
|
84
|
+
* Load a message's previously-decrypted content-frame bytes, or `null` if never stored.
|
|
84
85
|
*
|
|
85
|
-
* A non-null result lets the decrypt path short-circuit BEFORE touching the MLS ratchet —
|
|
86
|
-
*
|
|
86
|
+
* A non-null result lets the decrypt path short-circuit BEFORE touching the MLS ratchet — re-decrypting
|
|
87
|
+
* would throw `"Desired gen in the past"` (the key is gone after first use).
|
|
87
88
|
*
|
|
88
89
|
* @param conversationId - The conversation the message belongs to.
|
|
89
90
|
* @param messageId - The globally-unique server message id.
|
|
90
|
-
* @returns The stored
|
|
91
|
+
* @returns The stored content-frame bytes, or `null` on a miss.
|
|
91
92
|
*/
|
|
92
|
-
async
|
|
93
|
-
|
|
94
|
-
return bytes ? (0, base64_js_1.bytesToUtf8)(bytes) : null;
|
|
93
|
+
async loadMessageContent(conversationId, messageId) {
|
|
94
|
+
return this.store.get(MESSAGE_PREFIX + conversationId + ":" + messageId);
|
|
95
95
|
}
|
|
96
96
|
/** Load this device row's persisted handshake delivery cursor (`seq`), or `null`. */
|
|
97
97
|
async loadHandshakeCursor(deviceRowId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/persistence/repository.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,gFAAgF;;;AAIhF,iDAAmF;AAEnF,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,qGAAqG;AACrG,sGAAsG;AACtG,qGAAqG;AACrG,gGAAgG;AAChG,8FAA8F;AAC9F,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/persistence/repository.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,gFAAgF;;;AAIhF,iDAAmF;AAEnF,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,qGAAqG;AACrG,sGAAsG;AACtG,qGAAqG;AACrG,gGAAgG;AAChG,8FAA8F;AAC9F,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,8FAA8F;AAC9F,8FAA8F;AAC9F,kGAAkG;AAClG,iGAAiG;AACjG,8FAA8F;AAC9F,mBAAmB;AACnB,MAAM,cAAc,GAAG,MAAM,CAAC;AAkB9B,qGAAqG;AACrG,MAAa,oBAAoB;IAC/B,YAA6B,KAAsB;QA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GAAG,WAAW,EAAE,IAAA,uBAAW,EAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,uEAAuE;IACvE,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AA7FD,oDA6FC"}
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type MimiContent } from "./mimi-content.js";
|
|
2
|
+
/**
|
|
3
|
+
* A plain text post.
|
|
4
|
+
* @param body - The markdown message body.
|
|
5
|
+
* @returns A {@link MimiContent} with a SinglePart `text/markdown` Render body and a fresh salt.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildPost(body: string): MimiContent;
|
|
8
|
+
/**
|
|
9
|
+
* A reply to another message.
|
|
10
|
+
* @param body - The reply body.
|
|
11
|
+
* @param targetHash - The replied-to message's 32-byte content-hash (MessageId).
|
|
12
|
+
* @returns A text {@link MimiContent} with `inReplyTo` set to `targetHash`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildReply(body: string, targetHash: Uint8Array): MimiContent;
|
|
15
|
+
/**
|
|
16
|
+
* An edit of an existing message.
|
|
17
|
+
* @param targetHash - The edited message's 32-byte content-hash.
|
|
18
|
+
* @param body - The new body.
|
|
19
|
+
* @returns A text {@link MimiContent} with `replaces` set to `targetHash`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildEdit(targetHash: Uint8Array, body: string): MimiContent;
|
|
22
|
+
/**
|
|
23
|
+
* A delete (tombstone) of an existing message.
|
|
24
|
+
* @param targetHash - The deleted message's 32-byte content-hash.
|
|
25
|
+
* @returns A {@link MimiContent} with `replaces` set and a NullPart body.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildDelete(targetHash: Uint8Array): MimiContent;
|
|
28
|
+
/**
|
|
29
|
+
* A reaction to a message.
|
|
30
|
+
* @param targetHash - The reacted-to message's 32-byte content-hash.
|
|
31
|
+
* @param token - The reaction token (e.g. an emoji).
|
|
32
|
+
* @returns A {@link MimiContent} with `inReplyTo` set and a Reaction-disposition `text/plain` body.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildReaction(targetHash: Uint8Array, token: string): MimiContent;
|
|
35
|
+
/**
|
|
36
|
+
* An un-react: withdraws one of your own reactions.
|
|
37
|
+
* @param reactionHash - The 32-byte content-hash of YOUR reaction message being withdrawn.
|
|
38
|
+
* @returns A {@link MimiContent} with `replaces` set and a NullPart body.
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildUnreact(reactionHash: Uint8Array): MimiContent;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Tier-2 MimiContent builders — the six surfaced operations (post/reply/edit/delete/react/un-react).
|
|
2
|
+
//
|
|
3
|
+
// Each mints a fresh CSPRNG salt (crypto.getRandomValues — never Math.random; CLAUDE.md §1) so equal
|
|
4
|
+
// bodies still hash distinctly (unlinkability). The structural details of draft-08 MimiContent
|
|
5
|
+
// (bare-MessageId references, disposition/language on the NestedPart wrapper, NullPart tombstones) stay
|
|
6
|
+
// here so the hook deals only in builders. References (inReplyTo/replaces) are 32-byte content-hashes
|
|
7
|
+
// computed by the caller via contentHash(...).
|
|
8
|
+
import { Cardinality, Disposition, } from "./mimi-content.js";
|
|
9
|
+
const utf8 = (s) => new TextEncoder().encode(s);
|
|
10
|
+
/** 16 bytes of CSPRNG salt. WebCrypto `getRandomValues` is present on web, React Native, and Node ≥ 19. */
|
|
11
|
+
function freshSalt() {
|
|
12
|
+
return crypto.getRandomValues(new Uint8Array(16));
|
|
13
|
+
}
|
|
14
|
+
/** A SinglePart text body with the given disposition + MIME type. */
|
|
15
|
+
function singleText(body, disposition, contentType) {
|
|
16
|
+
return { cardinality: Cardinality.Single, disposition, language: "", contentType, content: utf8(body) };
|
|
17
|
+
}
|
|
18
|
+
/** A NullPart tombstone (delete / un-react). The wrapper still carries disposition + language. */
|
|
19
|
+
function nullPart() {
|
|
20
|
+
return { cardinality: Cardinality.Null, disposition: Disposition.Render, language: "" };
|
|
21
|
+
}
|
|
22
|
+
/** The fields shared by every built message (fresh salt; no topic/expiry/extensions). */
|
|
23
|
+
function base() {
|
|
24
|
+
return { salt: freshSalt(), topicId: new Uint8Array(), expires: null, extensions: new Map() };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A plain text post.
|
|
28
|
+
* @param body - The markdown message body.
|
|
29
|
+
* @returns A {@link MimiContent} with a SinglePart `text/markdown` Render body and a fresh salt.
|
|
30
|
+
*/
|
|
31
|
+
export function buildPost(body) {
|
|
32
|
+
return { ...base(), replaces: null, inReplyTo: null, nestedPart: singleText(body, Disposition.Render, "text/markdown") };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A reply to another message.
|
|
36
|
+
* @param body - The reply body.
|
|
37
|
+
* @param targetHash - The replied-to message's 32-byte content-hash (MessageId).
|
|
38
|
+
* @returns A text {@link MimiContent} with `inReplyTo` set to `targetHash`.
|
|
39
|
+
*/
|
|
40
|
+
export function buildReply(body, targetHash) {
|
|
41
|
+
return { ...base(), replaces: null, inReplyTo: targetHash, nestedPart: singleText(body, Disposition.Render, "text/markdown") };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* An edit of an existing message.
|
|
45
|
+
* @param targetHash - The edited message's 32-byte content-hash.
|
|
46
|
+
* @param body - The new body.
|
|
47
|
+
* @returns A text {@link MimiContent} with `replaces` set to `targetHash`.
|
|
48
|
+
*/
|
|
49
|
+
export function buildEdit(targetHash, body) {
|
|
50
|
+
return { ...base(), replaces: targetHash, inReplyTo: null, nestedPart: singleText(body, Disposition.Render, "text/markdown") };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A delete (tombstone) of an existing message.
|
|
54
|
+
* @param targetHash - The deleted message's 32-byte content-hash.
|
|
55
|
+
* @returns A {@link MimiContent} with `replaces` set and a NullPart body.
|
|
56
|
+
*/
|
|
57
|
+
export function buildDelete(targetHash) {
|
|
58
|
+
return { ...base(), replaces: targetHash, inReplyTo: null, nestedPart: nullPart() };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A reaction to a message.
|
|
62
|
+
* @param targetHash - The reacted-to message's 32-byte content-hash.
|
|
63
|
+
* @param token - The reaction token (e.g. an emoji).
|
|
64
|
+
* @returns A {@link MimiContent} with `inReplyTo` set and a Reaction-disposition `text/plain` body.
|
|
65
|
+
*/
|
|
66
|
+
export function buildReaction(targetHash, token) {
|
|
67
|
+
return { ...base(), replaces: null, inReplyTo: targetHash, nestedPart: singleText(token, Disposition.Reaction, "text/plain") };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* An un-react: withdraws one of your own reactions.
|
|
71
|
+
* @param reactionHash - The 32-byte content-hash of YOUR reaction message being withdrawn.
|
|
72
|
+
* @returns A {@link MimiContent} with `replaces` set and a NullPart body.
|
|
73
|
+
*/
|
|
74
|
+
export function buildUnreact(reactionHash) {
|
|
75
|
+
return { ...base(), replaces: reactionHash, inReplyTo: null, nestedPart: nullPart() };
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=builders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.js","sourceRoot":"","sources":["../../../src/content/builders.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,EAAE;AACF,qGAAqG;AACrG,+FAA+F;AAC/F,wGAAwG;AACxG,sGAAsG;AACtG,+CAA+C;AAE/C,OAAO,EACL,WAAW,EAAE,WAAW,GACzB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,WAAW,EA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AAC;AACjI,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,UAAsB,EAAE,IAAY;IAC5D,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC;AACjI,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,UAAsB;IAChD,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC;AACtF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAAsB,EAAE,KAAa;IACjE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC;AACjI,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,YAAwB;IACnD,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** A value in the supported CBOR subset. Integers in safe-int range are `number`; larger are `bigint`. */
|
|
2
|
+
export type CborValue = number | bigint | Uint8Array | string | CborValue[] | CborMap | CborTag | boolean | null;
|
|
3
|
+
/** A CBOR map (major type 5). Keys are encoded and sorted deterministically on encode. */
|
|
4
|
+
export type CborMap = Map<CborValue, CborValue>;
|
|
5
|
+
/** A CBOR tagged value (major type 6): a `tag` number wrapping one nested value. */
|
|
6
|
+
export declare class CborTag {
|
|
7
|
+
/** The CBOR tag number (major type 6 argument). */
|
|
8
|
+
readonly tag: number | bigint;
|
|
9
|
+
/** The single nested value wrapped by this tag. */
|
|
10
|
+
readonly value: CborValue;
|
|
11
|
+
constructor(
|
|
12
|
+
/** The CBOR tag number (major type 6 argument). */
|
|
13
|
+
tag: number | bigint,
|
|
14
|
+
/** The single nested value wrapped by this tag. */
|
|
15
|
+
value: CborValue);
|
|
16
|
+
}
|
|
17
|
+
/** Strict-decode bounds. Defaults: 1 MiB total, depth 32, 4096 items per array/map. */
|
|
18
|
+
export interface CborLimits {
|
|
19
|
+
/** Reject inputs longer than this many bytes (DoS guard). Default 1 << 20. */
|
|
20
|
+
maxBytes?: number;
|
|
21
|
+
/** Reject nesting deeper than this. Default 32. */
|
|
22
|
+
maxDepth?: number;
|
|
23
|
+
/** Reject any array/map with more than this many items. Default 4096. */
|
|
24
|
+
maxItems?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Encode a {@link CborValue} to canonical CBOR bytes (RFC 8949 §4.2 core deterministic rules).
|
|
28
|
+
*
|
|
29
|
+
* @param value - A value in the supported subset.
|
|
30
|
+
* @returns The canonical CBOR byte encoding.
|
|
31
|
+
* @throws {Error} On a non-integer number, an integer above u64, or an unsupported value type.
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* encode(new Map([[1, "a"]])); // → a2 01 61 61 … (keys sorted by encoded bytes)
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function encode(value: CborValue): Uint8Array;
|
|
38
|
+
/**
|
|
39
|
+
* Strict-decode canonical CBOR bytes from the supported subset. Rejects non-canonical encodings,
|
|
40
|
+
* out-of-subset major/simple values, trailing bytes, and anything exceeding {@link CborLimits}.
|
|
41
|
+
*
|
|
42
|
+
* @param bytes - The CBOR input (untrusted peer data — decoded fail-closed).
|
|
43
|
+
* @param limits - Optional {@link CborLimits} bounds.
|
|
44
|
+
* @returns The decoded {@link CborValue}.
|
|
45
|
+
* @throws {Error} On any non-canonical encoding, out-of-subset value, truncation, trailing bytes, or
|
|
46
|
+
* a bound (size/depth/item-count) being exceeded.
|
|
47
|
+
*/
|
|
48
|
+
export declare function decode(bytes: Uint8Array, limits?: CborLimits): CborValue;
|