ante-library
v1.0.0
Published
A Node.js / TypeScript library for storing JSON data blobs on Solana blockchain and remote file storage services.
Downloads
3
Maintainers
Readme
Ante Library
A Node.js / TypeScript library for storing JSON data blobs on Solana blockchain and remote file storage services.
Description
This library provides functions to:
- Store a hash of a JSON data blob on the Solana blockchain and the raw JSON data blob in a remote file storage facility such as Amazon S3, Google Cloud Storage, or Azure Blob Storage.
- Verify if the hash of a file in remote storage equals the hash that is stored on the Solana blockchain.
- Retrieve the contents of a file from remote storage.
Installation
npm install --save ante-library
Usage
import { AnteLibrary } from 'ante-library';
const anteLibrary = new AnteLibrary();
// Store JSON data
const jsonData = { key: 'value' };
const storageType = 's3'; // or 'google' or 'azure'
const { transactionId, filePath } = await anteLibrary.storeJsonData(jsonData, storageType);
// Verify hash
const isHashValid = await anteLibrary.verifyHash(transactionId, filePath);
// Retrieve file
const fileContents = await anteLibrary.retrieveFile(filePath, storageType);
Environment Variables
The library requires the following environment variables:
AWS_BUCKET_NAME
for Amazon S3GCLOUD_STORAGE_BUCKET
for Google Cloud StorageAZURE_STORAGE_CONNECTION_STRING
,AZURE_STORAGE_ACCOUNT_NAME
,AZURE_STORAGE_CONTAINER_NAME
for Azure Blob Storage
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.