MCPcopy Create free account
hub / github.com/cryptii/cryptii / settingValueDidChange

Method settingValueDidChange

src/Encoder/BlockCipher.js:144–166  ·  view source on GitHub ↗

* Triggered when a setting field has changed. * @protected * @param {Field} setting Sender setting field * @param {mixed} value New field value

(setting, value)

Source from the content-addressed store, hash-verified

142 * @param {mixed} value New field value
143 */
144 settingValueDidChange (setting, value) {
145 switch (setting.getName()) {
146 case 'algorithm': {
147 const { keySize } = BlockCipherEncoder.getAlgorithm(value)
148
149 this.getSetting('key')
150 .setMinSize(keySize)
151 .setMaxSize(keySize)
152 break
153 }
154 case 'mode': {
155 const algorithm = this.getSettingValue('algorithm')
156 const { blockSize } = BlockCipherEncoder.getAlgorithm(algorithm)
157 const { hasIV } = BlockCipherEncoder.getMode(value)
158
159 this.getSetting('iv')
160 .setVisible(hasIV)
161 .setMinSize(blockSize)
162 .setMaxSize(blockSize)
163 break
164 }
165 }
166 }
167
168 /**
169 * Performs encode or decode on given content.

Callers

nothing calls this directly

Calls 8

getAlgorithmMethod · 0.80
setMaxSizeMethod · 0.80
setMinSizeMethod · 0.80
getSettingMethod · 0.80
getSettingValueMethod · 0.80
getModeMethod · 0.80
getNameMethod · 0.45
setVisibleMethod · 0.45

Tested by

no test coverage detected