import { whisper } from '@oliveai/ldk';
} from "@oliveai/ldk/dist/whisper"
const validatePassword = (password: string) => {
const regExpLetters = /[a-zA-Z]/g
const regExpNumbers = /\d/
if (password.length < 8) {
return "Password Must be atleast 8 characters long!"
} else if (!regExpLetters.test(password) ){
return "Password must contain aleast 1 letter!"
} else if (!regExpNumbers.test(password) ){
return "Password must contain aleast 1 number!"
const passwordExampleConfig = ( (value: string, validationError: string): NewWhisper | UpdateWhisper => {
label: 'Password Example',
type: WhisperComponentType.Password,
tooltip: 'Password Must be atleast 8 characters and include letters and numbers',
validationError: validationError,
onChange: (error: Error, password: string, whisper: Whisper) => {
whisper.update(passwordExampleConfig(password, validatePassword(password)))
const newPasswordExampleConfig = (async () => {
await whisper.create(passwordExampleConfig('', '') as NewWhisper);
newPasswordExampleConfig();