Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Felix' Wire API Message Tests

Fi0x edited this page Nov 28, 2020 · 11 revisions

Goal

Finding out how to send Wire messages correctly

Procedure

Analysis of the Wire API

Getting information from this website

Commands that seem useful

Since we only want to send messages in a single conversation, we only analyzed the second command

Testing in Java

Used HTTP requests to get a response that can be analyzed

Results

Website

  • Response codes:
    • 200: Contains json body
      • ClientMismatch
      • UserClients
    • 201: Message posted
    • 401: Missing authorization
    • 403: Sending client not known
    • 404: Conversation not found
    • 412: Missing clients
  • URL contains conversation id
  • Headers
    • response content type: application/json
    • accept: text/html
  • Body is json
    • NewOtrMessage
      • priority: optional
      • reportMissing: optional
      • data: optional
      • push: optional
      • sender: required
      • trasient: optional
      • recipients: required
        • "userID": at least 1 required
          • "clientID": "OTR Content" - at least 1 required
  • Need to find out where to put the message
    • OTR Content
    • data

Tests in Java

Send /conversations/{cnv}/otr/messages

  • Sending request without any token
    • 401: Authentication required
    • HTML returned
  • Sending request with bearer token in url
    • 400: invalid payload
  • Sending request with bearer token in header
    • 401: Authentication required
  • Using JSONParser to build a JSON String to send as body
    • With no bearer token or bearer token in header: 401
    • With bearer token in url and a non empty body: 400 + json body: invalid sender -> I'm keeping the bearer token in url
    • Using the access cookie or the bearer token leads to the same result as using the user id
  • Used a clientID as sender
    • Response is still 400, but with other error message
    • new Error: UUID.fromText failed for recipients
      • need to add valid recipients
  • Used correct format for recipients
    • Response is 201
    • Can't receive the message since it's not encrypted correctly