# Interface: P2PNode

Defined in: [packages/core/src/node/types.ts:1035](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1035)

## Properties

| Property | Modifier | Type | Description | Defined in |
| ------ | ------ | ------ | ------ | ------ |
| <a id="property-account"></a> `account` | `readonly` | [`NodeAccount`](https://minca.dev/api/core/interfaces/NodeAccount.md) | The account itself — its name, synced through the account registry | [packages/core/src/node/types.ts:1044](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1044) |
| <a id="property-automations"></a> `automations` | `readonly` | [`NodeAutomations`](https://minca.dev/api/core/interfaces/NodeAutomations.md) | The account's own automations, kept in its registry | [packages/core/src/node/types.ts:1050](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1050) |
| <a id="property-carriers"></a> `carriers` | `readonly` | [`NodeCarriers`](https://minca.dev/api/node/interfaces/NodeCarriers.md) | Nodes that keep the account's spaces online without reading them | [packages/core/src/node/types.ts:1046](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1046) |
| <a id="property-collections"></a> `collections` | `readonly` | [`NodeCollections`](https://minca.dev/api/core/interfaces/NodeCollections.md) | - | [packages/core/src/node/types.ts:1042](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1042) |
| <a id="property-contacts"></a> `contacts` | `readonly` | [`NodeContacts`](https://minca.dev/api/core/interfaces/NodeContacts.md) | People: the account's contact list, and asking to be added | [packages/core/src/node/types.ts:1052](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1052) |
| <a id="property-did"></a> `did` | `readonly` | `string` | The identity this node acts for | [packages/core/src/node/types.ts:1037](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1037) |
| <a id="property-direct"></a> `direct` | `readonly` | [`NodeDirect`](https://minca.dev/api/core/interfaces/NodeDirect.md) | Direct messages: text only some members of a space can read | [packages/core/src/node/types.ts:1054](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1054) |
| <a id="property-hosting"></a> `hosting` | `readonly` | [`NodeHosting`](https://minca.dev/api/core/interfaces/NodeHosting.md) | Hosts the account pays to keep its spaces online | [packages/core/src/node/types.ts:1048](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1048) |
| <a id="property-inbox"></a> `inbox` | `readonly` | [`NodeInbox`](https://minca.dev/api/core/interfaces/NodeInbox.md) | The inbox: how people you share no space with can ask to become your contact | [packages/core/src/node/types.ts:1056](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1056) |
| <a id="property-network"></a> `network` | `readonly` | [`NodeNetwork`](https://minca.dev/api/core/interfaces/NodeNetwork.md) | Relays and connections, for showing why a peer is or is not there | [packages/core/src/node/types.ts:1069](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1069) |
| <a id="property-records"></a> `records` | `readonly` | [`NodeRecords`](https://minca.dev/api/core/interfaces/NodeRecords.md) | - | [packages/core/src/node/types.ts:1041](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1041) |
| <a id="property-sessiondid"></a> `sessionDid` | `readonly` | `string` | The session key that signs and connects; stable for the node's lifetime | [packages/core/src/node/types.ts:1039](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1039) |
| <a id="property-spaces"></a> `spaces` | `readonly` | [`NodeSpaces`](https://minca.dev/api/core/interfaces/NodeSpaces.md) | - | [packages/core/src/node/types.ts:1040](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1040) |

## Methods

### asAgent()

```ts
asAgent(agent): Promise<P2PNode>;
```

Defined in: [packages/core/src/node/types.ts:1074](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1074)

The same node acting as an agent, only in the spaces its note names (`node/api.ts`).

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `agent` | \{ `keys`: `CryptoKeyPair`; `note`: [`Delegation`](https://minca.dev/api/core/interfaces/Delegation.md); \} |
| `agent.keys` | `CryptoKeyPair` |
| `agent.note` | [`Delegation`](https://minca.dev/api/core/interfaces/Delegation.md) |

#### Returns

`Promise`\<`P2PNode`\>

#### Throws

When the note is not an agent's, has run out, or is not made out to `keys`

***

### close()

```ts
close(): Promise<void>;
```

Defined in: [packages/core/src/node/types.ts:1086](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1086)

#### Returns

`Promise`\<`void`\>

***

### delegation()

```ts
delegation(): Delegation;
```

Defined in: [packages/core/src/node/types.ts:1058](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1058)

The delegation the session key currently writes under (root → session)

#### Returns

[`Delegation`](https://minca.dev/api/core/interfaces/Delegation.md)

***

### iceServers()

```ts
iceServers(): Promise<readonly RTCIceServer[]>;
```

Defined in: [packages/core/src/node/types.ts:1060](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1060)

ICE servers for the app's own WebRTC: the configured ones, and a relay's TURN servers

#### Returns

`Promise`\<readonly `RTCIceServer`[]\>

***

### revokeKey()

```ts
revokeKey(key, options?): Promise<boolean>;
```

Defined in: [packages/core/src/node/types.ts:1080](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1080)

Revokes a key of this account in `spaces`, or everywhere the account writes.
True once a peer took each in, or at once without `waitMs`.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `key` | `string` |
| `options?` | `RevokeOptions` & `object` |

#### Returns

`Promise`\<`boolean`\>

***

### revokeSelf()

```ts
revokeSelf(options?): Promise<void>;
```

Defined in: [packages/core/src/node/types.ts:1085](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1085)

Revokes this node's own key everywhere and forgets a lasting one: for signing out

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `options?` | `RevokeOptions` |

#### Returns

`Promise`\<`void`\>

***

### setFileLimits()

```ts
setFileLimits(limits): Promise<void>;
```

Defined in: [packages/core/src/node/types.ts:1067](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1067)

How much of others' files this device fetches before anyone reads them,
and keeps per space, from now on: a person's choice, such as fewer
downloads on a phone. Not kept: give it again each time the node starts.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `limits` | [`FileLimits`](https://minca.dev/api/core/interfaces/FileLimits.md) |

#### Returns

`Promise`\<`void`\>

#### Throws

When either is not a byte count of 0 or more

***

### subscribe()

```ts
subscribe(listener): () => void;
```

Defined in: [packages/core/src/node/types.ts:1075](https://github.com/leifriksheim/minca/blob/main/core/src/node/types.ts#L1075)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `listener` | (`event`) => `void` |

#### Returns

() => `void`
