Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.3 KB

ReadmeFirst.md

File metadata and controls

56 lines (39 loc) · 2.3 KB

Step-by-Step Guide: Working with the Privacy Storage Library

1. Integration

Installation

  1. Clone Repository: Clone the Privacy Storage Library repository to your local machine.
  2. Solidity Integration: Copy the PrivacyStorageLibrary.sol file into your Solidity project directory.

2. Usage

Initializing the Library

  1. Library Instance: Declare an instance of PrivacyStorageLibrary.PrivacyStorage in your Solidity contract.
    using PrivacyStorageLibrary for PrivacyStorageLibrary.PrivacyStorage;
    PrivacyStorageLibrary.PrivacyStorage private privacyStorage;

Storing Data

  1. Store Data: Use the storeDataWithSalt function to store data with a custom salt.
    bytes memory data = "Your data here";
    bytes32 salt = keccak256(abi.encodePacked("Your custom salt"));
    privacyStorage.storeDataWithSalt(data, salt);

Retrieving Data

  1. Retrieve Data: Retrieve data associated with your address and custom salt using retrieveDataWithSalt.
    bytes32 salt = keccak256(abi.encodePacked("Your custom salt"));
    bytes memory retrievedData = privacyStorage.retrieveDataWithSalt(msg.sender, salt);

Getting Data Hashes

  1. Retrieve Hashes: Get an array of data hashes associated with your address and custom salt.
    bytes32 salt = keccak256(abi.encodePacked("Your custom salt"));
    bytes32[] memory hashes = privacyStorage.getUserDataHashesWithSalt(msg.sender, salt);

3. Contribution

Contributing to the Library

  1. Fork Repository: Fork the Privacy Storage Library repository to your GitHub account.
  2. Make Changes: Make necessary changes or improvements to the library codebase.
  3. Commit and Push: Commit your changes to your forked repository and push them.
  4. Create Pull Request: Submit a pull request to the main repository, detailing the changes made and their purpose.

Conclusion

Working with the Privacy Storage Library involves integrating it into your Solidity projects, utilizing its functions to store and retrieve data with custom salts. Additionally, contributing to the library is encouraged by forking the repository, making improvements, and submitting pull requests to the main repository.