build: publish

pull/243/head
xiaojunnuo 2024-11-14 00:20:17 +08:00
parent 48bc7a45a9
commit 111a0823e9
12 changed files with 199 additions and 174 deletions

View File

@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.3](https://github.com/certd/certd/compare/v1.27.2...v1.27.3) (2024-11-13)
### Bug Fixes
* 修复偶发性cname一直验证超时的bug ([d2ce72e](https://github.com/certd/certd/commit/d2ce72e4aaacdf726ba8b91fcd71db40a27714ba))
* 修复邮件配置忽略证书校验设置不生效的bug ([66a9690](https://github.com/certd/certd/commit/66a9690dc958732e1b3c672d965db502296446f9))
* 修复ipv6未开启情况下请求带有ipv6地址域名报ETIMEDOUT的bug ([a9a0967](https://github.com/certd/certd/commit/a9a0967a6f1d0bd27e69f3ec52c31d90d470bc23))
### Performance Improvements
* 修复站点个性化浏览器标题没有生效的bug ([bcfac02](https://github.com/certd/certd/commit/bcfac02c96ceaf23d1a0b05b48d8047da933beaf))
* 优化上传到主机插 路径选择,根据证书格式显示 ([8c3f86c](https://github.com/certd/certd/commit/8c3f86c6909ed91f48bb2880e78834e22f6f6a29))
* 支持jks ([889eaae](https://github.com/certd/certd/commit/889eaaea92818f628b922dae540c026630611707))
* ipv6支持 ([da6ac16](https://github.com/certd/certd/commit/da6ac1626b3574be2fabeeb18a1f10d60bdcbe49))
## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08) ## [1.27.2](https://github.com/certd/certd/compare/v1.27.1...v1.27.2) (2024-11-08)
### Bug Fixes ### Bug Fixes

View File

@ -6,6 +6,38 @@
</dd> </dd>
</dl> </dl>
## Constants
<dl>
<dt><a href="#createPrivateEcdsaKey">createPrivateEcdsaKey</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private ECDSA key</p>
</dd>
<dt><a href="#getPublicKey">getPublicKey</a><code>buffer</code></dt>
<dd><p>Get a public key derived from a RSA or ECDSA key</p>
</dd>
<dt><a href="#getPemBodyAsB64u">getPemBodyAsB64u</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains</a><code>object</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo</a><code>object</code></dt>
<dd><p>Read information from a certificate
If multiple certificates are chained, the first will be read</p>
</dd>
<dt><a href="#createCsr">createCsr</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
<dt><a href="#createAlpnCertificate">createAlpnCertificate</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a self-signed ALPN certificate for TLS-ALPN-01 challenges</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc8737">https://datatracker.ietf.org/doc/html/rfc8737</a></p>
</dd>
<dt><a href="#isAlpnCertificateAuthorizationValid">isAlpnCertificateAuthorizationValid</a><code>boolean</code></dt>
<dd><p>Validate that a ALPN certificate contains the expected key authorization</p>
</dd>
</dl>
## Functions ## Functions
<dl> <dl>
@ -15,12 +47,6 @@
<dt><a href="#createPrivateKey">createPrivateKey()</a></dt> <dt><a href="#createPrivateKey">createPrivateKey()</a></dt>
<dd><p>Alias of <code>createPrivateRsaKey()</code></p> <dd><p>Alias of <code>createPrivateRsaKey()</code></p>
</dd> </dd>
<dt><a href="#createPrivateEcdsaKey">createPrivateEcdsaKey([namedCurve])</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private ECDSA key</p>
</dd>
<dt><a href="#getPublicKey">getPublicKey(keyPem)</a><code>buffer</code></dt>
<dd><p>Get a public key derived from a RSA or ECDSA key</p>
</dd>
<dt><a href="#getJwk">getJwk(keyPem)</a><code>object</code></dt> <dt><a href="#getJwk">getJwk(keyPem)</a><code>object</code></dt>
<dd><p>Get a JSON Web Key derived from a RSA or ECDSA key</p> <dd><p>Get a JSON Web Key derived from a RSA or ECDSA key</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc7517">https://datatracker.ietf.org/doc/html/rfc7517</a></p> <p><a href="https://datatracker.ietf.org/doc/html/rfc7517">https://datatracker.ietf.org/doc/html/rfc7517</a></p>
@ -28,27 +54,6 @@
<dt><a href="#splitPemChain">splitPemChain(chainPem)</a><code>Array.&lt;string&gt;</code></dt> <dt><a href="#splitPemChain">splitPemChain(chainPem)</a><code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from string into array</p> <dd><p>Split chain of PEM encoded objects from string into array</p>
</dd> </dd>
<dt><a href="#getPemBodyAsB64u">getPemBodyAsB64u(pem)</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains(csrPem)</a><code>object</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo(certPem)</a><code>object</code></dt>
<dd><p>Read information from a certificate
If multiple certificates are chained, the first will be read</p>
</dd>
<dt><a href="#createCsr">createCsr(data, [keyPem])</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
<dt><a href="#createAlpnCertificate">createAlpnCertificate(authz, keyAuthorization, [keyPem])</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a self-signed ALPN certificate for TLS-ALPN-01 challenges</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc8737">https://datatracker.ietf.org/doc/html/rfc8737</a></p>
</dd>
<dt><a href="#isAlpnCertificateAuthorizationValid">isAlpnCertificateAuthorizationValid(certPem, keyAuthorization)</a><code>boolean</code></dt>
<dd><p>Validate that a ALPN certificate contains the expected key authorization</p>
</dd>
</dl> </dl>
<a name="crypto"></a> <a name="crypto"></a>
@ -57,40 +62,12 @@ If multiple certificates are chained, the first will be read</p>
Native Node.js crypto interface Native Node.js crypto interface
**Kind**: global namespace **Kind**: global namespace
<a name="createPrivateRsaKey"></a>
## createPrivateRsaKey([modulusLength]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [modulusLength] | <code>number</code> | <code>2048</code> | Size of the keys modulus in bits, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.crypto.createPrivateRsaKey();
```
**Example**
Private RSA key with modulus size 4096
```js
const privateKey = await acme.crypto.createPrivateRsaKey(4096);
```
<a name="createPrivateKey"></a>
## createPrivateKey()
Alias of `createPrivateRsaKey()`
**Kind**: global function
<a name="createPrivateEcdsaKey"></a> <a name="createPrivateEcdsaKey"></a>
## createPrivateEcdsaKey([namedCurve])<code>Promise.&lt;buffer&gt;</code> ## createPrivateEcdsaKey ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private ECDSA key Generate a private ECDSA key
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private ECDSA key **Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private ECDSA key
| Param | Type | Description | | Param | Type | Description |
@ -109,10 +86,10 @@ const privateKey = await acme.crypto.createPrivateEcdsaKey('P-384');
``` ```
<a name="getPublicKey"></a> <a name="getPublicKey"></a>
## getPublicKey(keyPem)<code>buffer</code> ## getPublicKey ⇒ <code>buffer</code>
Get a public key derived from a RSA or ECDSA key Get a public key derived from a RSA or ECDSA key
**Kind**: global function **Kind**: global constant
**Returns**: <code>buffer</code> - PEM encoded public key **Returns**: <code>buffer</code> - PEM encoded public key
| Param | Type | Description | | Param | Type | Description |
@ -124,44 +101,13 @@ Get public key
```js ```js
const publicKey = acme.crypto.getPublicKey(privateKey); const publicKey = acme.crypto.getPublicKey(privateKey);
``` ```
<a name="getJwk"></a>
## getJwk(keyPem) ⇒ <code>object</code>
Get a JSON Web Key derived from a RSA or ECDSA key
https://datatracker.ietf.org/doc/html/rfc7517
**Kind**: global function
**Returns**: <code>object</code> - JSON Web Key
| Param | Type | Description |
| --- | --- | --- |
| keyPem | <code>buffer</code> \| <code>string</code> | PEM encoded private or public key |
**Example**
Get JWK
```js
const jwk = acme.crypto.getJwk(privateKey);
```
<a name="splitPemChain"></a>
## splitPemChain(chainPem) ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from string into array
**Kind**: global function
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM objects including headers
| Param | Type | Description |
| --- | --- | --- |
| chainPem | <code>buffer</code> \| <code>string</code> | PEM encoded object chain |
<a name="getPemBodyAsB64u"></a> <a name="getPemBodyAsB64u"></a>
## getPemBodyAsB64u(pem)<code>string</code> ## getPemBodyAsB64u ⇒ <code>string</code>
Parse body of PEM encoded object and return a Base64URL string Parse body of PEM encoded object and return a Base64URL string
If multiple objects are chained, the first body will be returned If multiple objects are chained, the first body will be returned
**Kind**: global function **Kind**: global constant
**Returns**: <code>string</code> - Base64URL-encoded body **Returns**: <code>string</code> - Base64URL-encoded body
| Param | Type | Description | | Param | Type | Description |
@ -170,10 +116,10 @@ If multiple objects are chained, the first body will be returned
<a name="readCsrDomains"></a> <a name="readCsrDomains"></a>
## readCsrDomains(csrPem)<code>object</code> ## readCsrDomains ⇒ <code>object</code>
Read domains from a Certificate Signing Request Read domains from a Certificate Signing Request
**Kind**: global function **Kind**: global constant
**Returns**: <code>object</code> - {commonName, altNames} **Returns**: <code>object</code> - {commonName, altNames}
| Param | Type | Description | | Param | Type | Description |
@ -190,11 +136,11 @@ console.log(`Alt names: ${altNames.join(', ')}`);
``` ```
<a name="readCertificateInfo"></a> <a name="readCertificateInfo"></a>
## readCertificateInfo(certPem)<code>object</code> ## readCertificateInfo ⇒ <code>object</code>
Read information from a certificate Read information from a certificate
If multiple certificates are chained, the first will be read If multiple certificates are chained, the first will be read
**Kind**: global function **Kind**: global constant
**Returns**: <code>object</code> - Certificate info **Returns**: <code>object</code> - Certificate info
| Param | Type | Description | | Param | Type | Description |
@ -215,10 +161,10 @@ console.log(`Alt names: ${altNames.join(', ')}`);
``` ```
<a name="createCsr"></a> <a name="createCsr"></a>
## createCsr(data, [keyPem])<code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> ## createCsr ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a Certificate Signing Request Create a Certificate Signing Request
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest] **Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest]
| Param | Type | Description | | Param | Type | Description |
@ -276,12 +222,12 @@ const [, certificateRequest] = await acme.crypto.createCsr({
``` ```
<a name="createAlpnCertificate"></a> <a name="createAlpnCertificate"></a>
## createAlpnCertificate(authz, keyAuthorization, [keyPem])<code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> ## createAlpnCertificate ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a self-signed ALPN certificate for TLS-ALPN-01 challenges Create a self-signed ALPN certificate for TLS-ALPN-01 challenges
https://datatracker.ietf.org/doc/html/rfc8737 https://datatracker.ietf.org/doc/html/rfc8737
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificate] **Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificate]
| Param | Type | Description | | Param | Type | Description |
@ -303,10 +249,10 @@ const [, alpnCertificate] = await acme.crypto.createAlpnCertificate(authz, keyAu
``` ```
<a name="isAlpnCertificateAuthorizationValid"></a> <a name="isAlpnCertificateAuthorizationValid"></a>
## isAlpnCertificateAuthorizationValid(certPem, keyAuthorization)<code>boolean</code> ## isAlpnCertificateAuthorizationValid ⇒ <code>boolean</code>
Validate that a ALPN certificate contains the expected key authorization Validate that a ALPN certificate contains the expected key authorization
**Kind**: global function **Kind**: global constant
**Returns**: <code>boolean</code> - True when valid **Returns**: <code>boolean</code> - True when valid
| Param | Type | Description | | Param | Type | Description |
@ -314,3 +260,62 @@ Validate that a ALPN certificate contains the expected key authorization
| certPem | <code>buffer</code> \| <code>string</code> | PEM encoded certificate | | certPem | <code>buffer</code> \| <code>string</code> | PEM encoded certificate |
| keyAuthorization | <code>string</code> | Expected challenge key authorization | | keyAuthorization | <code>string</code> | Expected challenge key authorization |
<a name="createPrivateRsaKey"></a>
## createPrivateRsaKey([modulusLength]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Description |
| --- | --- | --- |
| [modulusLength] | <code>number</code> | Size of the keys modulus in bits, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.crypto.createPrivateRsaKey();
```
**Example**
Private RSA key with modulus size 4096
```js
const privateKey = await acme.crypto.createPrivateRsaKey(4096);
```
<a name="createPrivateKey"></a>
## createPrivateKey()
Alias of `createPrivateRsaKey()`
**Kind**: global function
<a name="getJwk"></a>
## getJwk(keyPem) ⇒ <code>object</code>
Get a JSON Web Key derived from a RSA or ECDSA key
https://datatracker.ietf.org/doc/html/rfc7517
**Kind**: global function
**Returns**: <code>object</code> - JSON Web Key
| Param | Type | Description |
| --- | --- | --- |
| keyPem | <code>buffer</code> \| <code>string</code> | PEM encoded private or public key |
**Example**
Get JWK
```js
const jwk = acme.crypto.getJwk(privateKey);
```
<a name="splitPemChain"></a>
## splitPemChain(chainPem) ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from string into array
**Kind**: global function
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM objects including headers
| Param | Type | Description |
| --- | --- | --- |
| chainPem | <code>buffer</code> \| <code>string</code> | PEM encoded object chain |

View File

@ -8,37 +8,42 @@ major release. Please migrate to the new <code>acme.crypto</code> interface at y
</dd> </dd>
</dl> </dl>
## Constants
<dl>
<dt><a href="#createPublicKey">createPublicKey</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Create public key from a private RSA key</p>
</dd>
<dt><a href="#getPemBody">getPemBody</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#splitPemChain">splitPemChain</a><code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from buffer or string into array</p>
</dd>
<dt><a href="#getModulus">getModulus</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get modulus</p>
</dd>
<dt><a href="#getPublicExponent">getPublicExponent</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get public exponent</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read information from a certificate</p>
</dd>
<dt><a href="#createCsr">createCsr</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
</dl>
## Functions ## Functions
<dl> <dl>
<dt><a href="#createPrivateKey">createPrivateKey([size])</a><code>Promise.&lt;buffer&gt;</code></dt> <dt><a href="#createPrivateKey">createPrivateKey([size])</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Generate a private RSA key</p> <dd><p>Generate a private RSA key</p>
</dd> </dd>
<dt><a href="#createPublicKey">createPublicKey(key)</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Create public key from a private RSA key</p>
</dd>
<dt><a href="#getPemBody">getPemBody(str)</a><code>string</code></dt>
<dd><p>Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned</p>
</dd>
<dt><a href="#splitPemChain">splitPemChain(str)</a><code>Array.&lt;string&gt;</code></dt>
<dd><p>Split chain of PEM encoded objects from buffer or string into array</p>
</dd>
<dt><a href="#getModulus">getModulus(input)</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get modulus</p>
</dd>
<dt><a href="#getPublicExponent">getPublicExponent(input)</a><code>Promise.&lt;buffer&gt;</code></dt>
<dd><p>Get public exponent</p>
</dd>
<dt><a href="#readCsrDomains">readCsrDomains(csr)</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read domains from a Certificate Signing Request</p>
</dd>
<dt><a href="#readCertificateInfo">readCertificateInfo(cert)</a><code>Promise.&lt;object&gt;</code></dt>
<dd><p>Read information from a certificate</p>
</dd>
<dt><a href="#createCsr">createCsr(data, [key])</a><code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code></dt>
<dd><p>Create a Certificate Signing Request</p>
</dd>
</dl> </dl>
<a name="forge"></a> <a name="forge"></a>
@ -50,34 +55,12 @@ DEPRECATION WARNING: This crypto interface is deprecated and will be removed fro
major release. Please migrate to the new `acme.crypto` interface at your earliest convenience. major release. Please migrate to the new `acme.crypto` interface at your earliest convenience.
**Kind**: global namespace **Kind**: global namespace
<a name="createPrivateKey"></a>
## createPrivateKey([size]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [size] | <code>number</code> | <code>2048</code> | Size of the key, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.forge.createPrivateKey();
```
**Example**
Private RSA key with defined size
```js
const privateKey = await acme.forge.createPrivateKey(4096);
```
<a name="createPublicKey"></a> <a name="createPublicKey"></a>
## createPublicKey(key)<code>Promise.&lt;buffer&gt;</code> ## createPublicKey ⇒ <code>Promise.&lt;buffer&gt;</code>
Create public key from a private RSA key Create public key from a private RSA key
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded public RSA key **Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded public RSA key
| Param | Type | Description | | Param | Type | Description |
@ -91,11 +74,11 @@ const publicKey = await acme.forge.createPublicKey(privateKey);
``` ```
<a name="getPemBody"></a> <a name="getPemBody"></a>
## getPemBody(str)<code>string</code> ## getPemBody ⇒ <code>string</code>
Parse body of PEM encoded object from buffer or string Parse body of PEM encoded object from buffer or string
If multiple objects are chained, the first body will be returned If multiple objects are chained, the first body will be returned
**Kind**: global function **Kind**: global constant
**Returns**: <code>string</code> - PEM body **Returns**: <code>string</code> - PEM body
| Param | Type | Description | | Param | Type | Description |
@ -104,10 +87,10 @@ If multiple objects are chained, the first body will be returned
<a name="splitPemChain"></a> <a name="splitPemChain"></a>
## splitPemChain(str)<code>Array.&lt;string&gt;</code> ## splitPemChain ⇒ <code>Array.&lt;string&gt;</code>
Split chain of PEM encoded objects from buffer or string into array Split chain of PEM encoded objects from buffer or string into array
**Kind**: global function **Kind**: global constant
**Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM bodies **Returns**: <code>Array.&lt;string&gt;</code> - Array of PEM bodies
| Param | Type | Description | | Param | Type | Description |
@ -116,10 +99,10 @@ Split chain of PEM encoded objects from buffer or string into array
<a name="getModulus"></a> <a name="getModulus"></a>
## getModulus(input)<code>Promise.&lt;buffer&gt;</code> ## getModulus ⇒ <code>Promise.&lt;buffer&gt;</code>
Get modulus Get modulus
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - Modulus **Returns**: <code>Promise.&lt;buffer&gt;</code> - Modulus
| Param | Type | Description | | Param | Type | Description |
@ -135,10 +118,10 @@ const m3 = await acme.forge.getModulus(certificateRequest);
``` ```
<a name="getPublicExponent"></a> <a name="getPublicExponent"></a>
## getPublicExponent(input)<code>Promise.&lt;buffer&gt;</code> ## getPublicExponent ⇒ <code>Promise.&lt;buffer&gt;</code>
Get public exponent Get public exponent
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;buffer&gt;</code> - Exponent **Returns**: <code>Promise.&lt;buffer&gt;</code> - Exponent
| Param | Type | Description | | Param | Type | Description |
@ -154,10 +137,10 @@ const e3 = await acme.forge.getPublicExponent(certificateRequest);
``` ```
<a name="readCsrDomains"></a> <a name="readCsrDomains"></a>
## readCsrDomains(csr)<code>Promise.&lt;object&gt;</code> ## readCsrDomains ⇒ <code>Promise.&lt;object&gt;</code>
Read domains from a Certificate Signing Request Read domains from a Certificate Signing Request
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;object&gt;</code> - {commonName, altNames} **Returns**: <code>Promise.&lt;object&gt;</code> - {commonName, altNames}
| Param | Type | Description | | Param | Type | Description |
@ -174,10 +157,10 @@ console.log(`Alt names: ${altNames.join(', ')}`);
``` ```
<a name="readCertificateInfo"></a> <a name="readCertificateInfo"></a>
## readCertificateInfo(cert)<code>Promise.&lt;object&gt;</code> ## readCertificateInfo ⇒ <code>Promise.&lt;object&gt;</code>
Read information from a certificate Read information from a certificate
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;object&gt;</code> - Certificate info **Returns**: <code>Promise.&lt;object&gt;</code> - Certificate info
| Param | Type | Description | | Param | Type | Description |
@ -198,10 +181,10 @@ console.log(`Alt names: ${altNames.join(', ')}`);
``` ```
<a name="createCsr"></a> <a name="createCsr"></a>
## createCsr(data, [key])<code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> ## createCsr ⇒ <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code>
Create a Certificate Signing Request Create a Certificate Signing Request
**Kind**: global function **Kind**: global constant
**Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest] **Returns**: <code>Promise.&lt;Array.&lt;buffer&gt;&gt;</code> - [privateKey, certificateSigningRequest]
| Param | Type | Description | | Param | Type | Description |
@ -256,3 +239,25 @@ const certificateKey = await acme.forge.createPrivateKey();
const [, certificateRequest] = await acme.forge.createCsr({ const [, certificateRequest] = await acme.forge.createCsr({
altNames: ['test.example.com'], altNames: ['test.example.com'],
}, certificateKey); }, certificateKey);
<a name="createPrivateKey"></a>
## createPrivateKey([size]) ⇒ <code>Promise.&lt;buffer&gt;</code>
Generate a private RSA key
**Kind**: global function
**Returns**: <code>Promise.&lt;buffer&gt;</code> - PEM encoded private RSA key
| Param | Type | Description |
| --- | --- | --- |
| [size] | <code>number</code> | Size of the key, default: `2048` |
**Example**
Generate private RSA key
```js
const privateKey = await acme.forge.createPrivateKey();
```
**Example**
Private RSA key with defined size
```js
const privateKey = await acme.forge.createPrivateKey(4096);
```

View File

@ -65,5 +65,5 @@
"bugs": { "bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues" "url": "https://github.com/publishlab/node-acme-client/issues"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -43,5 +43,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -43,5 +43,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -21,5 +21,5 @@
"prettier": "^2.8.8", "prettier": "^2.8.8",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -30,5 +30,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -31,5 +31,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -61,5 +61,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -46,5 +46,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }

View File

@ -40,5 +40,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "3a0178b2949083c770ed96a4122e4c0a5e0bcc11" "gitHead": "1eb70d4cfd1ed2f746369658db2559fe01718324"
} }