Socket
Socket
Sign inDemoInstall

@types/pem

Package Overview
Dependencies
2
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/pem

TypeScript definitions for pem


Version published
Weekly downloads
108K
decreased by-7.17%
Maintainers
1
Install size
3.83 MB
Created
Weekly downloads
 

Package description

What is @types/pem?

@types/pem provides TypeScript type definitions for the 'pem' npm package, which is used for creating and managing PEM (Privacy Enhanced Mail) files, commonly used for SSL/TLS certificates and keys.

What are @types/pem's main functionalities?

Create a Certificate

This feature allows you to create a self-signed certificate. The code sample demonstrates how to create a certificate that is valid for one day.

const pem = require('pem');
pem.createCertificate({ days: 1, selfSigned: true }, function (err, keys) {
  if (err) {
    throw err;
  }
  console.log(keys);
});

Read a Certificate

This feature allows you to read and extract information from a PEM-formatted certificate. The code sample shows how to read a certificate from a file and log its information.

const pem = require('pem');
pem.readCertificateInfo('path/to/certificate.pem', function (err, info) {
  if (err) {
    throw err;
  }
  console.log(info);
});

Create a Private Key

This feature allows you to create a private key. The code sample demonstrates how to generate a private key and log it.

const pem = require('pem');
pem.createPrivateKey(function (err, key) {
  if (err) {
    throw err;
  }
  console.log(key);
});

Create a CSR (Certificate Signing Request)

This feature allows you to create a Certificate Signing Request (CSR). The code sample shows how to generate a CSR for a given common name.

const pem = require('pem');
pem.createCSR({ commonName: 'example.com' }, function (err, csr) {
  if (err) {
    throw err;
  }
  console.log(csr);
});

Other packages similar to @types/pem

Readme

Source

Installation

npm install --save @types/pem

Summary

This package contains type definitions for pem (https://github.com/Dexus/pem).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pem.

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Aurelia Fenderson-Peters, Anthony Trinh, and Ruslan Arkhipau.

FAQs

Last updated on 07 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc