# Header Parameter

HTTP 헤더는 다음 정보를 포함해야 합니다.

### X-Code-Req-Nonce (Required, Unsigned Integer):

* 중복 요청을 방지하기 위해 요청에 설정하는 임의의 정수입니다.
* 요청을 보내는 쪽에서 단조 증가하는 값이나 요청마다 중복되지 않는 임의의 값을 설정합니다.
* CODE 서버는 100초 이내에 같은 값이 들어오면 오류를 반환합니다.

### X-Code-Req-PubKey (Required, Base64 String):

* 메시지를 보내는 VASP 의 Public key 이며, 중요한 기능은 VASP 인증입니다.
* CODE 에서 사용하는 PubKey 는 정확히는 Signature 를 검증하는 VerifyKey 입니다. 다만, 이 키로부터 암호화/복호화에 사용하는 Public Key 를 계산할 수 있기 때문에 PubKey 라고 지칭합니다.

### \[1.6] X-Code-Req-Remote-PubKey (Optional, Base64 String):

* ***\[v1.6]*** 메시지를 암호화할 때 사용한 수신 VASP 의 Public Key 입니다. CODE 서버로 보내는 요청이나 메시지를 암호화하지 않는 API 일 경우에는 생략합니다.
* ***\[v1.6]*** CODE Central Server 에 등록된 메시지를 수신하는 VASP 의 Public Key 와 이 값이 다르면 오류를 반환합니다. 헤더가 없으면 검증을 하지 않습니다.
* ***\[v1.6]*** 오류를 받은 송신 VASP 는 수신 VASP 의 Public Key 가 변경 됐을 수 있으므로 갱신합니다.

### X-Code-Req-Signature (Required, String):

* (X-Code-Req-Datetime, body, X-Code-Req-Nonce) 순서로 결합하여 byte sequence를 생성하고, 요청을 보내는 호스트의 Private Key 를 사용해서 EdDSA Signing 한 값입니다.
* 자세한 내용은 별도로 배포하는 예제를 참고하시기 바랍니다. (Ed25519 <https://pynacl.readthedocs.io/en/latest/signing/?highlight=Ed25519#ed25519>)
* CODE 서버가 송신 VASP 를 인증하고, 메시지가 변조됐는지 확인하기 위해 사용합니다.
* ***\[v1.6]*** 송신 VASP 가 요청을 보낼 때만 전송하며, 수신 VASP 까지 전달되지 않기 때문에 수신 VASP 는 검증할 수 없습니다.
* ***\[v1.6]*** 수신 VASP 가 응답할 때는 보내지 않습니다.

### X-Code-Req-Datetime (Required, String):

* 요청을 보낸 시각이며 ISO 8601 형식의 UTC 시각입니다. (예. 2022-06-31T23:59:59Z)
* Signature 를 생성할 대상 문자열을 만들 때 포함됩니다.

### X-Request-Origin (Required, String):

* 요청을 보낸 VASP 의 트래블룰 솔루션 얼라이언스명과 얼라이언스 내 VASP 식별자를 ':' 로 붙인 식별자입니다.
* ex. code:coinone, verifyvasp:15952089931162060684


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codevasp.gitbook.io/code-api-docs-ko/api-reference/header-parameter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
