{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "https://osnmalib.eu/json-schema.json",
  "title": "OSNMAlib Status Log",
  "description": "Format of the JSON status log generated by OSNMAlib.",

  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "metadata": {
        "description": "General information related to the subframe",
        "type": "object",
        "properties": {
          "GST_subframe": {
            "description": "Galileo Satellite Time at the start of the reception of the subframe. [WN, ToW]",
            "type": "array",
            "additionalItems": false,
            "items": [
              {
                "type": "integer"
              },
              {
                "type": "integer"
              }
            ]
          },
          "input_module": {
            "description": "OSNMAlib input module used to receive the navigation data.",
            "type": "string"
          },
          "OSNMAlib_status": {
            "description": "Status of OSNMAlib as a library regarding the possession of cryptographic material.",
            "type": "string",
            "enum": [
              "COLD_START",
              "WARM_START",
              "HOT_START",
              "STARTED",
              "OSNMA_AM"
            ]
          }
        }
      },
      "OSNMA_status": {
        "description": "Information on the last authenticated status of OSNMA.",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "nma_status": {
            "description": "Indicates the OSNMA status, the Chain in Force, and the Chain and Public Key status. It is null if the receiver has not yet fully started.",
            "type": "object",
            "properties": {
              "nmas": {
                "description": "OSNMA status. It is updated from KROOT and Tag authentication.",
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "TEST",
                  "OPERATIONAL",
                  "DONT_USE",
                  null
                ]
              },
              "cid": {
                "description": "ID of the TESLA chain in force.",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "cpks": {
                "description": "Chain and public key status.",
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "NOMINAL",
                  "EOC",
                  "CREV",
                  "NPK",
                  "PKREV",
                  "NMT",
                  "AM",
                  null
                ]
              }
            }
          },
          "tesla_chain_in_force": {
            "description": "Information about the TESLA Chain currently in use by OSNMA. It may be null during revocation of cryptographic material.",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "pkid": {
                "type": "integer"
              },
              "cidkr": {
                "type": "integer"
              },
              "hf": {
                "type": "string",
                "enum": [
                  "SHA_256",
                  "SHA3_224",
                  "SHA3_256"
                ]
              },
              "mf": {
                "type": "string",
                "enum": [
                  "HMAC_SHA_256",
                  "CMAC_AES"
                ]
              },
              "ks": {
                "type": "integer"
              },
              "ts": {
                "type": "integer"
              },
              "maclt": {
                "type": "integer"
              },
              "maclt_sequence": {
                "type": "array"
              }
            }
          },
          "public_key_in_force": {
            "description": "Information about the Public Key currently used in OSNMA. May be null during revocation of cryptographic material.",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "npkid": {
                "type": "integer"
              },
              "npkt": {
                "type": "string",
                "enum": [
                  "ECDSA_P256",
                  "ECDSA_P521",
                  "OAM"
                ]
              },
              "mid": {
                "type": "integer"
              }
            }
          }
        }
      },
      "OSNMA_material_received": {
        "description": "OSNMA material (HKROOT and MACK) received from each satellite transmitting OSNMA. The list contains all OSNMA active satellites during the subframe: satellites with a page with the OSNMA bits different than 0.",
        "type": "object",
        "patternProperties": {
          "^[0-9]+$": {
            "type": "object",
            "properties": {
              "hkroot_data": {
                "description": "The nma_header and dms_header are null if the pages containing them were not received. Note that these values may not be authenticated.",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "nma_header": {
                    "description": "First page of the subframe which contains the Navigation Message Authentication (NMA) information.",
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "nmas": {
                        "description": "OSNMA status",
                        "type": "string",
                        "enum": [
                          "TEST",
                          "OPERATIONAL",
                          "DONT_USE"
                        ]
                      },
                      "cid": {
                        "description": "ID of the TESLA chain in force",
                        "type": "integer"
                      },
                      "cpks": {
                        "description": "Chain and public key status",
                        "type": "string",
                        "enum": [
                          "NOMINAL",
                          "EOC",
                          "CREV",
                          "NPK",
                          "PKREV",
                          "NMT",
                          "AM"
                        ]
                      }
                    }
                  },
                  "dsm_header": {
                    "description": "Second page of the subframe, which contains the Digital Signature Message (DSM) information.",
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "dsm_id": {
                        "type": "integer"
                      },
                      "block_id": {
                        "type": "integer"
                      }
                    }
                  },
                  "dsm_block_pages": {
                    "description": "Last 13 pages that constitute a block of the Digital Signature Message. True if received, false otherwise.",
                    "type": "array",
                    "minItems": 13,
                    "maxItems": 13,
                    "items": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "mack_data": {
                "description": "OSNMA information received in the MACK section. The TESLA Key and any of the tags may be null if not received.",
                "type": "object",
                "properties": {
                  "tesla_key": {
                    "description": "Received TESLA Key in hex encoding.",
                    "type": ["string", "null"]
                  },
                  "tags": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "description": "Each tag is encoded as: [PRN_A, ADKD, COP, FLEX?]. To be updated to an object.",
                      "type": ["array", "null"],
                      "minItems": 3,
                      "maxItems": 4,
                      "items": [
                        {
                          "type": "integer"
                        },
                        {
                          "type": "integer"
                        },
                        {
                          "type": "integer"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "nav_data_received": {
        "description": "OSNMA relevant navigation data received during this subframe from the tracked satellites. The list contains all satellites for which a page was received during the subframe, even if all OSNMA relevant pages were lost.",
        "type": "object",
        "patternProperties": {
          "^[0-9]+$": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "IOD": {
                "description": "Issue Of Data value of this subframe. It can be extracted from Word Type 1, 2, 3, or 4. If none of those is received, it is null.",
                "type": ["null", "string"]
              },
              "ADKD0": {
                "description": "Words types for ADKD0 or ADKD12. True if received, False if not.",
                "type": "object",
                "properties": {
                  "1": {
                    "type": "boolean"
                  },
                  "2": {
                    "type": "boolean"
                  },
                  "3": {
                    "type": "boolean"
                  },
                  "4": {
                    "type": "boolean"
                  },
                  "5": {
                    "type": "boolean"
                  }
                }
              },
              "ADKD4": {
                "description": "Word types for ADKD4. True if received, False if not. Word 10 is null if it was not transmitted on the subframe.",
                "type": "object",
                "properties": {
                  "6": {
                    "type": "boolean"
                  },
                  "10": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "verified_OSNMA_material": {
        "description": "Results of the OSNMA verification process: TESLA Key, MACSeq, Tags, KRoot and Public Key.",
        "type": "object",
        "properties": {
          "tesla_key": {
            "description": "List of all verified (successfully or not) TESLA Keys on this subframe",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "svid": {
                  "type": "integer"
                },
                "value": {
                  "description": "TESLA Key in hex string",
                  "type": "string"
                },
                "verification": {
                  "type": "boolean"
                },
                "reconstructed": {
                  "description": "A TESLA Key may be reconstructed from partially received keys.",
                  "type": "boolean"
                },
                "GST": {
                  "type": "array",
                  "additionalItems": false,
                  "items": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                }
              }
            }
          },
          "macseq": {
            "description": "List of all MACSeq tags verified on this subframe and the FLX tags they validate.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "prn_a": {
                  "type": "integer"
                },
                "verification": {
                  "type": "boolean"
                },
                "GST": {
                  "type": "array",
                  "items": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                },
                "flex_tags": {
                  "description": "Flex tags validated with the MACSeq verification.",
                  "type": "array",
                  "maxItems": 4,
                  "items": {
                    "description": "Each tag is encoded as: [PRN_A, ADKD, COP, FLEX?]. To be updated to an object.",
                    "type": "array",
                    "minItems": 3,
                    "maxItems": 4,
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  }
                }
              }
            }
          },
          "tags": {
            "description": "List of all tags verified during this subframe.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "prn_a": {
                  "type": "integer"
                },
                "prn_d": {
                  "type": "integer"
                },
                "adkd": {
                  "type": "integer"
                },
                "cop": {
                  "type": "integer"
                },
                "flx": {
                  "type": "boolean"
                },
                "verification": {
                  "type": "boolean"
                },
                "GST": {
                  "type": "array",
                  "items": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                }
              }
            }
          },
          "last_kroot": {
            "description": "Last verified KRoot message. It may not contain the Tesla Chain in force during cryptographic material renewal.",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "verification": {
                "type": "boolean"
              },
              "nma_header": {
                "description": "Each field is encoded in a tuple of [raw value, decoded value | null]",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "nmas": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string",
                        "enum": [
                          "TEST",
                          "OPERATIONAL",
                          "DONT_USE"
                        ]
                      }
                    ]
                  },
                  "cid": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cpks": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string",
                        "enum": [
                          "NOMINAL",
                          "EOC",
                          "CREV",
                          "NPK",
                          "PKREV",
                          "NMT",
                          "AM"
                        ]
                      }
                    ]
                  },
                  "reserved_nmah": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              "fields": {
                "description": "Each field is encoded in a tuple of [raw value, decoded value | null]",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "nb_dk": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "pkid": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cidkr": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reserved1": {
                    "description": "Used to be Number of MACK blocks. It may still show 1 as value.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "hf": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string",
                        "enum": [
                          "SHA_256",
                          "SHA3_224",
                          "SHA3_256"
                        ]
                      }
                    ]
                  },
                  "mf": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string",
                        "enum": [
                          "HMAC_SHA_256",
                          "CMAC_AES"
                        ]
                      }
                    ]
                  },
                  "ks": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "ts": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "maclt": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reserved2": {
                    "description": "Used to be TESLA Key offset, with 0 being 30 seconds. It may still show 0.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "wn_k": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "towh_k": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "alpha": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "kroot": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ds": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "p_dk": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Binary string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          },
          "last_pkr": {
            "description": "Last verified Public Key message. It may not contain the Public Key in force during cryptographic material renewal.",
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "properties": {
              "verification": {
                "type": "boolean"
              },
              "merkle_tree_root": {
                "type": "string"
              },
              "fields": {
                "description": "Each field is encoded in a tuple of [raw value, decoded value | null]",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "nb_dp": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "mid": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "itn1": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "itn2": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "itn3": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "itn4": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "npkt": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string",
                        "enum": [
                          "ECDSA_P256",
                          "ECDSA_P521",
                          "OAM"
                        ]
                      }
                    ]
                  },
                  "npkid": {
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "npk": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Hex string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "p_dp": {
                    "type": "array",
                    "items": [
                      {
                        "description": "Binary string",
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "authenticated_nav_data": {
        "description": "Authenticated navigation data by using the verified OSNMA tags.",
        "type": "object",
        "properties": {
          "ADKD0": {
            "type": "object",
            "patternProperties": {
              "^[0-9]+$": {
                "type": "object",
                "properties": {
                  "iod": {
                    "type": "string"
                  },
                  "acc_length": {
                    "type": "integer"
                  },
                  "start_gst": {
                    "description": "Reception Galileo Satellite Time of the authenticated data.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "last_gst": {
                    "description": "Last Galileo Satellite Time when the authenticated data was received.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  }
                }
              }
            }
          },
          "ADKD4": {
            "type": "object",
            "patternProperties": {
              "^[0-9]+$": {
                "type": "object",
                "properties": {
                  "iod": {
                    "description": "There is no IOD on the ADKD4 data.",
                    "type": "null"
                  },
                  "acc_length": {
                    "type": "integer"
                  },
                  "start_gst": {
                    "description": "Reception Galileo Satellite Time of the authenticated data.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "last_gst": {
                    "description": "Last Galileo Satellite Time when the authenticated data was received.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  }
                }
              }
            }
          },
          "ADKD12": {
            "type": "object",
            "patternProperties": {
              "^[0-9]+$": {
                "type": "object",
                "properties": {
                  "iod": {
                    "type": "string"
                  },
                  "acc_length": {
                    "type": "integer"
                  },
                  "start_gst": {
                    "description": "Reception Galileo Satellite Time of the authenticated data.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "last_gst": {
                    "description": "Last Galileo Satellite Time when the authenticated data was received.",
                    "type": "array",
                    "items": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}




















