Skip to content

Commit

Permalink
chore(connect): re-enable logs redacting; redact also features
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed Feb 3, 2025
1 parent f49a273 commit cfcbc9f
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions packages/connect/src/device/DeviceCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,32 @@ const assertType = (res: DefaultPayloadMessage, resType: MessageKey | MessageKey
};

const filterForLog = (type: string, msg: any) => {
const blacklist: { [key: string]: Record<string, string> } = {
// PassphraseAck: {
// passphrase: '(redacted...)',
// },
// CipheredKeyValue: {
// value: '(redacted...)',
// },
// GetPublicKey: {
// address_n: '(redacted...)',
// },
// PublicKey: {
// node: '(redacted...)',
// xpub: '(redacted...)',
// },
// DecryptedMessage: {
// message: '(redacted...)',
// address: '(redacted...)',
// },
const blacklist: { [key: string]: Record<string, string> | string } = {
PassphraseAck: {
passphrase: '(redacted...)',
},
CipheredKeyValue: {
value: '(redacted...)',
},
GetPublicKey: {
address_n: '(redacted...)',
},
PublicKey: {
node: '(redacted...)',
xpub: '(redacted...)',
},
DecryptedMessage: {
message: '(redacted...)',
address: '(redacted...)',
},
Features: '(redacted...)',
};

if (type in blacklist) {
if (typeof blacklist[type] === 'string') {
return blacklist[type];
}

return { ...msg, ...blacklist[type] };
}

Expand Down

0 comments on commit cfcbc9f

Please sign in to comment.