Skip to content

Sentinel PasswordFlexible Password Validation

Accessible, customizable password validation for JavaScript and React

Sentinel Password

Quick Start

npm install @sentinel-password/core
typescript
import { validatePassword } from '@sentinel-password/core'

const result = validatePassword('MyP@ssw0rd!', {
  minLength: 8,
  maxLength: 128,
  requireUppercase: true,
  requireLowercase: true,
  requireDigit: true,
  requireSymbol: true,
  checkCommonPasswords: true
})

if (result.valid) {
  console.log('Password is valid!')
} else {
  console.log('Suggestions:', result.feedback.suggestions)
}

React Integration

typescript
import { usePasswordValidator } from '@sentinel-password/react'

function SignupForm() {
  const { password, setPassword, result } = usePasswordValidator({
    minLength: 8,
    requireUppercase: true
  })

  return (
    <div>
      <input 
        type="password" 
        value={password} 
        onChange={(e) => setPassword(e.target.value)} 
      />
      {result && !result.valid && result.feedback.suggestions.map((suggestion, index) => (
        <p key={index}>{suggestion}</p>
      ))}
    </div>
  )
}

Ready-to-Use Components

typescript
import { PasswordInput } from '@sentinel-password/react-components'

function App() {
  return (
    <PasswordInput
      label="Create Password"
      onValidationChange={(result) => console.log(result)}
    />
  )
}

Released under the MIT License.