bradleycha / cliauth

Minimal cross-platform terminal authenticator app.
GNU General Public License v3.0
0 stars 0 forks source link

Create IO interface to support random access #5

Closed bradleycha closed 2 weeks ago

bradleycha commented 2 months ago

Currently, it's impossible to read or write arbitrary bytes using IO streams. Once a byte is read or written, the stream cannot be re-winded, and it's not possible to skip an arbitrary number of bytes. This will be a requirement for future encryption to function. A new interface should be added alongside the existing stream interface to support random access for both reading and writing.

bradleycha commented 2 months ago

This IO subsystem could be called "mappers". For example, "CliAuthIoFileMapper", "CliAuthIoAes256Mapper", etc. Bytes could be read like "cliauth_io_mapper_read(const CliAuthIoMapper context, CliAuthUInt8 output [], CliAuthUInt32 bytes, CliAuthUInt32 offset)", and written like "cliauth_io_mapper_write(const CliAuthIoMapper context, const CliAuthUInt8 data [], CliAuthUInt32 bytes, CliAuthUInt32 offset)".

bradleycha commented 2 weeks ago

Resolved with 2f8c0af