encryption/MegolmService Service
File: src/services/encryption/MegolmService.ts
Overview
Exports
- MegolmOutboundSession - interface export
- MegolmInboundSession - interface export
- MegolmEncryptedMessage - interface export
- MegolmService - class export
- megolmService - const export
Classes
MegolmService
No description available.
Methods:
constructorgetInstanceinitializemigrateOutboundToInboundopenDatabaseloadSessionsFromDBcatchgetOrCreateOutboundSessioncreateOutboundSessionshouldRotateSessionincrementMessageIndeximportInboundSessiongetInboundSessionhasInboundSessionfindInboundSessionBySessionIdgetInboundSessionsForRoomencryptMessagedecryptMessagederiveRatchetKeygetSessionKeyForSharingmarkSessionSharedWithgetUsersNeedingSessionexportAllSessionsimportAllSessionssaveOutboundSessionsaveInboundSessionputInStoreclearAllStoresarrayBufferToBase64base64ToArrayBufferisInitializedclose
Properties:
instancedbuserIdencryptionKeyinitializedsessionsoutboundSessionsinboundSessionsINITIALIZATIONMegolmServiceMigrationcopiestruedecryptmigratedCountkeyinboundsessionIdroomIdsenderUserIdsessionKeyfirstKnownIndexcreatedAtrequestoutboundStoreinboundStorekeyPathdecryptedsessionMANAGEMENTroomIMPORTANToursessionKeyBytesIDsessionIdBytesnowmessageIndexrotateAtsharedWithmemoryIndexedDBCRITICALrotatedencryptingdecryptionsenderundefinedDECRYPTIONplaintextindexratchetKeymessageencoderplaintextBytesivencryptedDatanameciphertextcombinedresultitoldencryptedMessageinboundSessionFallbackoutboundSessionlookups0roomSessionscombinedArrayDecryptdecryptedDatadecodermaterialkeyMaterialinfohashsaltSHARINGusernullwithallUserIdsBACKUPbackupstoringoutboundexistingoneMIGRATIONfixinboundKeyHELPERSencryptedsessionCopyfieldtransactionstorevalueMETHODSbytesbinaryifalse
Interfaces
MegolmOutboundSession
No description available.
typescript
interface MegolmOutboundSession {
sessionId: string
roomId: string // Can be channel_id or conversation_id
sessionKey: string // Base64 encoded session key
messageIndex: number // Current message index (ratchets forward)
createdAt: number
rotateAt: number // When to create a new session
sharedWith: string[] // User IDs we've shared this session with
}MegolmInboundSession
No description available.
typescript
interface MegolmInboundSession {
sessionId: string
roomId: string
senderUserId: string
sessionKey: string // Base64 encoded
firstKnownIndex: number // First message index we can decrypt from
createdAt: number
}MegolmEncryptedMessage
No description available.
typescript
interface MegolmEncryptedMessage {
sessionId: string
messageIndex: number
ciphertext: string // Base64 encoded
}Constants
SESSION_ROTATION_MESSAGE_COUNT
No description available.
typescript
const SESSION_ROTATION_MESSAGE_COUNT = 100 // Rotate after 100 messagesSESSION_ROTATION_TIME_MS
No description available.
typescript
const SESSION_ROTATION_TIME_MS = 7 * 24 * 60 * 60 * 1000 // Rotate after 7 daysMEGOLM_DB_NAME
No description available.
typescript
const MEGOLM_DB_NAME = 'harmony_megolm_sessions'MEGOLM_DB_VERSION
No description available.
typescript
const MEGOLM_DB_VERSION = 1STORES
No description available.
typescript
const STORES = {Source Code Insights
File Size: 28413 characters Lines of Code: 833 Imports: 1
Usage Example
typescript
import { MegolmOutboundSession, MegolmInboundSession, MegolmEncryptedMessage, MegolmService, megolmService } from '@/services/encryption/MegolmService'
// Example usage
// Use the exported functionalityThis documentation was automatically generated from the source code.
