license import { Iterations , DefaultEncryptionParameters , ValidVersions } from "../parameters/default" ; import { validateIterations , validateVersion } from "../parameters/validate" ; export class ContextSecurity { passphrase : ArrayBuffer ; nIterations : number ; version : number ; constructor ( passphrase , params ? ) { if ( ! ( passphrase instanceof ArrayBuffer || ArrayBuffer . isView ( passphrase ) ) ) { throw new SyntaxError ( "The provided passphrase parameter is not an instance of ArrayBuffer." ) ; } this . passphrase = passphrase ; if ( ( params && params . version ) ) { validateVersion ( params . version ) ; } this . version = ( params && params . version ) || DefaultEncryptionParameters . Version ; if ( ( params && params . nIterations ) ) { validateIterations ( params . nIterations ) ; } this . nIterations = ( params && params . nIterations ) || Iterations . STRONG ; } }