mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 19:25:23 +00:00
Added and fixed some methods comments
This commit is contained in:
79
index.js
79
index.js
@@ -24,10 +24,11 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Compiles the pass
|
* Generates the pass Stream
|
||||||
|
*
|
||||||
@method generate
|
* @async
|
||||||
@return {Promise} - A JSON structure containing the error or the stream of the generated pass.
|
* @method generate
|
||||||
|
* @return {Promise<Stream>} A Promise containing the stream of the generated pass.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
generate() {
|
generate() {
|
||||||
@@ -157,11 +158,11 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks if pass model type is one of the supported ones
|
* Checks if pass model type is one of the supported ones
|
||||||
|
*
|
||||||
@method _validateType
|
* @method _validateType
|
||||||
@params {Buffer} passBuffer - buffer of the pass structure content
|
* @params {Buffer} passBuffer - buffer of the pass structure content
|
||||||
@returns {Boolean} - true if type is supported, false otherwise.
|
* @returns {Boolean} true if type is supported, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_validateType(passBuffer) {
|
_validateType(passBuffer) {
|
||||||
@@ -185,11 +186,11 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generates the PKCS #7 cryptografic signature for the manifest file.
|
* Generates the PKCS #7 cryptografic signature for the manifest file.
|
||||||
|
*
|
||||||
@method _sign
|
* @method _sign
|
||||||
@params {String|Object} manifest - Manifest content.
|
* @params {String|Object} manifest - Manifest content.
|
||||||
@returns {Object} Promise
|
* @returns {Buffer}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_sign(manifest) {
|
_sign(manifest) {
|
||||||
@@ -246,12 +247,12 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Edits the buffer of pass.json based on the passed options.
|
* Edits the buffer of pass.json based on the passed options.
|
||||||
|
*
|
||||||
@method _patch
|
* @method _patch
|
||||||
@params {Object} options - options resulting from the filtering made by filterPassOptions function
|
* @params {Object} options - options resulting from the filtering made by filterPassOptions function
|
||||||
@params {Buffer} passBuffer - Buffer of the contents of pass.json
|
* @params {Buffer} passBuffer - Buffer of the contents of pass.json
|
||||||
@returns {Promise} - Edited pass.json buffer or Object containing error.
|
* @returns {Promise<Buffer>} Edited pass.json buffer or Object containing error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_patch(options, passBuffer) {
|
_patch(options, passBuffer) {
|
||||||
@@ -311,13 +312,13 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Filters the options received in the query from http request into supported options
|
* Filters the options received in the query from http request into supported options
|
||||||
by Apple and this application.
|
* by Apple and this application.
|
||||||
|
*
|
||||||
@method _filterOptions
|
* @method _filterOptions
|
||||||
@params {Object} query - raw informations to be edited in the pass.json file
|
* @params {Object} opts - raw informations to be edited in the pass.json file
|
||||||
from HTTP Request Params or Body
|
* from HTTP Request Params or Body
|
||||||
@returns {Object} - filtered options based on above criterias.
|
* @returns {Object} - filtered options based on above criterias.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_filterOptions(query) {
|
_filterOptions(query) {
|
||||||
@@ -335,7 +336,12 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Validates the contents of the passed options and assigns the contents to the right properties
|
* Validates the contents of the passed options and assigns the contents to the right properties
|
||||||
|
*
|
||||||
|
* @async
|
||||||
|
* @method _parseSettings
|
||||||
|
* @params {Object} options - the options passed to be parsed
|
||||||
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_parseSettings(options) {
|
_parseSettings(options) {
|
||||||
@@ -373,6 +379,15 @@ class Pass {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the PEM-formatted passed text (certificates)
|
||||||
|
*
|
||||||
|
* @method __parsePEM
|
||||||
|
* @params {String} element - Text content of .pem files
|
||||||
|
* @params {String} passphrase - passphrase for the key
|
||||||
|
* @returns {Object} - Object containing name of the certificate and its parsed content
|
||||||
|
*/
|
||||||
|
|
||||||
__parsePEM(element, passphrase) {
|
__parsePEM(element, passphrase) {
|
||||||
if (element.includes("PRIVATE KEY") && !!passphrase) {
|
if (element.includes("PRIVATE KEY") && !!passphrase) {
|
||||||
return {
|
return {
|
||||||
@@ -392,10 +407,10 @@ class Pass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Apply a filter to arg0 to remove hidden files names (starting with dot)
|
* Apply a filter to arg0 to remove hidden files names (starting with dot)
|
||||||
@function removeHidden
|
* @function removeHidden
|
||||||
@params {[String]} from - list of file names
|
* @params {String[]} from - list of file names
|
||||||
@return {[String]}
|
* @return {String[]}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function removeHidden(from) {
|
function removeHidden(from) {
|
||||||
|
|||||||
Reference in New Issue
Block a user