anchor.diff:  
   -include("log.hrl").
   -include("pre_client.hrl").
  +
  +-define(AES_BLOCK_SIZE, 16).
   
   -record(state, {
   	cookie :: binary(),
  
positive.code: check_envelope_type(<<"event">>) -> event.
  
  %% ------------------------------------------------------------------
  
  % Decrypt message
  aes_decrypt(Packet, #state{aes_key = AESKey, aes_vector = AESVector}) ->
  
negative.code: 	Id = lists:flatten(IdList),
  	list_to_binary(Id).
  
  build_message(Type, Channel, Json) ->
  	build_message(Type, Channel, Json, undefined, undefined).
  
  build_message({Type, Id}, Channel, Json, AESKey, AESVector) ->
  	Response = #envelope{id = Id, type = Type, contents = Json, channel = Channel},
  	wrap_for_send(Response, AESKey, AESVector);
  
  build_message(Type, Channel, Json, AESKey, AESVector) ->
  	build_message({Type, generate_id()}, Channel, Json, AESKey, AESVector).
  
  wrap_for_send(Recthing) ->
  	wrap_for_send(Recthing, undefined, undefined).
  
  wrap_for_send(Recthing, AESKey, AESVector) ->
  	Json = envelope_to_json(Recthing),
  	JsonEnc = mochijson2:encode(Json),
  	Binary = list_to_binary(lists:flatten(JsonEnc)),
  	case {AESKey, AESVector} of
  		{undefined, undefined} ->
  			netstring:encode(Binary);
  		{_, _} ->
  			Encrypted = aes_encrypt(Binary, AESKey, AESVector),
  			netstring:encode(Encrypted)
  	end.
  
  %% ------------------------------------------------------------------
  
  