( code: string, options: GenerateOptions )
| 43 | } |
| 44 | |
| 45 | export function isModeCompatible( |
| 46 | code: string, |
| 47 | options: GenerateOptions |
| 48 | ): boolean { |
| 49 | const mode: SecurityMode = options.mode ?? 'normal' |
| 50 | if (mode === 'normal') return true |
| 51 | |
| 52 | const a = analyze(code) |
| 53 | |
| 54 | if (isAllSame(code)) return false |
| 55 | if (isTooSimpleSequence(code)) return false |
| 56 | if (hasRepeats(code)) return false |
| 57 | if (a.isSequentialAsc || a.isSequentialDesc) return false |
| 58 | |
| 59 | if (a.length === 4 && a.entropy < 6.5) return false |
| 60 | if (a.length === 6 && a.entropy < 10) return false |
| 61 | |
| 62 | return true |
| 63 | } |
| 64 | |
| 65 | export function isPredictionCompatible( |
| 66 | code: string, |
no test coverage detected