openapi: 3.0.0

info:
  title: TousAntiCovid-Vérif
  version: 1.0.0
  
servers:
  - url: https://portail.tacv.myservices-ingroupe.com/api/
    description: Production

tags:
  - name: decodeDocument
  - name: synchronisation
  - name: configuration

paths:
  /client/convertor/decode/decodeDocument:
    post:
      operationId: decodeDocumentV1
      summary: Convert a French 2D-Doc or ICAO VDS to European DGCA without end-to-end encryption
      tags:
        - decodeDocument
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentRequest'
      responses:
        200:
          description: DGCA certificate
          content:
            text/plain:
              schema:
                type: string
                example: 'HC1:NCFOXN%TS3DHLUGH5D9SC1V2I:ECID:D4SC7%CM/Y4C$4*CMWU4N6QT2DZIE%OM:UC*GPXS40 LHZATG91PC/.DV2MGDIK3MXGG HG4HGBIKLIA-D8+6JDJN XGUEERH9W/I 6AHCRIABFDON95404PL7BD7RG8CU6O8QGU68ORLI5ZHQKZ5:SPE 6T.QVT4XZR538UZRQD7NK5V+Q*NR6FRBT42L6Z6NC8P$WA3AA9EPBDSM+QFE4PTM*NRCX7UHLO$GAHLW 70SO:GOLIROGOQQ5L/5R3FOKEH-B$:F 6HA6GE7IOZ9%9D1-HMPDMIAG$3S49965K00WH9P8Q.NP6LE3.UOB19UEJE1VY9U7QVOE.641-ST*QGTA W7G 7G+SB.V Q5 M98L4-I0C BNTO-5H3QMD%3P+S4R5/JFY5UR0PC*EZME7KJ:G57*L.RU4VJE%5GZL**SQQK2.EVQVN8WIVI9.TC5N$6VWXPJYJ 1U84APR9DIMZCFI2W:F9$LQ6AF'
        default:
          $ref: '#/components/responses/ErrorResponse'
          
  /v2/client/convertor/decode/decodeDocument:
    post:
      operationId: decodeDocumentV2
      summary: Convert a French 2D-Doc or ICAO VDS to European DGCA with ECDH end-to-end encryption
      tags:
        - decodeDocument
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EncryptedDocumentRequest'
      parameters:
        - name: publicKey
          in: query
          required: true
          schema:
            type: string
            description: 'Base64 encoded public key'
            example: 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEMj7UPnIywgrOmzGdtSayT3w50tR+CH18J7hHIatl5+FJ1ufDS7wR0u1UFXf0eTTlA36FPIZ86zv91Z0iYBqx+A=='
        - name: keyAlias
          in: query
          required: true
          schema:
            type: string
            description: 'ID of public key used for encryption of chainEncoded'
            example: 'prd01'
      responses:
        200:
          description: Encrypted DGCA certificate
          content:
            text/plain:
              schema:
                type: string
                example: 'AIY8Nh2pS4mrsS8yZZ/FbqELl1DDkVHKqsmGWvgOHdb2/6WoXomNjHhfuXd4q3tblI75tUi/wE5/aow7adHPKsXSLyVVEmO0ZcuS3CUxUQ5hDd0OTSCkvDqSGs/8x5UlBmgQTTEDAv8RlZ/t1rK8DvoHeNDwEGKCTiO0JsLM8S9+Y9/CNLWJhBfpWgzAEBol27rvWMKsBfSB84QLUDASUjPJhv8f8HD8hoo+L3VJKTgHoH7OSLTsQuLD8DjV7ADM4XcxL31cmEsrGP1GQnolfvORqx2SfGeT2a7MjRgt2zCHyrHHGYNsVA+6eWN1wVwYBjwG6XJ0ci8adzhcekxGBomRoDCm6S8d6HfhXHfHQ7PVn+PBKIi5Tee0H8Spb5gQeK5W64ca4KvDigomxoSu7FMzzeMUaPABeTTzpY8V7g8P507l6798a5/e1xkFqh6htu9RdPZCa2L6LzrUrVc7on97xXm4yCZ6vFoyEu1GNjYBReS9rZr7N0ipC05JMpBICdH3lkj0oNIWdm0ED5jnzcm1sDEmmRbFH0dDHnGgwlg6vE0DvvADsI61GfBqGDJz1jg1WEiaHi6XQs9CigKy8cIPmLnz0jzRjCH6ASZMMTQ90A4MFXO285YEFmr7nRo3prYRkj/mYLAQCpuaJMVA8wFmuCUD8Kasv8SP79oLjvsXqHD2XCQPv3qkAGXOkPIGmeEP5hjGLByIvSY+fiiFVX7YmQkWJSI='
        default:
          $ref: '#/components/responses/ErrorResponse'

  /client/configuration/configuration/tacv:
    get:
      operationId: getConfiguration
      summary: Get app configuration
      tags:
        - configuration
      responses:
        200:
          $ref: '#/components/responses/GetConfigurationResponse'

  /client/configuration/synchronisation/tacv:
    get:
      operationId: getCertificates
      summary: Get certificates
      tags:
        - synchronisation
      responses:
        200:
          $ref: '#/components/responses/GetCertificatesResponse'
          
  /client/configuration/synchronisation:
    post:
      operationId: sendAnalytics
      summary: Send application events to server
      tags:
        - synchronisation
      requestBody:
        description: List of events
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                example: "2021-08-08T15:22:18.897|true|||TACV_2DDOC_ANDROID_LITE|000000000||||2D-DOC_L1||"
      responses:
        200:
          description: Empty response

