Methods
(async) addCachedCertificate(context, filepath, isOverwrite) → {Promise.<boolean>}
Adds a cached certificate for the current session.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
context |
object | The session context. | |
filepath |
string | The certificate. | |
isOverwrite |
boolean | true | Whether or not to overwrite a certificate with the same name. |
- Source:
Returns:
Whether or not the certificate was written successfully.
- Type
- Promise.<boolean>
(async) addCertificateAuthority(context, filepath, isOverwrite) → {Promise.<boolean>}
Adds a trusted CA for the current user.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
context |
object | The session context. | |
filepath |
string | The CA certificate. | |
isOverwrite |
boolean | true | Whether or not to overwrite an existing CA with the same name. |
- Source:
Returns:
Whether or not the CA was written successfully.
- Type
- Promise.<boolean>
(async) authorizeCertificateToken(certData, signingKey) → {Promise.<object>}
Generates an authoriation signature for minting an NFTLS token.
Parameters:
Name | Type | Description |
---|---|---|
certData |
* | The certificate to mint. |
signingKey |
* | The key to approve the request. |
- Source:
Returns:
- Type
- Promise.<object>
(async) createSessionContext(platformOptions, storage) → {Promise.<object>}
Creates a session context for performing lookups against a blockchain.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
platformOptions |
* | The platform(s) to use. | |
storage |
* | null | Storage and caching options. |
- Source:
Returns:
A session context.
- Type
- Promise.<object>
(async) getCachedCertificate(context) → {Promise.<object>}
Retrieves a cached certificate if available.
Parameters:
Name | Type | Description |
---|---|---|
context |
object | The session context. |
- Source:
Returns:
- Type
- Promise.<object>
(async) getCertificateAuthorities(context) → {Promise.<Array>}
Retrieves a list of all trusted CAs.
Parameters:
Name | Type | Description |
---|---|---|
context |
object | The session context. |
- Source:
Returns:
- Type
- Promise.<Array>
(async) getCertificateHash(filepath) → {Promise.<string>}
Calculates a hash for a certificate.
Parameters:
Name | Type | Description |
---|---|---|
filepath |
string | The certificate file. |
- Source:
Returns:
- Type
- Promise.<string>
(async) inspectCertificate(filepath) → {Promise.<object>}
Inspects the provided certificate.
Parameters:
Name | Type | Description |
---|---|---|
filepath |
string | The certificate data or file to read. |
- Source:
Returns:
Data about the certificate.
- Type
- Promise.<object>
(async) installCertificate(cert, image, output) → {Promise.<string>}
Installs an issued certificate into the target image.
Parameters:
Name | Type | Description |
---|---|---|
cert |
object | The certificate to install. |
image |
string | The image to install the certificate into. |
output |
string | (optional) The output file. |
- Source:
Returns:
The name of the installed certificate.
- Type
- Promise.<string>
(async) issueCertificate(request, info, key) → {Promise.<object>}
Issues a certificate based on the provided certificate request.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
object | The certificate request. | ||||||||||||
info |
object | Data about the issuer.
Properties
|
||||||||||||
key |
string | The private key to sign the certificate with. |
- Source:
Returns:
The issued certificate.
- Type
- Promise.<object>
(async) removeCachedCertificate(context, name) → {Promise.<boolean>}
Removes a certificate by name.
Parameters:
Name | Type | Description |
---|---|---|
context |
object | The session context. |
name |
string | The name of the certificate to remove. |
- Source:
Returns:
Whether or not the certificate was removed successfully.
- Type
- Promise.<boolean>
(async) removeCertificateAuthority(context, name) → {Promise.<boolean>}
Removes a trusted CA by name.
Parameters:
Name | Type | Description |
---|---|---|
context |
object | The session context. |
name |
string | The name of the CA to remove. |
- Source:
Returns:
Whether or not the CA was removed successfully.
- Type
- Promise.<boolean>
(async) renderCertificateToken(type, input, key, output) → {Promise.<number>}
Renders a new certificate token image for deployment as an NFT.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The certificate type ('address', 'domain', etc.) |
input |
object | The configuration of the image. |
key |
string | The private key to sign the image with. |
output |
string | The output file. |
- Source:
Returns:
Returns the randomly generated code associated with the token.
- Type
- Promise.<number>
(async) requestCertificate(req, keys) → {Promise.<object>}
Generates a certificate signing request (CSR).
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
req |
object | The request object.
Properties
|
|||||||||||||||
keys |
object | The keys to use for the request.
Properties
|
- Source:
Returns:
The constructed CSR.
- Type
- Promise.<object>
(async) resolveCertificateChain(context, certData) → {Promise.<object>}
Resolves certificate chain information for a given certificate.
Note: requires an Internet connection.
Parameters:
Name | Type | Description |
---|---|---|
context |
object | The session context. |
certData |
* | The certificate to inspect chain data from. |
- Source:
Returns:
Any located certificates, as well as whether the chain status.
- Type
- Promise.<object>
(async) validateCertificate(filepath, addr) → {Promise.<object>}
Checks the given certificate to ensure signatures and hashes are correct.
Parameters:
Name | Type | Description |
---|---|---|
filepath |
string | The certificate file to validate. |
addr |
string | (optional) The parent address to validate with. |
- Source:
Returns:
Returns an 'error' object if invalid.
- Type
- Promise.<object>
(async) validateCertificateChain(context, certData) → {Promise.<string>}
Verifies whether a certificate and its chain of certificates is valid.
Parameters:
Name | Type | Description |
---|---|---|
context |
object | The session context. |
certData |
* | The certificate to validate chain data from. |
- Source:
Returns:
Returns "Verified" if verified, otherwise returns an error message.
- Type
- Promise.<string>