import { DefaultEncryptionParameters , Iterations , ValidVersions } from "./default" ; export function validateIterations ( iterations , version ? ) { if ( ! Object . values ( Iterations ) . includes ( iterations ) ) { throw new RangeError ( `The iterations value of ${ iterations } must match one from DefaultEncryptionParameters.Iterations for version ${ version || DefaultEncryptionParameters . Version }.` ) ; } } ; export function validateSalt ( salt , version ? ) { if ( salt . byteLength != DefaultEncryptionParameters . SaltSize ) { throw new RangeError ( `The compatible Salt must be ${ DefaultEncryptionParameters . SaltSize } for version ${ version || DefaultEncryptionParameters . Version }.` ) ; } } export function validateVersion ( version ) { if ( ! ValidVersions . includes ( version ) ) { throw new RangeError ( `The provided version (${ version }) is not valid.` ) ; } }