Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[async] fs, File and io API #97

Open
radumarias opened this issue Aug 4, 2024 · 1 comment · May be fixed by #264
Open

[async] fs, File and io API #97

radumarias opened this issue Aug 4, 2024 · 1 comment · May be fixed by #264
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@radumarias
Copy link
Member

radumarias commented Aug 4, 2024

Have a similar API like tokio::fs::File, tokio::fs and tokio::fs::OpenOptions that can work with EncryptedFs. We should have CryptoFile with a similar API like File that wraps corresponding crypto structs.

Structure of crypto module

Flow

  • Use crypto::fs_api::fs::OpenOptionsto create a crypto::fs_apifs::File
  • Internally, the File will split the path by OS's path separator and call EncryptedFs::find_by_name until it gets the no for the file.
  • Then will call EncryptedFs::[open_read, open_write] with the ino, which will return a CryptoReadSeek or CryptoWriteSeek and the fh (file handle), which will be used on read, write and seek methods of Read and Write traits
  • When the File object is dropped, we close the handle with EncryptedFs::release
  • Read or write to file with crypto::fs_api::io

Flow is like this

lib-users > crypto::fs_api::[fs, fs::OpenOptions, fs::File, io] > EncryptedFs -> crypto::storage_api::[fs, fs::OpenOptions, fs::File, io]

This issue corresponds to lib-users > crypto::fs_api::[fs, fs::OpenOptions, fs::File, io] > EncryptedFs.

The advantage is that a lib user could use encrypted files just like regular files by "just" changing the use statements, such as using files like json or yaml. A good use case is that users could build a password manager or encrypted sticky notes.

#246

@radumarias radumarias added this to rencfs Aug 4, 2024
@radumarias radumarias converted this from a draft issue Aug 4, 2024
@radumarias radumarias added the enhancement New feature or request label Aug 4, 2024
@radumarias radumarias changed the title File and fs API File and fs API Aug 4, 2024
@radumarias radumarias changed the title File and fs API fs, File and io API Aug 29, 2024
@radumarias radumarias moved this from Todo to In Progress in rencfs Aug 29, 2024
@radumarias radumarias added this to the 1.0.0-rc.1 milestone Aug 29, 2024
@someotherself someotherself self-assigned this Aug 29, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Merged in rencfs Sep 2, 2024
@radumarias radumarias reopened this Sep 2, 2024
@someotherself someotherself removed their assignment Sep 8, 2024
radumarias added a commit that referenced this issue Sep 22, 2024
radumarias added a commit that referenced this issue Sep 23, 2024
- create fs layer with OpenOptions and File impl
- impl AsyncRead, AsyncWrite, AsyncSeek for File
@radumarias
Copy link
Member Author

@someotherself how's it going with this?

@radumarias radumarias changed the title fs, File and io API async fs, File and io API Dec 4, 2024
@radumarias radumarias changed the title async fs, File and io API [async] fs, File and io API Dec 4, 2024
@radumarias radumarias moved this from Merged to In Progress in rencfs Dec 4, 2024
@someotherself someotherself linked a pull request Dec 15, 2024 that will close this issue
17 tasks
@radumarias radumarias linked a pull request Dec 15, 2024 that will close this issue
17 tasks
radumarias added a commit that referenced this issue Dec 24, 2024
…async. Make sure we zeroize String from path

[async] fs, File and io API #97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants