- Cipher — Encrypt and decrypt with a shared secret; URL-safe output.
- Email — Validate, normalize, and extract domain or local part.
- Fullname — Validate and normalize human names with optional formatting.
- Hostname — Validate and normalize hostnames (e.g. for TLS or DNS).
- Password — Validate rules, score strength, or generate random passwords.
- Pin — Validate and normalize numeric PINs (e.g. 4–8 digits).
- Username — Validate and normalize usernames (letters, numbers, underscore).
deno add jsr:@neabyte/auth-corenpm install @neabyte/auth-core<script type="module">
import { Email, Password, Username } from 'https://esm.sh/@neabyte/auth-core'
// or pin version: .../auth-core@x.x.x
</script>- Latest:
https://esm.sh/@neabyte/auth-core - Pinned:
https://esm.sh/@neabyte/auth-core@<version>
Import the classes you need.
- Use
isValid()for a quick boolean check validate()when you need{ valid, errors }(e.g. to show errors in a form)normalize()when you want a cleaned string to store or display, ornullif invalid.
import { Email, Password, Username } from '@neabyte/auth-core'
Email.isValid('john@doe.com')
// true
Password.validate('short', { minLength: 8 })
// { valid: false, errors: ['Password must be at least 8 characters'] }
Username.normalize(' Jane_Doe ')
// 'jane_doe'Note
TypeScript types (e.g. PinResult, PasswordOptions) are exported. More details: USAGE.md
From the repo root (requires Deno).
Check — format, lint, and typecheck source:
deno task checkUnit tests — format/lint tests and run all tests:
deno task testTests live under tests/ (one file per module).
This project is licensed under the MIT license. See the LICENSE file for details.