mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2026-09-03 20:53:09 -05:00
Redact secrets in logs
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export * from './chapters.js'
|
||||
export * from './hash.js'
|
||||
export * from './secret.js'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
export function maskSecret (secret: string) {
|
||||
if (!secret) return secret
|
||||
if (typeof secret !== 'string') return '****'
|
||||
|
||||
if (secret.length <= 4) return '****'
|
||||
if (secret.length <= 8) return secret.slice(0, 2) + '***'
|
||||
|
||||
return secret.slice(0, 4) + '****'
|
||||
}
|
||||
Reference in New Issue
Block a user