# Message Signature

### 1. Request.signMessage <a href="#id-1.-request.signmessage" id="id-1.-request.signmessage"></a>

**Parameters**

<table><thead><tr><th width="183">Name</th><th width="178.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>chainId</td><td>number</td><td>Chain ID of the particular network</td></tr><tr><td>appName</td><td>string</td><td>Name that will appear in FAVORLET app when signing a message</td></tr><tr><td>from</td><td>string</td><td>Wallet address to sign a message</td></tr><tr><td>message</td><td>string</td><td>message to sign</td></tr></tbody></table>

**Response**

<table><thead><tr><th width="185.33333333333331">Name</th><th width="180">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>string</td><td>ID to track the requested operation or transaction</td></tr><tr><td>expiredAt</td><td>number</td><td>The amount of time (in seconds) that an operation or transaction request expires.</td></tr></tbody></table>

**Example**

```javascript
import { Request } from "favorlet.js";

const response = await Request.signMessage({
  chainId: 8217, // 해당 체인 id
  appName: "BlockChainApp", // FAVORLET 앱에 노출
  from: "0x{address in hex}", // 서명할 지갑 주소
  message: "서명할 메세지", // 서명할 메세지
});

console.log(response);
/*
{
  requestId: "c8393195-b49d-4586-b3fd-0e1a1e94f189",
  expiredAt: 1667891117,
}
*/
```

### 2. createDeepLink <a href="#id-2.-createdeeplink" id="id-2.-createdeeplink"></a>

**Parameters**

<table><thead><tr><th width="185">Type</th><th>Description</th></tr></thead><tbody><tr><td>string</td><td>requestId received when requesting</td></tr></tbody></table>

**Response**

<table><thead><tr><th width="186">Type</th><th>Description</th></tr></thead><tbody><tr><td>string</td><td>DeepLink to the request page within the FAVORLET app</td></tr></tbody></table>

**Example**

```javascript
import { createDeepLink } from "favorlet.js";

const deepLink = createDeepLink(response.requestId); // Request를 통해 받은 requestId

/*
- PC: 생성된 deepLink를 qrcode 라이브러리를 이용하여 QR 생성 후 스마트폰으로 스캔
- Mobile: window.location.href 등을 사용하여 생성된 deepLink로 직접 이동
*/
console.log(deepLink);
// https://app.favorlet.link/?requestId=c8393195-b49d-4586-b3fd-0e1a1e94f189
```

### 3. receipt <a href="#id-3.-receipt" id="id-3.-receipt"></a>

```javascript
import { receipt } from "favorlet.js";

const result = await receipt(response.requestId); // Request를 통해 받은 requestId

console.log(result);
/*
- status에 따라 이후 분기 처리

### requested
{
  requestId: "c8393195-b49d-4586-b3fd-0e1a1e94f189",
  expiredAt: 1667891117,
  action: "signMessage",
  signMessage: {
    status: "requested"
  }
}

### canceled
{
  requestId: "c8393195-b49d-4586-b3fd-0e1a1e94f189",
  expiredAt: 1667891117,
  action: "signMessage",
  signMessage: {
    status: "canceled",
    signature: null,
    errorMessage: null
  }
}

### succeed
{
  requestId: "c8393195-b49d-4586-b3fd-0e1a1e94f189",
  expiredAt: 1667891117,
  action: "signMessage",
  signMessage: {
    status: "succeed",
    signature: "c308c6bc851cdaf8a125b2990753f376e3660f9f98a4c515de9e8c0fbd98f2cf3db519a7ba4dab78d001232b6f55b24896a57e3264cafe3dda78a89ecfb0bb141b",
    errorMessage: null
  }
}
*/
```


---

# 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://docs.favorlet.io/english/dev/app2app/sign.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.
