{
  "openapi": "3.0.0",
  "info": {
    "title": "Session Management API",
    "version": "1.08.11.02",
    "description": "API documentation for Session Management API"
  },
  "servers": [
    {
      "url": "https://pilot-root.1kosmos.net/sessions/"
    }
  ],
  "paths": {
    "/tenant/{tenantId}/community/{communityId}/nonce/sign": {
      "post": {
        "summary": "Generate Signature",
        "description": "Generate Signature\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### tenantId (required)\nThe id of tenant\n\n### communityId (required)\nThe id of community\n\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 60 seconds from now\n\n### publickey (required)\nPublic key\n\n|              **Request Body**                |\n|----------------------------------------------|\n\n### publicKey (required)\ncaller's publicKey\n\n### nonce (required)\nuuid\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns signed nonce\n",
        "tags": [
          "Session"
        ],
        "security": [
          {
            "authMyPublicKey": []
          },
          {
            "authMyPrivateKey": []
          },
          {
            "authLicense": []
          }
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "description": "Id of tenant",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "communityId",
            "in": "path",
            "description": "Id of community",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 60 seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "requestBody": {
          "description": "Request body contains 'data' field with encrypted object below:\n\nIMPORTANT - you can send unencrypted data in this request, it is only available in Swagger\n\n```\n{\n    \"data\": {\n        \"publicKey\": \"string - required\",\n        \"nonce\": \"string - required\"\n    }\n}\n```\n",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSignedNonce"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed nonce",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "signed_nonce": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "401": {
            "$ref": "#/components/schemas/UnauthorizedError"
          }
        }
      }
    },
    "/session/{sessionId}/authenticate": {
      "post": {
        "summary": "Authenticate session id",
        "description": "Authenticate session\n- There must be a **AuthSession** with **sessionId**\n- The **AuthSession** must not be expired\n- only auth **SessionAuthEvent** can be recorded against a session\n- note: (feb2): the \"id\" is mongo record Id\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### sessionId (required)\nThe id of session\n\n|              **Request Body**                |\n|----------------------------------------------|\n\n### did (required)\n(TBD)\n\n<br />\n### ial (optional)\n(TBD)\n\n<br />\n### eventData (optional)\n(TBD)\n\n<br />\n### appid (required)\n(TBD)\n\n<br />\n### data (required)\n(TBD)\n\n<br />\n### publicKey (required)\nThe publicKey is type of string and required.\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns the session id (mongo record id) if the session auth event not exist.\nThis API throws an error if something goes wrong.\nA common source of error is a session auth event is exists or auth session not existed(sessionId from params).\n",
        "tags": [
          "Session"
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "description": "Id of session to submit auth data",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "New session data",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session Info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "401": {
            "$ref": "#/components/schemas/UnauthorizedError"
          },
          "404": {
            "$ref": "#/components/schemas/NotFoundError"
          }
        }
      }
    },
    "/session/{sessionId}": {
      "get": {
        "summary": "Get info about session id",
        "description": "Returns **AuthSession** Object\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### sessionId (required)\nThe id of session\n\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns AuthSession object\n",
        "tags": [
          "Session"
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "description": "Id of session to get info",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session Info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AuthSession"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/schemas/NotFoundError"
          },
          "422": {
            "$ref": "#/components/schemas/UnsupportedStateError"
          }
        }
      }
    },
    "/session/{sessionId}/response": {
      "get": {
        "summary": "Fetch session response",
        "description": "Get info about AuthSessionEvent. <br />\n   - valid community license with authlevel system, service, service_ext, app and app_ext\n   - **sessionId** must not be expired\n   - caller's **publicKey** must match **SessionAuth.publicKey**\n   - return associated **SessionAuthResponse**\n   - note:\n       - **SessionAuthResponse** object must get deleted after successfuly fetch\n       - If session has expired, return appropriate error/message and delete both **AuthSession** and **SessionAuthResponse** entries.\n\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### sessionId (required)\nThe id of session\n\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### addsessioninfo (optional)\nIf this header is set then the response will include \"sessionInfo\"\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns associated SessionAuthResponse object.\n",
        "tags": [
          "Session"
        ],
        "security": [
          {
            "authMyPublicKey": []
          },
          {
            "authMyPrivateKey": []
          },
          {
            "authLicense": []
          }
        ],
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "description": "Id of session to submit auth data",
            "required": true,
            "schema": {
              "type": "string",
              "example": "xxxxxx-xxxxxx-xxxxx-xxxxx"
            }
          },
          {
            "name": "addsessioninfo",
            "in": "header",
            "description": "If this header is set then the response will include \"sessionInfo\" once the response returns successfully",
            "required": false,
            "schema": {
              "type": "string",
              "example": 1
            }
          },
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key  / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SessionAuthEvent"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "401": {
            "$ref": "#/components/schemas/UnauthorizedError"
          },
          "404": {
            "$ref": "#/components/schemas/NotFoundError"
          },
          "422": {
            "$ref": "#/components/schemas/UnsupportedStateError"
          }
        }
      }
    },
    "/session/new": {
      "put": {
        "summary": "Create a new session",
        "description": "Creates a new **AuthSession** object. <br />\n- valid community license with authlevel system, service, service_ext, app and app_ext\n- create a new **sessionId** = new uuid()\n- create entry into the DB\n- **publicKey** is in the request headers\n- return created **sessionId**\n\n|              **Headers**                     |\n|----------------------------------------------|\n\n### licensekey (required)\nLicense key encrypted with ECDSA\n\n### requestid (required)\nJSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now\n\n### publickey (required)\nPublic key\n\n|            **Request Body**                  |\n|----------------------------------------------|\n\n### origin (required)\nThe origin key is type of object and required\n\n* ### Origin Child Parameters\n       tag (required)\n       The tag key is type of string and required.\n\n       url (required)\n       The url key is type of string and required.\n\n       communityName (required)\n       The communityName key is type of string and required.\n\n       communityId (required)\n       The communityId key is type of string and required.\n\n       authPage (optional)\n       The authPage key is type of string and optional.\n\n<br />\n### scopes (optional)\nThe scopes key is type of string and optional.\n\n<br />\n### authtype (required)\nThe authtype key is type of string and required.\n\n<br />\n### metadata (optional)\nThe metadata key is type of object and optional.\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns created sessionId\n",
        "tags": [
          "Session"
        ],
        "security": [
          {
            "authMyPublicKey": []
          },
          {
            "authMyPrivateKey": []
          },
          {
            "authLicense": []
          }
        ],
        "parameters": [
          {
            "name": "licensekey",
            "in": "header",
            "description": "License key encrypted with ECDSA / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "requestid",
            "in": "header",
            "description": "JSON string encrypted with ECDSA which should contain \"appid\" (string), \"uuid\" (string) and \"ts\" (number) representing epoch timestamp in seconds - it shouldn't be more or less than 'environment.allowed_time_span' seconds from now / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          },
          {
            "name": "publickey",
            "in": "header",
            "description": "Public Key / Try Authorize &#128274;",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Do not enter anything, use 'Authorize' fields"
            }
          }
        ],
        "requestBody": {
          "description": "New session data",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewSessionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/schemas/NewSessionResponse"
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "401": {
            "$ref": "#/components/schemas/UnauthorizedError"
          },
          "403": {
            "description": "License is not valid for this community"
          },
          "404": {
            "$ref": "#/components/schemas/NotFoundError"
          },
          "422": {
            "$ref": "#/components/schemas/UnsupportedStateError"
          }
        }
      }
    },
    "/sd": {
      "get": {
        "summary": "Get all service directories.",
        "description": "Get all service directories.\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns all service directories.\n",
        "tags": [
          "Service Directory"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetServiceDirectoryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/publickeys": {
      "get": {
        "description": "Get system's public key.\nNo authorization\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns a public key object\n",
        "tags": [
          "Public Key"
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicKeyResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/schemas/NotFoundError"
          }
        }
      }
    },
    "/nonce/validate": {
      "get": {
        "summary": "Validate Signature",
        "description": "Validate Signature\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### nonce (required)\nThe id of tenant\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns signed nonce JSON\n",
        "tags": [
          "Session"
        ],
        "parameters": [
          {
            "name": "nonce",
            "in": "query",
            "description": "Nonce string to validate",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Signed nonce JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "nonce": {
                      "type": "string"
                    },
                    "publicKey": {
                      "type": "string"
                    },
                    "generated_ts": {
                      "type": "string"
                    },
                    "valid_ts": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "401": {
            "$ref": "#/components/schemas/UnauthorizedError"
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "summary": "Get healthz.",
        "description": "Get healthz\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns a healthz object\n - ```version = <git-tag>.<commit-id>.<dob>```\n\n - ```git-tag```: When code is compiled from a git-tag, this must carry the tag name. This should match one of the git tags.\n\n - ```commit-id```: This is the git-commit-id. eg: When code is built from this, the hex code, in the end, is the commit it.\n\n - ```dob```: Date Of Build. This is epoc-time-in-seconds that tell the time when the build was created.\n\n - \u200bif the code is not built from a git-tag, then the ```version =\ufffc<commit-id>.<dob>```\n",
        "tags": [
          "Healthz"
        ],
        "responses": {
          "200": {
            "description": "Success\n\n```\n{\n    \"status\": \"all services operational\",\n    \"publicKey\": \"string\" //same as <service>/publickeys endpoint,\n    \"code\": \"200\",\n    \"version\": \"<version>\" //as defined above\n}\n```\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthzResponse"
                }
              }
            }
          }
        }
      }
    },
    "/environment": {
      "get": {
        "description": "Provide details regarding the environments.\n- The **system** key whose type is hawk can only retrieve the environments.\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns a environment object\n\n|            **Headers**                     |\n|----------------------------------------------|\n\n  ### license\n  License key\n",
        "tags": [
          "Environment"
        ],
        "security": [
          {
            "license": []
          }
        ],
        "parameters": [
          {
            "name": "license",
            "in": "header",
            "description": "License key;",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/ecdsa_helper/{method}": {
      "post": {
        "description": "Encrypt and decrypt the data string by public key and private key.\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### method (optional)\nThe method parameter is type of enum. Default value is encrypt. <br />\nThis parameter only accepts following values <br />\n   **encrypt**, **decrypt**\n\n\n|            **Request Body**                  |\n|----------------------------------------------|\n\n\n### dataStr (required)\nThe dataStr key is type of string.\n\n<br />\n### publicKey (required)\nThe publicKey is type of string.\n\n<br />\n### privateKey (required)\nThe privateKey is type of string.\n\n|            **Returns**                    |\n|-------------------------------------------|\n\nReturns the encrypted/decrypted string. <br />\nThis API throw an error if something goes wrong. A common source of error is public or private key is not valid.\n",
        "tags": [
          "ECDSA Helper"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EcdsaEncryptDecryptRequest"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "method",
            "schema": {
              "type": "string",
              "enum": [
                "encrypt",
                "decrypt"
              ],
              "default": "encrypt"
            }
          }
        ],
        "responses": {
          "200": {
            "422": {
              "$ref": "#/components/schemas/UnsupportedStateError"
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EcdsaEncryptDecryptResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/r1/community/{communityName}/session/{sessionId}/authenticate": {
      "put": {
        "summary": "LEGACY - Authenticate session id",
        "description": "Submit auth data (legacy support)\n- There must be a **AuthSession** with **sessionId**\n- The **AuthSession** must not be expired\n- only auth **SessionAuthEvent** can be recorded against a session\n- note: (feb2): the \"id\" is mongo record Id\n\n|              **Parameters**                  |\n|----------------------------------------------|\n\n### sessionId (required)\nThe id of session\n\n### communityName (required)\nThe name of community\n(TBD - Ignore now => from spec file)\n\n|              **Request Body**                |\n|----------------------------------------------|\n\n### did (required)\n(TBD)\n\n<br />\n### ial (optional)\n(TBD)\n\n<br />\n### appid (required)\n(TBD)\n\n<br />\n### data (required)\n(TBD)\n\n<br />\n### publicKey (required)\nThe publicKey is type of string and required.\n\n|              **Returns**                     |\n|----------------------------------------------|\n\nReturns the session id (mongo record id) if the session auth event not exist.\nThis API throws an error if something goes wrong.\nA common source of error is a session auth event is exists or auth session not existed(sessionId from params).\n",
        "tags": [
          "Legacy Session"
        ],
        "parameters": [
          {
            "name": "communityName",
            "in": "path",
            "description": "The name of community => Ignore now (TBD - you can input everything here)",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sessionId",
            "in": "path",
            "description": "Id of session to submit auth data",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "New session data",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session Info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/BadRequestError"
          },
          "401": {
            "$ref": "#/components/schemas/UnauthorizedError"
          },
          "404": {
            "$ref": "#/components/schemas/NotFoundError"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuthenticationRequest": {
        "type": "object",
        "required": [
          "did",
          "appid",
          "data",
          "publicKey"
        ],
        "properties": {
          "data": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "appid": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "ial": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "eventData": {
            "type": "string",
            "example": "xxxxxxxx"
          },
          "publicKey": {
            "type": "string",
            "example": "xxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
          },
          "did": {
            "type": "string",
            "example": "xxxxxx/xxxxxxxx"
          }
        }
      },
      "DefaultResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "example": "API is working"
          }
        }
      },
      "EcdsaEncryptDecryptRequest": {
        "type": "object",
        "required": [
          "dataStr",
          "publicKey",
          "privateKey"
        ],
        "properties": {
          "dataStr": {
            "required": true,
            "type": "string",
            "description": "Message to encrypt or decrypt",
            "example": "Hey, This is example data string."
          },
          "publicKey": {
            "required": true,
            "type": "string",
            "example": "xxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
          },
          "privateKey": {
            "required": true,
            "type": "string",
            "example": "xxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
          }
        }
      },
      "EcdsaEncryptDecryptResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "string"
          }
        },
        "example": {
          "data": "xxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxx"
        }
      },
      "ServiceKey": {
        "type": "object",
        "required": [
          "tag",
          "keyId",
          "keySecret",
          "type"
        ],
        "properties": {
          "tag": {
            "type": "string",
            "description": "service ecdsa"
          },
          "keyId": {
            "type": "string",
            "description": "ecdsa publicKey"
          },
          "keySecret": {
            "type": "string",
            "description": "ecdsa private key"
          },
          "type": {
            "type": "string",
            "description": "default = ecdsa | hawk"
          }
        },
        "example": {
          "tag": "xxxxx",
          "keyId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
          "keySecret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx",
          "type": "xxxxx"
        }
      },
      "AuthSession": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "description": "UUID of each AuthSession"
          },
          "origin": {
            "type": "object",
            "properties": {
              "tag": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "communityName": {
                "type": "string"
              },
              "communityId": {
                "type": "string"
              },
              "authPage": {
                "type": "string"
              }
            }
          },
          "scopes": {
            "type": "string"
          },
          "authType": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          },
          "createdTS": {
            "type": "integer",
            "description": "Creation time in seconds"
          },
          "expiryTS": {
            "type": "integer",
            "description": "Expiration time in seconds"
          },
          "publicKey": {
            "type": "string",
            "description": "Public Key"
          }
        },
        "xml": {
          "name": "AuthSession"
        }
      },
      "SessionAuthEvent": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "description": "UUID of each SessionAuthEvent"
          },
          "data": {
            "type": "string"
          },
          "appid": {
            "type": "string"
          },
          "ial": {
            "type": "string"
          },
          "publicKey": {
            "type": "string"
          },
          "createdTS": {
            "type": "integer",
            "description": "Creation time in seconds"
          }
        },
        "xml": {
          "name": "SessionAuthEvent"
        }
      },
      "ValidationError": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error content"
          },
          "param": {
            "type": "string",
            "description": "Field name"
          }
        },
        "xml": {
          "name": "ValidationError"
        }
      },
      "PublicKeyResponse": {
        "type": "object",
        "properties": {
          "publicKey": {
            "type": "string"
          }
        },
        "example": {
          "publicKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        }
      },
      "ForbiddenError": {
        "description": "API doesn't have right permissions to call this API"
      },
      "BadRequestError": {
        "description": "Bad request",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "errors": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/ValidationError"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "UnauthorizedError": {
        "description": "API is not authorized to call this API"
      },
      "NotFoundError": {
        "description": "No service Key found"
      },
      "UnsupportedStateError": {
        "description": "Unsupported state or unable to authenticate data",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string",
                  "example": "Unsupported state or unable to authenticate data"
                }
              }
            }
          }
        }
      },
      "NewSessionResponse": {
        "description": "New session created",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "sessionId": {
                  "type": "string",
                  "example": "xxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                }
              }
            }
          }
        }
      },
      "NewSessionRequest": {
        "type": "object",
        "required": [
          "origin",
          "authtype"
        ],
        "properties": {
          "origin": {
            "type": "object",
            "required": [
              "tag",
              "url",
              "communityName",
              "communityId"
            ],
            "properties": {
              "tag": {
                "type": "string",
                "example": "tagName"
              },
              "url": {
                "type": "string",
                "example": "url"
              },
              "communityName": {
                "type": "string",
                "example": "communityName"
              },
              "communityId": {
                "type": "string",
                "example": "community id"
              },
              "authPage": {
                "type": "string"
              }
            }
          },
          "scopes": {
            "type": "string"
          },
          "authtype": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          }
        }
      },
      "HealthzResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "all services operational"
          },
          "publicKey": {
            "type": "string",
            "example": "//same as <service>/publickeys endpoint"
          },
          "code": {
            "type": "string",
            "example": "200"
          },
          "version": {
            "type": "string",
            "example": "xxxx.xxxx.xxxx"
          }
        }
      },
      "GetServiceDirectoryResponse": {
        "type": "object",
        "properties": {
          "name1": {
            "type": "string"
          },
          "name2": {
            "type": "string"
          },
          "name3": {
            "type": "string"
          }
        },
        "example": {
          "name1": "https://xxx.xxxxxx.xxx/xxxxx",
          "name2": "https://xxx.xxxxxx.xxx/xxxxx",
          "name3": "https://xxx.xxxxxx.xxx/xxxxx"
        }
      },
      "CreateSignedNonce": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "publicKey": {
                "type": "string",
                "example": "xxxx"
              },
              "nonce": {
                "type": "string",
                "example": "xxxx"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "authMyPublicKey": {
        "type": "apiKey",
        "name": "authMyPublicKey",
        "in": "header",
        "description": "Caller's ECDSA publicKey"
      },
      "authMyPrivateKey": {
        "type": "apiKey",
        "name": "authMyPrivateKey",
        "in": "header",
        "description": "Caller's ECDSA privateKey"
      },
      "authLicense": {
        "type": "apiKey",
        "name": "authLicense",
        "in": "header",
        "description": "License key from License API"
      },
      "license": {
        "type": "apiKey",
        "name": "license",
        "in": "header",
        "description": "License key from License Microservice"
      }
    }
  },
  "tags": [
    {
      "name": "Environment"
    }
  ]
}