Changed display format of methods.
parent
1d44a7558b
commit
34fcd56998
97
API.md
97
API.md
|
@ -93,26 +93,26 @@ ltv | number | optional | The method of how to enable [LTV](#note) :three:
|
||||||
debug | boolean | optional | To output debug informations or not
|
debug | boolean | optional | To output debug informations or not
|
||||||
|
|
||||||
:one: `permission` is a setting of [DocMDP](#note). Valid values are:
|
:one: `permission` is a setting of [DocMDP](#note). Valid values are:
|
||||||
* 1: No changes to the document are permitted; any change to the document invalidates the signature.
|
* `1`: No changes to the document are permitted; any change to the document invalidates the signature.
|
||||||
* 2: Permitted changes are filling in forms, instantiating page templates, and signing; other changes invalidate the signature.
|
* `2`: Permitted changes are filling in forms, instantiating page templates, and signing; other changes invalidate the signature.
|
||||||
* 3: Permitted changes are the same as for 2, as well as annotation creation, deletion, and modification; other changes invalidate the signature.
|
* `3`: Permitted changes are the same as for 2, as well as annotation creation, deletion, and modification; other changes invalidate the signature.
|
||||||
|
|
||||||
:two: `signdate`
|
:two: `signdate`
|
||||||
* When it is a Date, it means the date and time of signing.
|
* When it is a Date, it means the date and time of signing.
|
||||||
* When it is a string, it can be an url of [TSA](#note) or an index of the preset [TSA](#note)s as below:
|
* When it is a string, it can be an url of [TSA](#note) or an index of the preset [TSA](#note)s as below:
|
||||||
* "1": http://ts.ssl.com
|
* `"1"`: http://ts.ssl.com
|
||||||
* "2": http://timestamp.digicert.com
|
* `"2"`: http://timestamp.digicert.com
|
||||||
* "3": http://timestamp.sectigo.com
|
* `"3"`: http://timestamp.sectigo.com
|
||||||
* "4": http://timestamp.entrust.net/TSS/RFC3161sha2TS
|
* `"4"`: http://timestamp.entrust.net/TSS/RFC3161sha2TS
|
||||||
* "5": http://timestamp.apple.com/ts01
|
* `"5"`: http://timestamp.apple.com/ts01
|
||||||
* "6": http://www.langedge.jp/tsa
|
* `"6"`: http://www.langedge.jp/tsa
|
||||||
* "7": https://freetsa.org/tsr
|
* `"7"`: https://freetsa.org/tsr
|
||||||
* When it is a [TsaServiceInfo](#TsaServiceInfo), it means a full customized information of a [TSA](#note).
|
* When it is a [TsaServiceInfo](#TsaServiceInfo), it means a full customized information of a [TSA](#note).
|
||||||
* When it is omitted, the system timestamp will be used.
|
* When it is omitted, the system timestamp will be used.
|
||||||
|
|
||||||
:three: `ltv`'s valid values are:
|
:three: `ltv`'s valid values are:
|
||||||
* 1: auto; Try using [OCSP](#note) only to enable the [LTV](#note) first; If can't, try using [CRL](#note) to enable the [LTV](#note).
|
* `1`: auto; Try using [OCSP](#note) only to enable the [LTV](#note) first; If can't, try using [CRL](#note) to enable the [LTV](#note).
|
||||||
* 2: crl only; Only try using [CRL](#note) to enable the [LTV](#note).
|
* `2`: crl only; Only try using [CRL](#note) to enable the [LTV](#note).
|
||||||
|
|
||||||
|
|
||||||
## TsaServiceInfo
|
## TsaServiceInfo
|
||||||
|
@ -127,19 +127,17 @@ headers | Object\<string, *\> | optional | The customized headers for sending to
|
||||||
# Function Definitions
|
# Function Definitions
|
||||||
|
|
||||||
## u8arrToRaw
|
## u8arrToRaw
|
||||||
:fondue::fondue::fondue:
|
:fondue::fondue::fondue:
|
||||||
#### u8arrToRaw(uarr) :arrow_right: string
|
u8arrToRaw(uarr) :arrow_right: string
|
||||||
Converts an Uint8Array to a raw string.
|
Converts an Uint8Array to a raw string.
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
uarr | Uint8Array | required | The target Uint8Array
|
uarr | Uint8Array | required | The target Uint8Array
|
||||||
|
|
||||||
## rawToU8arr
|
## rawToU8arr
|
||||||
:fondue::fondue::fondue:
|
:fondue::fondue::fondue:
|
||||||
#### rawToU8arr(raw) :arrow_right: Uint8Array
|
rawToU8arr(raw) :arrow_right: Uint8Array
|
||||||
Converts a raw string to an Uint8Array.
|
Converts a raw string to an Uint8Array.
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
raw | string | required | The target string
|
raw | string | required | The target string
|
||||||
|
@ -149,32 +147,34 @@ raw | string | required | The target string
|
||||||
## CertsChain
|
## CertsChain
|
||||||
:croissant::croissant::croissant:
|
:croissant::croissant::croissant:
|
||||||
### Constructor
|
### Constructor
|
||||||
#### new CertsChain(certs<sub>*opt*</sub>)
|
new CertsChain(certs<sub>*opt*</sub>)
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
certs | Array\<forge_cert\><br />:fork_and_knife:Array\<forge.asn1\><br />:fork_and_knife:Array\<string\> | optional | An array of certificates.
|
certs | Array\<forge_cert\><br />:fork_and_knife:Array\<forge.asn1\><br />:fork_and_knife:Array\<string\> | optional | An array of certificates.
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
#### buildChain(cert) :arrow_right: Promise\<boolean\>
|
#### buildChain
|
||||||
|
buildChain(cert) :arrow_right: Promise\<boolean\>
|
||||||
Build the certificates chain from the specified certificate, and returns true if this operation is successful.
|
Build the certificates chain from the specified certificate, and returns true if this operation is successful.
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
cert | forge_cert | required | A certificate to start build by looking for it's issuer.
|
cert | forge_cert | required | A certificate to start build by looking for it's issuer.
|
||||||
|
|
||||||
#### getAllCerts() :arrow_right: Array\<forge_cert\>
|
#### getAllCerts
|
||||||
|
getAllCerts() :arrow_right: Array\<forge_cert\>
|
||||||
Returns an array of all certificates.
|
Returns an array of all certificates.
|
||||||
|
|
||||||
#### getSignCert() :arrow_right: forge_cert
|
#### getSignCert
|
||||||
|
getSignCert() :arrow_right: forge_cert
|
||||||
Returns the certificate for signing.
|
Returns the certificate for signing.
|
||||||
|
|
||||||
#### isSelfSignedCert() :arrow_right: boolean
|
#### isSelfSignedCert
|
||||||
|
isSelfSignedCert() :arrow_right: boolean
|
||||||
Returns true if the certificate for signing is a self-signed certificate.
|
Returns true if the certificate for signing is a self-signed certificate.
|
||||||
|
|
||||||
#### prepareDSSInf(crlOnly<sub>*opt*</sub>) :arrow_right: Promise\<[DSSInfo](#dssinfo)\>
|
#### prepareDSSInf
|
||||||
|
prepareDSSInf(crlOnly<sub>*opt*</sub>) :arrow_right: Promise\<[DSSInfo](#dssinfo)\>
|
||||||
Returns the informations of [DSS](#note).
|
Returns the informations of [DSS](#note).
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
crlOnly | boolean | optional | Query [CRL](#note) only or try query [OCSP](#note) first.
|
crlOnly | boolean | optional | Query [CRL](#note) only or try query [OCSP](#note) first.
|
||||||
|
@ -182,24 +182,23 @@ crlOnly | boolean | optional | Query [CRL](#note) only or try query [OCSP](#note
|
||||||
## PdfCryptor
|
## PdfCryptor
|
||||||
:croissant::croissant::croissant:
|
:croissant::croissant::croissant:
|
||||||
### Constructor
|
### Constructor
|
||||||
#### new PdfCryptor(encopt)
|
new PdfCryptor(encopt)
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
encopt | [EncryptOption](#EncryptOption) | required | Infomations of encryption.
|
encopt | [EncryptOption](#EncryptOption) | required | Infomations of encryption.
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
#### encryptObject(num, val)
|
#### encryptObject
|
||||||
|
encryptObject(num, val)
|
||||||
Encrypts the content of the specified pdf object.
|
Encrypts the content of the specified pdf object.
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
num | number | required | The object number.
|
num | number | required | The object number.
|
||||||
val | PDFLib.PDFObject | required | The target object.
|
val | PDFLib.PDFObject | required | The target object.
|
||||||
|
|
||||||
#### encryptPdf(pdf, ref<sub>*opt*</sub>) :arrow_right: Promise\<PDFLib.PDFDocument\>
|
#### encryptPdf
|
||||||
|
encryptPdf(pdf, ref<sub>*opt*</sub>) :arrow_right: Promise\<PDFLib.PDFDocument\>
|
||||||
Encrypts the contents in the pdf and returns the pdf document.
|
Encrypts the contents in the pdf and returns the pdf document.
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
pdf | PDFLib.PDFDocument<br />:fork_and_knife:Array\<number\><br />:fork_and_knife:Uint8Array<br />:fork_and_knife:ArrayBuffer<br />:fork_and_knife:string | required | The target pdf.
|
pdf | PDFLib.PDFDocument<br />:fork_and_knife:Array\<number\><br />:fork_and_knife:Uint8Array<br />:fork_and_knife:ArrayBuffer<br />:fork_and_knife:string | required | The target pdf.
|
||||||
|
@ -208,16 +207,15 @@ ref | PDFLib.PDFRef | optional | The unique reference will be assigned to the en
|
||||||
## PdfSigner
|
## PdfSigner
|
||||||
:croissant::croissant::croissant:
|
:croissant::croissant::croissant:
|
||||||
### Constructor
|
### Constructor
|
||||||
#### new PdfSigner(signopt)
|
new PdfSigner(signopt)
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
signopt | [SignOption](#SignOption) | required | Infomations of signing.
|
signopt | [SignOption](#SignOption) | required | Infomations of signing.
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
#### sign(pdf, cypopt<sub>*opt*</sub>) :arrow_right: Promise\<Uint8Array\>
|
#### sign
|
||||||
|
sign(pdf, cypopt<sub>*opt*</sub>) :arrow_right: Promise\<Uint8Array\>
|
||||||
Sign the pdf and returns the binary data.
|
Sign the pdf and returns the binary data.
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
pdf | PDFLib.PDFDocument|Array\<number\>|Uint8Array|ArrayBuffer|string | required | The target pdf.
|
pdf | PDFLib.PDFDocument|Array\<number\>|Uint8Array|ArrayBuffer|string | required | The target pdf.
|
||||||
|
@ -226,39 +224,40 @@ cypopt | [EncryptOption](#EncryptOption) | optional | The informations of encryp
|
||||||
## TsaFetcher
|
## TsaFetcher
|
||||||
:croissant::croissant::croissant:
|
:croissant::croissant::croissant:
|
||||||
### Constructor
|
### Constructor
|
||||||
#### new TsaFetcher(inf)
|
new TsaFetcher(inf)
|
||||||
|
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
inf | [TsaServiceInfo](#TsaServiceInfo) | required | Infomations of [TSA](#note).
|
inf | [TsaServiceInfo](#TsaServiceInfo) | required | Infomations of [TSA](#note).
|
||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
Name | Type | Description
|
Name | Type | Description
|
||||||
--- | --- | ---
|
--- | --- | ---
|
||||||
url | string | The url of [TSA](#note).
|
url | string | The url of [TSA](#note).
|
||||||
len | number | The length of signature which is generated by the [TSA](#note).
|
len | number | The length of signature which is generated by the [TSA](#note).
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
#### getCertsChain() :arrow_right: [CertsChain](#CertsChain)
|
#### getCertsChain
|
||||||
|
getCertsChain() :arrow_right: [CertsChain](#CertsChain)
|
||||||
Get the certificates' chain from the response of [TSA](#note).
|
Get the certificates' chain from the response of [TSA](#note).
|
||||||
|
|
||||||
#### getToken(forP7<sub>*opt*</sub>) :arrow_right: forge.asn1
|
#### getToken
|
||||||
|
getToken(forP7<sub>*opt*</sub>) :arrow_right: forge.asn1
|
||||||
Get the token data in response from [TSA](#note).
|
Get the token data in response from [TSA](#note).
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
forP7 | boolean | optional | To create an asn1 for appending to a pkcs#7 signature or not.
|
forP7 | boolean | optional | To create an asn1 for appending to a pkcs#7 signature or not.
|
||||||
|
|
||||||
#### queryTsa(data) :arrow_right: Promise\<string\>
|
#### queryTsa
|
||||||
|
queryTsa(data) :arrow_right: Promise\<string\>
|
||||||
Query [TSA](#note) to sign the data and returns error message if error occured.
|
Query [TSA](#note) to sign the data and returns error message if error occured.
|
||||||
Name | Type | Attributes | Description
|
Name | Type | Attributes | Description
|
||||||
--- | --- | --- | ---
|
--- | --- | --- | ---
|
||||||
data | string | required | The data needs to be signed.
|
data | string | required | The data needs to be signed.
|
||||||
|
|
||||||
## Note
|
## Note
|
||||||
1. __CRL__:loudspeaker: Certificate Revocation List
|
* __CRL__:loudspeaker: Certificate Revocation List
|
||||||
2. __DDS__:loudspeaker: Document Security Store
|
* __DDS__:loudspeaker: Document Security Store
|
||||||
3. __DocMDP__:loudspeaker: Document Modification Detection and Prevention
|
* __DocMDP__:loudspeaker: Document Modification Detection and Prevention
|
||||||
4. __LTV__:loudspeaker: Long-Term Validation
|
* __LTV__:loudspeaker: Long-Term Validation
|
||||||
5. __OCSP__:loudspeaker: Online Certificate Status Protocol
|
* __OCSP__:loudspeaker: Online Certificate Status Protocol
|
||||||
6. __TSA__:loudspeaker: Time Stamp Authority
|
* __TSA__:loudspeaker: Time Stamp Authority
|
||||||
|
|
Loading…
Reference in New Issue