# Interface: MincaConnection

Defined in: [packages/core/src/session/connection.ts:112](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L112)

## Methods

### connect()

```ts
connect(home?): Promise<void>;
```

Defined in: [packages/core/src/session/connection.ts:123](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L123)

Opens the home and asks, with a new key. Call it from a click. Acts for
whichever account the person chooses there: a new one, or one connected
already, whose grant this renews.

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `home?` | `string` | The person's own home — `minca.example.com` is enough. Default: the one in `state.home`. |

#### Returns

`Promise`\<`void`\>

***

### disconnect()

```ts
disconnect(did?): Promise<void>;
```

Defined in: [packages/core/src/session/connection.ts:130](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L130)

Forgets an account's grant and its key (default the one acted for), and
acts for the next connected account, if any. The account is untouched.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `did?` | `string` |

#### Returns

`Promise`\<`void`\>

***

### getState()

```ts
getState(): MincaConnectionState;
```

Defined in: [packages/core/src/session/connection.ts:113](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L113)

#### Returns

[`MincaConnectionState`](https://minca.dev/api/session/interfaces/MincaConnectionState.md)

***

### openHome()

```ts
openHome(section?): void;
```

Defined in: [packages/core/src/session/connection.ts:137](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L137)

Opens the person's account home in a window of its own, at the account
this app acts for: its settings, or a `section` of them such as
`notifications`. The home is never framed, since it holds the keys. Call
it from a click.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `section?` | `string` |

#### Returns

`void`

***

### propose()

```ts
propose(automations): Promise<Proposed>;
```

Defined in: [packages/core/src/session/connection.ts:143](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L143)

Offers the person automations that notify them — "notify me when…" — once connected.
Opens the home; call it from a click.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `automations` | readonly [`AutomationProposal`](https://minca.dev/api/core/interfaces/AutomationProposal.md)[] |

#### Returns

`Promise`\<[`Proposed`](https://minca.dev/api/session/interfaces/Proposed.md)\>

What they kept

***

### start()

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

Defined in: [packages/core/src/session/connection.ts:116](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L116)

Picks up a grant from an earlier visit. Safe to call more than once.

#### Returns

`Promise`\<`void`\>

***

### subscribe()

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

Defined in: [packages/core/src/session/connection.ts:114](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L114)

#### Parameters

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

#### Returns

() => `void`

***

### use()

```ts
use(did): Promise<void>;
```

Defined in: [packages/core/src/session/connection.ts:125](https://github.com/leifriksheim/minca/blob/main/core/src/session/connection.ts#L125)

Acts for another connected account. The home is not asked: its grant is here already.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `did` | `string` |

#### Returns

`Promise`\<`void`\>
