# @integraledger/lcp/discovery

> The exports of @integraledger/lcp/discovery.

Source: https://lcp.integraledger.com/reference/api/discovery

## Interfaces

### LegalContextDocument

LCP §2.4–§2.5; members in the order of their tables.

#### Properties

| Property                          | Type                | Description                                       |
| --------------------------------- | ------------------- | ------------------------------------------------- |
|  `acceptanceRequired?`            | `boolean`           | -                                                 |
|  `api?`                           | `string`            | -                                                 |
|  `atrHash?`                       | `` `0x${string}` `` | The digest of the document at `terms` (LCP §2.5). |
|  `contact?`                       | `object`            | -                                                 |
| `contact.legal?`                  | `string`            | -                                                 |
| `contact.technical?`              | `string`            | -                                                 |
|  `disputeResolution?`             | `object`            | -                                                 |
| `disputeResolution.catalog?`      | `string`            | -                                                 |
| `disputeResolution.clauseId?`     | `string`            | -                                                 |
| `disputeResolution.contact?`      | `string`            | -                                                 |
| `disputeResolution.jurisdiction?` | `string`            | -                                                 |
| `disputeResolution.method?`       | `string`            | -                                                 |
| `disputeResolution.source?`       | `string`            | -                                                 |
|  `returns?`                       | `string`            | -                                                 |
|  `terms`                          | `string`            | Absolute https URL of the terms document.         |
|  `termsFormat?`                   | `string`            | -                                                 |

## Variables

### MAX\_DOCUMENT\_BYTES

> `const` **MAX\_DOCUMENT\_BYTES**: `65536` = `65_536`

***

### WELL\_KNOWN\_PATH

> `const` **WELL\_KNOWN\_PATH**: `"/.well-known/legal-context.json"` = `"/.well-known/legal-context.json"`

## Functions

### emit()

> **emit**(`document`): `Uint8Array`\<`ArrayBufferLike`> | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)

The document's bytes: its checked members in table order, `atrHash` in lowercase, and no other member.

#### Parameters

| Parameter  | Type                                            |
| ---------- | ----------------------------------------------- |
| `document` | [`LegalContextDocument`](#legalcontextdocument) |

#### Returns

`Uint8Array`\<`ArrayBufferLike`> | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)

***

### parse()

> **parse**(`bytes`): [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | \{ `document`: [`LegalContextDocument`](#legalcontextdocument); `ignored`: `string`\[]; }

One UTF-8 JSON object of at most `MAX_DOCUMENT_BYTES`, checked as LCP §2 states. Unknown members, at the top level or
inside `disputeResolution` and `contact`, are left out of `document` and named in `ignored` by dotted path.

#### Parameters

| Parameter | Type         |
| --------- | ------------ |
| `bytes`   | `Uint8Array` |

#### Returns

[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | \{ `document`: [`LegalContextDocument`](#legalcontextdocument); `ignored`: `string`\[]; }
