Skip to content

Commit

Permalink
Nova Release 3.0.4: Suporte a certificados pem
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoliveiraGN committed Apr 27, 2023
1 parent 3c14703 commit f746ccb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions lib/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ class Endpoints {
})

try {
this.agent = new https.Agent({
pfx: fs.readFileSync(this.options.certificate),
passphrase: '',
})

if(this.options.pemKey){
this.agent = new https.Agent({
cert: fs.readFileSync(this.options.certificate),
key: fs.readFileSync(this.options.pemKey),
passphrase: ''
})
}else{
this.agent = new https.Agent({
pfx: fs.readFileSync(this.options.certificate),
passphrase: '',
})
}

this.options.agent = this.agent

} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gn-api-sdk-node",
"description": "Module for integration with Gerencianet API",
"version": "3.0.3",
"version": "3.0.4",
"author": "Gerencianet - Consultoria Tecnica | Palloma Brito | João Vitor Oliveira",
"license": "MIT",
"repository": "gerencianet/gn-api-sdk-node",
Expand Down

0 comments on commit f746ccb

Please sign in to comment.