Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async cipherKeyValue(
v: Messages.CipherKeyValue.AsObject
): Promise {
// if(val.length % 16 !== 0) val = val.concat() TODO THIS
const cipherKeyValue = new Messages.CipherKeyValue()
cipherKeyValue.setAddressNList(v.addressNList)
cipherKeyValue.setKey(v.key)
cipherKeyValue.setValue(v.value)
cipherKeyValue.setEncrypt(v.encrypt)
cipherKeyValue.setAskOnEncrypt(v.askOnEncrypt || false)
cipherKeyValue.setAskOnDecrypt(v.askOnDecrypt || false)
cipherKeyValue.setIv(v.iv || '')
const response = await this.transport.call(Messages.MessageType.MESSAGETYPE_CIPHERKEYVALUE, cipherKeyValue) as Event
if(response.message_type === Events.FAILURE) throw event
const ckv = response.message as Messages.CipheredKeyValue
return ckv.getValue()
}