In order to open password-protected documents, you have to pass your password to LoadOptions class constructor or assign it to its Password property of an instance of LoadOptions class:
constredaction=require('@groupdocs/groupdocs.redaction');constloadOptions=newredaction.LoadOptions('mypassword');constredactor=newredaction.Redactor('protected_sample.docx',loadOptions);try{// Here we can use document instance to perform redactions
redactor.apply(newredaction.ExactPhraseRedaction('John Doe',newredaction.ReplacementOptions('[personal]')));redactor.save();}finally{redactor.close();}
protected.docx is the sample file used in this example. Click here to download it.