Skip to content

Installation

Package Overview

Sentinel Password provides three packages to fit different use cases:

PackageDescriptionSizeDependencies
@sentinel-password/coreCore validation library for any JavaScript framework<5KBZero
@sentinel-password/reactReact hooks for password validation~2.5KBReact 18+
@sentinel-password/react-componentsPre-built accessible React components~6KBReact 18+

Installation Methods

npm

bash
npm install @sentinel-password/core
bash
npm install @sentinel-password/react
bash
npm install @sentinel-password/react-components

pnpm

bash
pnpm add @sentinel-password/core
bash
pnpm add @sentinel-password/react
bash
pnpm add @sentinel-password/react-components

yarn

bash
yarn add @sentinel-password/core
bash
yarn add @sentinel-password/react
bash
yarn add @sentinel-password/react-components

bun

bash
bun add @sentinel-password/core
bash
bun add @sentinel-password/react
bash
bun add @sentinel-password/react-components

Requirements

Core Package

  • No runtime dependencies
  • Works with any JavaScript environment (Node.js, browsers, Deno, Bun)
  • TypeScript 5+ for development

React Packages

  • React 18.0.0 or higher (or React 19+)
  • React DOM 18.0.0 or higher (for components package)

TypeScript Support

All packages are written in TypeScript and include full type definitions:

typescript
import type { 
  ValidationResult,
  ValidatorConfig,
  PasswordStrength 
} from '@sentinel-password/core'

import type { 
  UsePasswordValidatorOptions,
  UsePasswordValidatorReturn 
} from '@sentinel-password/react'

import type { 
  PasswordInputProps,
  ValidationMessage 
} from '@sentinel-password/react-components'

Module Formats

All packages support both ESM and CommonJS:

javascript
// ESM
import { validatePassword } from '@sentinel-password/core'

// CommonJS
const { validatePassword } = require('@sentinel-password/core')

CDN Usage

For quick prototyping, you can use a CDN:

html
<!-- ESM -->
<script type="module">
  import { validatePassword } from 'https://esm.sh/@sentinel-password/core'
  
  const result = validatePassword('password123', {
    validators: { length: { min: 8 } }
  })
  console.log(result)
</script>

WARNING

CDN usage is not recommended for production. Always install packages via npm for better performance and caching.

Verify Installation

After installation, verify everything works:

javascript
import { validatePassword } from '@sentinel-password/core'

const result = validatePassword('Test1234!', {
  validators: {
    length: { min: 8 }
  }
})

console.log(result.isValid) // true

Next Steps

Released under the MIT License.