{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "version": {
      "type": "number",
      "const": 1,
      "description": "Versão do contrato. Hoje: 1."
    },
    "extends": {
      "description": "Perfil(is) de partida: moatgator:recommended, moatgator:strict ou moatgator:pix-shield. Depois o que o arquivo definir vale por cima.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "moatgator:recommended",
            "moatgator:strict",
            "moatgator:pix-shield"
          ]
        },
        {
          "minItems": 1,
          "maxItems": 3,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "moatgator:recommended",
              "moatgator:strict",
              "moatgator:pix-shield"
            ]
          }
        }
      ]
    },
    "app": {
      "type": "object",
      "properties": {
        "android": {
          "type": "object",
          "properties": {
            "package": {
              "type": "string",
              "pattern": "^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)+$",
              "description": "Nome do pacote Android."
            }
          },
          "required": [
            "package"
          ],
          "additionalProperties": false
        },
        "ios": {
          "type": "object",
          "properties": {
            "bundleId": {
              "type": "string",
              "pattern": "^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$",
              "description": "Bundle ID do app iOS."
            }
          },
          "required": [
            "bundleId"
          ],
          "additionalProperties": false
        }
      },
      "additionalProperties": false,
      "description": "Identifica o app."
    },
    "shield": {
      "description": "Endurecimento do binário.",
      "type": "object",
      "properties": {
        "strings": {
          "description": "Criptografa strings sensíveis do app.",
          "type": "boolean"
        },
        "assets": {
          "description": "Protege assets embutidos.",
          "type": "boolean"
        },
        "names": {
          "description": "Ofusca nomes de classes, métodos e campos.",
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "runtime": {
      "type": "object",
      "properties": {
        "root": {
          "description": "Aparelho com root ou jailbreak. Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "emulator": {
          "description": "Execução em emulador. Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "debugger": {
          "description": "Depurador anexado. Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "hooking": {
          "description": "Frameworks de instrumentação (Frida, Xposed). Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "tamper": {
          "description": "Pacote ou assinatura adulterados. Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "overlay": {
          "description": "Sobreposição sobre telas sensíveis (Pix Shield). `block_sensitive_screens` bloqueia só essas telas. Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "a11y": {
          "description": "Abuso de acessibilidade (Pix Shield). Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "capture": {
          "description": "Captura ou gravação de tela (Pix Shield). Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        },
        "remote_access": {
          "description": "Acesso remoto (Pix Shield). Respostas: monitor | warn | block | terminate.",
          "type": "string",
          "enum": [
            "monitor",
            "warn",
            "block",
            "block_sensitive_screens",
            "terminate",
            "end_session"
          ]
        }
      },
      "additionalProperties": false,
      "description": "Uma resposta por detecção. O que não for listado fica em `monitor` (ou no que o perfil `extends` definir)."
    },
    "attest": {
      "description": "Atestação (Attest).",
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Liga a atestação de integridade do app e do aparelho."
        }
      },
      "required": [
        "enabled"
      ],
      "additionalProperties": false
    },
    "pulse": {
      "description": "Telemetria e alertas (Pulse).",
      "type": "object",
      "properties": {
        "alerts": {
          "type": "object",
          "properties": {
            "slack": {
              "description": "Canal do Slack que recebe os alertas.",
              "type": "string",
              "pattern": "^#[a-z0-9][a-z0-9_-]{0,79}$"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "network": {
      "description": "Rede.",
      "type": "object",
      "properties": {
        "pinning": {
          "description": "Certificate pinning: `true`/`false` ou a lista de pins.",
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "object",
              "properties": {
                "pins": {
                  "minItems": 1,
                  "maxItems": 10,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^sha256\\/[A-Za-z0-9+/]{43}=$"
                  },
                  "description": "Impressões SHA-256 de chaves públicas aceitas (inclua uma de reserva)."
                }
              },
              "required": [
                "pins"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "env": {
      "description": "Sobrescritas por ambiente.",
      "type": "object",
      "properties": {
        "production": {
          "type": "object",
          "properties": {
            "shield": {
              "description": "Endurecimento do binário.",
              "type": "object",
              "properties": {
                "strings": {
                  "description": "Criptografa strings sensíveis do app.",
                  "type": "boolean"
                },
                "assets": {
                  "description": "Protege assets embutidos.",
                  "type": "boolean"
                },
                "names": {
                  "description": "Ofusca nomes de classes, métodos e campos.",
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "runtime": {
              "type": "object",
              "properties": {
                "root": {
                  "description": "Aparelho com root ou jailbreak. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "emulator": {
                  "description": "Execução em emulador. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "debugger": {
                  "description": "Depurador anexado. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "hooking": {
                  "description": "Frameworks de instrumentação (Frida, Xposed). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "tamper": {
                  "description": "Pacote ou assinatura adulterados. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "overlay": {
                  "description": "Sobreposição sobre telas sensíveis (Pix Shield). `block_sensitive_screens` bloqueia só essas telas. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "a11y": {
                  "description": "Abuso de acessibilidade (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "capture": {
                  "description": "Captura ou gravação de tela (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "remote_access": {
                  "description": "Acesso remoto (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                }
              },
              "additionalProperties": false,
              "description": "Uma resposta por detecção. O que não for listado fica em `monitor` (ou no que o perfil `extends` definir)."
            },
            "attest": {
              "description": "Atestação (Attest).",
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean",
                  "description": "Liga a atestação de integridade do app e do aparelho."
                }
              },
              "required": [
                "enabled"
              ],
              "additionalProperties": false
            },
            "pulse": {
              "description": "Telemetria e alertas (Pulse).",
              "type": "object",
              "properties": {
                "alerts": {
                  "type": "object",
                  "properties": {
                    "slack": {
                      "description": "Canal do Slack que recebe os alertas.",
                      "type": "string",
                      "pattern": "^#[a-z0-9][a-z0-9_-]{0,79}$"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false
            },
            "network": {
              "description": "Rede.",
              "type": "object",
              "properties": {
                "pinning": {
                  "description": "Certificate pinning: `true`/`false` ou a lista de pins.",
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "pins": {
                          "minItems": 1,
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^sha256\\/[A-Za-z0-9+/]{43}=$"
                          },
                          "description": "Impressões SHA-256 de chaves públicas aceitas (inclua uma de reserva)."
                        }
                      },
                      "required": [
                        "pins"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Valores que valem só neste ambiente e têm prioridade sobre o resto."
        },
        "staging": {
          "type": "object",
          "properties": {
            "shield": {
              "description": "Endurecimento do binário.",
              "type": "object",
              "properties": {
                "strings": {
                  "description": "Criptografa strings sensíveis do app.",
                  "type": "boolean"
                },
                "assets": {
                  "description": "Protege assets embutidos.",
                  "type": "boolean"
                },
                "names": {
                  "description": "Ofusca nomes de classes, métodos e campos.",
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "runtime": {
              "type": "object",
              "properties": {
                "root": {
                  "description": "Aparelho com root ou jailbreak. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "emulator": {
                  "description": "Execução em emulador. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "debugger": {
                  "description": "Depurador anexado. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "hooking": {
                  "description": "Frameworks de instrumentação (Frida, Xposed). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "tamper": {
                  "description": "Pacote ou assinatura adulterados. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "overlay": {
                  "description": "Sobreposição sobre telas sensíveis (Pix Shield). `block_sensitive_screens` bloqueia só essas telas. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "a11y": {
                  "description": "Abuso de acessibilidade (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "capture": {
                  "description": "Captura ou gravação de tela (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "remote_access": {
                  "description": "Acesso remoto (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                }
              },
              "additionalProperties": false,
              "description": "Uma resposta por detecção. O que não for listado fica em `monitor` (ou no que o perfil `extends` definir)."
            },
            "attest": {
              "description": "Atestação (Attest).",
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean",
                  "description": "Liga a atestação de integridade do app e do aparelho."
                }
              },
              "required": [
                "enabled"
              ],
              "additionalProperties": false
            },
            "pulse": {
              "description": "Telemetria e alertas (Pulse).",
              "type": "object",
              "properties": {
                "alerts": {
                  "type": "object",
                  "properties": {
                    "slack": {
                      "description": "Canal do Slack que recebe os alertas.",
                      "type": "string",
                      "pattern": "^#[a-z0-9][a-z0-9_-]{0,79}$"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false
            },
            "network": {
              "description": "Rede.",
              "type": "object",
              "properties": {
                "pinning": {
                  "description": "Certificate pinning: `true`/`false` ou a lista de pins.",
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "pins": {
                          "minItems": 1,
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^sha256\\/[A-Za-z0-9+/]{43}=$"
                          },
                          "description": "Impressões SHA-256 de chaves públicas aceitas (inclua uma de reserva)."
                        }
                      },
                      "required": [
                        "pins"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Valores que valem só neste ambiente e têm prioridade sobre o resto."
        },
        "development": {
          "type": "object",
          "properties": {
            "shield": {
              "description": "Endurecimento do binário.",
              "type": "object",
              "properties": {
                "strings": {
                  "description": "Criptografa strings sensíveis do app.",
                  "type": "boolean"
                },
                "assets": {
                  "description": "Protege assets embutidos.",
                  "type": "boolean"
                },
                "names": {
                  "description": "Ofusca nomes de classes, métodos e campos.",
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "runtime": {
              "type": "object",
              "properties": {
                "root": {
                  "description": "Aparelho com root ou jailbreak. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "emulator": {
                  "description": "Execução em emulador. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "debugger": {
                  "description": "Depurador anexado. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "hooking": {
                  "description": "Frameworks de instrumentação (Frida, Xposed). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "tamper": {
                  "description": "Pacote ou assinatura adulterados. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "overlay": {
                  "description": "Sobreposição sobre telas sensíveis (Pix Shield). `block_sensitive_screens` bloqueia só essas telas. Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "a11y": {
                  "description": "Abuso de acessibilidade (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "capture": {
                  "description": "Captura ou gravação de tela (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                },
                "remote_access": {
                  "description": "Acesso remoto (Pix Shield). Respostas: monitor | warn | block | terminate.",
                  "type": "string",
                  "enum": [
                    "monitor",
                    "warn",
                    "block",
                    "block_sensitive_screens",
                    "terminate",
                    "end_session"
                  ]
                }
              },
              "additionalProperties": false,
              "description": "Uma resposta por detecção. O que não for listado fica em `monitor` (ou no que o perfil `extends` definir)."
            },
            "attest": {
              "description": "Atestação (Attest).",
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean",
                  "description": "Liga a atestação de integridade do app e do aparelho."
                }
              },
              "required": [
                "enabled"
              ],
              "additionalProperties": false
            },
            "pulse": {
              "description": "Telemetria e alertas (Pulse).",
              "type": "object",
              "properties": {
                "alerts": {
                  "type": "object",
                  "properties": {
                    "slack": {
                      "description": "Canal do Slack que recebe os alertas.",
                      "type": "string",
                      "pattern": "^#[a-z0-9][a-z0-9_-]{0,79}$"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false
            },
            "network": {
              "description": "Rede.",
              "type": "object",
              "properties": {
                "pinning": {
                  "description": "Certificate pinning: `true`/`false` ou a lista de pins.",
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "pins": {
                          "minItems": 1,
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^sha256\\/[A-Za-z0-9+/]{43}=$"
                          },
                          "description": "Impressões SHA-256 de chaves públicas aceitas (inclua uma de reserva)."
                        }
                      },
                      "required": [
                        "pins"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false,
          "description": "Valores que valem só neste ambiente e têm prioridade sobre o resto."
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "version",
    "app"
  ],
  "additionalProperties": false,
  "description": "moatgator.yml: política de proteção como código.",
  "$id": "https://api.moatgator.com/v1/schema/moatgator.json",
  "title": "moatgator.yml"
}
