1.0.4 • Published 8 months ago
cryptographs v1.0.4
Cryptographs
Cryptographs is a utility package for encoding and decoding crypto graph data. It simplifies data conversion tasks for applications requiring efficient crypto-related transformations.
Installation
Prerequisites
- Node.js: v20.18.0 or higher
- npm: v7.0.0 or higher
- TypeScript: v5.0.0 or higher (if you're using TypeScript)
Steps
npm install cryptographs
Usage
Importing the Package
For JavaScript (CommonJS)
const { encode, decodeR0, decodeR5 } = require('cryptographs');
For TypeScript (ES Modules)
import { encode, decodeR0, decodeR5 } from 'cryptographs';
Examples
Encoding Data
import { encode } from 'cryptographs';
const deviceData = {
id: 1234,
reg: "someRegister",
};
encode(deviceData)
.then((result) => {
console.log('Encoded Data:', result);
})
.catch((err) => {
console.error('Error Encoding:', err);
});
Decoding Data
import { decodeR0, decodeR5 } from 'cryptographs';
const encodedData = {
id: 1234,
reg: "someRegister",
data: "encodedValue",
};
// Decode using R0
const decodedR0 = decodeR0(encodedData);
console.log('Decoded R0:', decodedR0);
// Decode using R5
const decodedR5 = decodeR5(encodedData);
console.log('Decoded R5:', decodedR5);
Development Environment
Make sure you have the following tools installed to work with the source code:
- Node.js: v20.18.0 or higher
- TypeScript: v5.6.3
- ts-node: v10.9.2 (for running TypeScript files directly)
- npm: v7.0.0 or higher
Build Instructions
To build the package locally, follow these steps:
Clone the repository:
git clone https://github.com/Zimi-Cloud/zimi-npm-pkg.git cd zimi-npm-pkg
Install dependencies:
npm install
Build the package:
npm run build
Link the package locally for testing:
npm link
Test the package in another project:
npm link cryptographs
Contributing
Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.
License
This package is licensed under the ISC License.