1.2.4 • Published 2 months ago

@happy-gastro/csr-generator v1.2.4

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

CSR and Key Generator

This package provides a simple and straightforward way to generate Certificate Signing Requests (CSRs) and keys using HTTP SSL service so you don't need OpenSSL installed. It utilizes the csrgenerator.com service to facilitate the generation process.

Installation

npm install @happy-gastro/csr-key-generator

Usage

To use this package, import the generateCSRAndKey function and call it with optional parameters:

import { generateCSRAndKey } from '@happy-gastro/csr-key-generator';

// Example usage:
generateCSRAndKey('HU', 'happygastro.hu', '', 'Software development', 'Happy Gastro Kft.', 'Pest megye', 'Hungary', '')
    .then((result) => {
        console.log('Generated CSR:', result.certificateRequest);
        console.log('Generated Key:', result.privateKey);
    })
    .catch((error) => {
        console.error('Error generating CSR and key:', error);
    });

API Documentation

generateCSRAndKey(C: string, CN: string, subject: string, OU: string, O: string, L: string, ST: string, SC: string): Promise<object>

\ Here are the fields you can fill with your own parameters:

\ C: The Country field of CSR.\ CN: The Common name field of CSR.\ subject: (Optional) Subject Alt names.\ OU: Organizational Unit field of CSR.\ O: Organization field of CSR.\ L: Locality field of CSR.\ ST: State field of CSR.\ SC: SC field of CSR.

Returns a Promise that resolves with an object containing the generated CSR (certificateRequest), key (privateKey), and the full string response (string) from the generation service.

Example

import { generateCSRAndKey } from '@happy-gastro/csr-key-generator';

// Example usage:
generateCSRAndKey('HU', 'happygastro.hu', '', 'Software development', 'Happy Gastro Kft.', 'Pest megye', 'Hungary', '')
    .then((result) => {
        console.log('Generated CSR:', result.certificateRequest);
        console.log('Generated Key:', result.privateKey);
    })
    .catch((error) => {
        console.error('Error generating CSR and key:', error);
    });

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Author

This project is developed and maintained by Farkas Ferenc.

Company

Happy Gastro Ltd.

License

MIT

1.2.4

2 months ago

1.2.2

2 months ago

1.2.1

2 months ago

1.1.0

2 months ago

1.0.6

2 months ago