You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin needs to validate options after we construct the options object. We can iterate over the keys and ensure everything we expect exists and is the correct type.
Possible implementation:
constoptionsTypeValidations={sharedSecret: 'string',verificationError: 'string',verificationErrorMessage: 'string',extractSignature: ()=>{},constructSignatureString: ()=>{},getDigest: ()=>{},digestEncoding: 'string',getAlgorithm: ()=>{},algorithmMap: {},getSignatureEncoding: ()=>{}}for(const[key,value]ofObject.entries(optionsTypeValidations)){if(!options[key]||typeofoptions[key]!==typeofvalue){thrownewError(`${key} option does not exist or is not of type ${typeofvalue}`)}
The text was updated successfully, but these errors were encountered:
I ran across this library https://github.com/dsheiko/bycontract . It uses JSDoc expressions to configure the validation tests. It might kill two birds with one stone.
Needs discussion:
The plugin needs to validate options after we construct the options object. We can iterate over the keys and ensure everything we expect exists and is the correct type.
Possible implementation:
The text was updated successfully, but these errors were encountered: