1.0.4 • Published 10 months ago

cryptographs v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

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:

  1. Node.js: v20.18.0 or higher
  2. TypeScript: v5.6.3
  3. ts-node: v10.9.2 (for running TypeScript files directly)
  4. npm: v7.0.0 or higher

Build Instructions

To build the package locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/Zimi-Cloud/zimi-npm-pkg.git
    cd zimi-npm-pkg
  2. Install dependencies:

    npm install
  3. Build the package:

    npm run build
  4. Link the package locally for testing:

    npm link
  5. 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.

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.1.1

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago