@types/node-rsa
- Version 1.1.4
- Published
- 10.1 kB
- 1 dependency
- MIT license
Install
npm i @types/node-rsa
yarn add @types/node-rsa
pnpm add @types/node-rsa
Overview
TypeScript definitions for node-rsa
Index
Classes
Interfaces
Type Aliases
Classes
class NodeRSA
class NodeRSA {}
constructor
constructor(key?: NodeRSA.KeyBits);
Generate new key with length specified.
constructor
constructor(key: any, format?: NodeRSA.Format, options?: NodeRSA.Options);
Load key from string/buffer/components.
method decrypt
decrypt: { (data: Buffer | string, encoding?: 'buffer'): Buffer; (data: any, encoding: NodeRSA.Encoding): string; <T extends object>(data: any, encoding: 'json'): T;};
method decryptPublic
decryptPublic: { (data: Buffer | string, encoding?: 'buffer'): Buffer; (data: any, encoding: NodeRSA.Encoding): string; <T extends object>(data: any, encoding: 'json'): T;};
method encrypt
encrypt: { (data: NodeRSA.Data, encoding?: 'buffer'): Buffer; (data: NodeRSA.Data, encoding: NodeRSA.Encoding): string; ( data: Buffer, encoding: 'buffer', sourceEncoding?: NodeRSA.Encoding ): Buffer; ( data: Buffer, encoding: NodeRSA.Encoding, sourceEncoding?: NodeRSA.Encoding ): string;};
method encryptPrivate
encryptPrivate: { (data: NodeRSA.Data, encoding?: 'buffer'): Buffer; (data: NodeRSA.Data, encoding: NodeRSA.Encoding): string; ( data: Buffer, encoding: 'buffer', sourceEncoding?: NodeRSA.Encoding ): Buffer; ( data: Buffer, encoding: NodeRSA.Encoding, sourceEncoding?: NodeRSA.Encoding ): string;};
method exportKey
exportKey: { (format?: NodeRSA.FormatPem): string; (format: NodeRSA.FormatDer): Buffer; (format: NodeRSA.FormatComponentsPrivate): NodeRSA.KeyComponentsPrivate; (format: NodeRSA.FormatComponentsPublic): NodeRSA.KeyComponentsPublic;};
Export key to PEM string, PEM/DER Buffer or components.
method generateKeyPair
generateKeyPair: (bits?: number, exponent?: number) => NodeRSA;
Parameter bits
Key size in bits. 2048 by default.
Parameter exponent
public exponent. 65537 by default.
method getKeySize
getKeySize: () => number;
Return key size in bits.
method getMaxMessageSize
getMaxMessageSize: () => number;
Return max data size for encrypt in bytes.
method importKey
importKey: (key: NodeRSA.Key, format?: NodeRSA.Format) => NodeRSA;
Import key from PEM string, PEM/DER Buffer or components.
method isEmpty
isEmpty: () => boolean;
Return true if key pair doesn't have any data.
method isPrivate
isPrivate: () => boolean;
method isPublic
isPublic: (strict?: boolean) => boolean;
Parameter strict
if true method will return false if key pair have private exponent. Default false.
method setOptions
setOptions: (options: NodeRSA.Options) => void;
Set and validate options for key instance.
method sign
sign: { (data: NodeRSA.Data, encoding?: 'buffer'): Buffer; (data: NodeRSA.Data, encoding: NodeRSA.Encoding): string; ( data: Buffer, encoding: 'buffer', sourceEncoding?: NodeRSA.Encoding ): Buffer; ( data: Buffer, encoding: NodeRSA.Encoding, sourceEncoding?: NodeRSA.Encoding ): string;};
method verify
verify: { (data: NodeRSA.Data, signature: Buffer): boolean; ( data: Buffer, signature: Buffer, sourceEncoding?: NodeRSA.Encoding ): boolean; ( data: Buffer, signature: string, sourceEncoding: NodeRSA.Encoding, signatureEncoding: NodeRSA.Encoding ): boolean; ( data: NodeRSA.Data, signature: string, sourceEncoding: undefined, signatureEncoding: NodeRSA.Encoding ): boolean;};
Interfaces
interface AdvancedEncryptionSchemePKCS1
interface AdvancedEncryptionSchemePKCS1 {}
interface AdvancedEncryptionSchemePKCS1OAEP
interface AdvancedEncryptionSchemePKCS1OAEP {}
interface AdvancedSigningSchemePKCS1
interface AdvancedSigningSchemePKCS1 {}
interface AdvancedSigningSchemePSS
interface AdvancedSigningSchemePSS {}
property hash
hash: HashingAlgorithm;
property saltLength
saltLength: number;
property scheme
scheme: 'pss';
interface KeyComponentsPrivate
interface KeyComponentsPrivate {}
interface KeyComponentsPublic
interface KeyComponentsPublic {}
interface Options
interface Options {}
property encryptionScheme
encryptionScheme?: EncryptionScheme | AdvancedEncryptionScheme | undefined;
Padding scheme for encrypt/decrypt. Default is 'pkcs1_oaep'.
property environment
environment?: 'browser' | 'node' | undefined;
Working environment. (auto detects by default)
property signingScheme
signingScheme?: | SigningScheme | SigningSchemeHash | AdvancedSigningScheme | undefined;
scheme used for signing and verifying.. Default 'pkcs1-sha256', or, if chosen pss: 'pss-sha1'.
Type Aliases
type AdvancedEncryptionScheme
type AdvancedEncryptionScheme = | AdvancedEncryptionSchemePKCS1 | AdvancedEncryptionSchemePKCS1OAEP;
type AdvancedSigningScheme
type AdvancedSigningScheme = AdvancedSigningSchemePSS | AdvancedSigningSchemePKCS1;
type Data
type Data = string | object | any[];
type Encoding
type Encoding = | 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'latin1' | 'base64' | 'hex' | 'binary' | 'buffer';
type EncryptionScheme
type EncryptionScheme = 'pkcs1_oaep' | 'pkcs1';
type Format
type Format = | FormatPem | FormatDer | FormatComponentsPrivate | FormatComponentsPublic;
type FormatComponentsPrivate
type FormatComponentsPrivate = | 'components' | 'components-pem' | 'components-der' | 'components-private' | 'components-private-pem' | 'components-private-der';
type FormatComponentsPublic
type FormatComponentsPublic = | 'components-public' | 'components-public-pem' | 'components-public-der';
type FormatDer
type FormatDer = | 'pkcs1-der' | 'pkcs1-private-der' | 'pkcs1-public-der' | 'pkcs8-der' | 'pkcs8-private-der' | 'pkcs8-public-der';
type FormatPem
type FormatPem = | 'private' | 'public' | 'pkcs1' | 'pkcs1-pem' | 'pkcs1-private' | 'pkcs1-private-pem' | 'pkcs1-public' | 'pkcs1-public-pem' | 'pkcs8' | 'pkcs8-pem' | 'pkcs8-private' | 'pkcs8-private-pem' | 'pkcs8-public' | 'pkcs8-public-pem' | 'openssh-public' | 'openssh-private';
type HashingAlgorithm
type HashingAlgorithm = | 'ripemd160' | 'md4' | 'md5' | 'sha1' | 'sha224' | 'sha256' | 'sha384' | 'sha512';
type Key
type Key = string | Buffer | KeyComponentsPrivate | KeyComponentsPublic;
type SigningScheme
type SigningScheme = 'pkcs1' | 'pss';
type SigningSchemeHash
type SigningSchemeHash = | 'pkcs1-ripemd160' | 'pkcs1-md4' | 'pkcs1-md5' | 'pkcs1-sha' | 'pkcs1-sha1' | 'pkcs1-sha224' | 'pkcs1-sha256' | 'pkcs1-sha384' | 'pkcs1-sha512' | 'pss-ripemd160' | 'pss-md4' | 'pss-md5' | 'pss-sha' | 'pss-sha1' | 'pss-sha224' | 'pss-sha256' | 'pss-sha384' | 'pss-sha512';
Package Files (1)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/node-rsa
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/node-rsa)
- HTML<a href="https://www.jsdocs.io/package/@types/node-rsa"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3519 ms. - Missing or incorrect documentation? Open an issue for this package.