Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions modules/serialize/src/decode_encryption_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ export function decodeEncryptionContextFactory(
* Exported for testing. Used by deserializeMessageHeader to compose a complete solution.
* @param encodedEncryptionContext Uint8Array
*/
function decodeEncryptionContext(encodedEncryptionContext: Uint8Array) {
function decodeEncryptionContext(
encodedEncryptionContext: Uint8Array
): Readonly<EncryptionContext> {
const encryptionContext: EncryptionContext = Object.create(null)
/* Check for early return (Postcondition): The case of 0 length is defined as an empty object. */
if (!encodedEncryptionContext.byteLength) {
return encryptionContext
return Object.freeze(encryptionContext)
}
/* Uint8Array is a view on top of the underlying ArrayBuffer.
* This means that raw underlying memory stored in the ArrayBuffer
Expand Down