Skip to content

Commit

Permalink
feat(client): obfuscate token while logging in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ngouy committed Dec 19, 2024
1 parent b1f4683 commit f39d050
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/clients/transporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ const defaultTransportConfig = {
};
},
};

const obfuscateToken = (options) => {
if (!options.token) return options;

return {
...options,
token: options.token.slice(0, 5) + '**********',
};
};

class Transporter {
constructor(options, sideLoad = [], useDotJson = true) {
this.options = options;
this.options = obfuscateToken(options);
this.sideLoad = sideLoad;
this.useDotJson = useDotJson;
this.authHandler = new AuthorizationHandler(this.options);
Expand Down

0 comments on commit f39d050

Please # to comment.