components:                
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

  responses:
    ErrorResponse:
      description: Error encountered
      content:
        application/json:
          schema:
            type: object
            properties:
              codeError:
                type: string
                example: 'CANNOT_PARSE_2DDOC'
              msgError:
                type: string
                example: 'Unexpected analysis result: [Prélèvement non conforme]'
    
    GetConfigurationResponse:
      description: App configuration
      content:
        application/json:
          schema:
            type: object
            properties:
              organization:
                type: string
              statics:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                      example: 'signature'
                    label:
                      type: string
                      example: 'Données de validité'
                    order:
                      type: integer
                      example: 1
              about:
                type: object
                properties:
                  url:
                    type: string
                  mail:
                    type: string
                  cgu:
                    type: string
                    format: url
                    example: 'https://cdn.ingroupe.com/image/upload/v1608654186/IN%20Verify%20CGU/tac-cgu-application-mobile-verify.pdf'
                  privacyPolicy:
                    type: string
                    format: url
                    example: 'https://cdn.ingroupe.com/image/upload/tac-boqpocuqwwl9zywnhewl.pdf'
                  androidConfiguration:
                    type: object
                    properties:
                      lastMajorVersion:
                        type: string
                        example: '54'
                      lastMinorVersion:
                        type: string
                        example: '54'
                  iosConfiguration:
                    type: object
                    properties:
                      lastMajorVersion:
                        type: string
                        example: '69'
                      lastMinorVersion:
                        type: string
                        example: '69'
                  lastCGUVersion:
                    type: string
                    example: '2'
                  lastPrivacyPolicyVersion:
                    type: string
                    example: '2'
                  licenceExpirationDelay:
                    type: integer
                    example: 480
              contacts:
                type: array
                items:
                  type: object
              types:
                type: array
                items:
                  type: object

    GetCertificatesResponse:
      description: Certificates (and some extras)
      content:
        application/json:
          schema:
            type: object
            properties:
              currentDate:
                type: string
                format: datetime
              period:
                type: object
                properties:
                  frequency:
                    type: integer
                    description: 'Synchronisation frequency in hours'
                    example: 24
                  step1:
                    type: integer
                    description: 'TODO in hours'
                    example: 72
                  step2:
                    type: integer
                    description: 'TODO in hours'
                    example: 240
                  step3:
                    type: integer
                    description: 'TODO in hours'
              validity:
                type: object
                properties:
                  negative:
                    type: integer
                    description: 'TODO in hours'
                    example: 72
                  positiveStart:
                    type: integer
                    example: 360
                  positiveEnd:
                    type: integer
                    example: 1464
              translations:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      example: 'static.message.F4'
                    group:
                      type: string
                      example: 'antigenic'
                    labels:
                      type: object
              certificates2DDoc:
                type: object
              certificatesDCC:
                type: object
                
  schemas:
    DocumentRequest:
      type: object
      properties:
        chainEncoded:
          type: string
          description: URL Encoded document contents
          example: 'DC04FR03AV011E6A1E6AL101FRL0THEOULE%20SUR%20MER%1DL1JEAN%20PIERRE%1DL231051962L3COVID-19%1DL4J07BX03%1DL5COMIRNATY%20PFIZER/BIONTECH%1DL6COMIRNATY%20PFIZER/BIONTECH%1DL71L82L901032021LACO%1FJQQOXUNIHI3JIQJIWNZ6LIZUB5PDMI46BBNQVDYJU3QLXI647IH3DML3UC5GJNIOPDLPDWNALTKUKMA5O7FZW5GLJCB2T7IDVRDPQSY'
        source:
          type: string
          enum:
            - 'DEUX_D_DOC'
            - 'ICAO'
        destination:
          type: string
          enum:
            - 'DGCA'
    EncryptedDocumentRequest:
      type: object
      properties:
        chainEncoded:
          type: string
          description: Base64 Encoded encrypted document contents
          example: 'AIY8Nh2pS4mrsS8yaZ/EYKka4SzaiUSvyL/0U4UebN+PiqzKW+qXjmUtuXtkowQ/84jooiC533xqb4VaHLWsN9vCSUM+On7TFaDrrDFHKgZ4fbQGSzGzpTuLS8uSzPFVfQFwPQNhc+pslZH70bjbGoIQebniEgTlSyiyI9rA80onF8K3MbyKmHnwSQClBQ4kuKiSPqDTC/KW5I4CDzphLDHIgYcW9BGAgvpKKhZCUDgdiXunSLzhIZTF6j2vkxPV+nU8VHU5hFRGe5VZQhpZAejv3Q/4fwSe0qGp7n00tVmbrr7FZeMMSxTcGhd5s0xgATBu/Rpzd0sVd01NYVtJGIWPvkGlhyh84hHlTXatINHUl/q3K5mgUukzhAnq9bULF68jjDZLFk8H'
        source:
          type: string
          enum:
            - 'DEUX_D_DOC'
            - 'ICAO'
        destination:
          type: string
          enum:
            - 'DGCA'
            
security:
  - bearerAuth: []