@@ -351,7 +351,7 @@ export class LevelLocalRepo implements LocalRepo {
351351 protected async readMeta ( keyBase : string ) : Promise < BlockMeta > {
352352 const metaKey = keyBase + Defaults . Metadata ;
353353 const blob = await this . kv . get ( metaKey ) ;
354- const meta = this . codec . decoder . decode ( blob ) as BlockMeta ;
354+ const meta = await this . decode ( blob , false ) as BlockMeta ;
355355 return meta ;
356356 }
357357
@@ -396,7 +396,7 @@ export class LevelLocalRepo implements LocalRepo {
396396 public async readFrontierTip ( keyBase : string ) : Promise < Patch | undefined > {
397397 const frontierBase = this . frontierKeyBase ( keyBase ) ;
398398 const lte = frontierBase + `~` ;
399- for await ( const blob of this . kv . values ( { lte, limit : 1 , reverse : true } ) ) return Patch . fromBinary ( blob ) ;
399+ for await ( const blob of this . kv . values ( { lte, limit : 1 , reverse : true } ) ) return Patch . fromBinary ( await this . decrypt ( blob , false ) ) ;
400400 return ;
401401 }
402402
@@ -637,7 +637,7 @@ export class LevelLocalRepo implements LocalRepo {
637637 const op : BinStrLevelOperation = {
638638 type : 'put' ,
639639 key : patchKey ,
640- value : patch . toBinary ( ) ,
640+ value : await this . encrypt ( patch . toBinary ( ) , false ) ,
641641 } ;
642642 ops . push ( op ) ;
643643 }
@@ -770,7 +770,7 @@ export class LevelLocalRepo implements LocalRepo {
770770 const id = rebased . getId ( ) ! ;
771771 const time = id . time ;
772772 const patchKey = this . frontierKey ( keyBase , time ) ;
773- const uint8 = rebased . toBinary ( ) ;
773+ const uint8 = await this . encrypt ( rebased . toBinary ( ) , false ) ;
774774 writtenPatches . push ( uint8 ) ;
775775 const op : BinStrLevelOperation = { type : 'put' , key : patchKey , value : uint8 } ;
776776 ops . push ( op ) ;
0 commit comments