# DID

## DID PreLogin

```csharp
Task<PreLoginResponse> PreLoginAsync(Uri nodeUri, string walletAddress)
```

Input params：

| Name          | Type   | Description         | Required |
| ------------- | ------ | ------------------- | -------- |
| nodeUri       | string | uri of the node     | true     |
| walletAddress | string | user wallet address | true     |

Output params：

| Name                          | Type   | Description                 | Required |
| ----------------------------- | ------ | --------------------------- | -------- |
| PreLoginResponse.Did          | string | user DID                    | true     |
| PreLoginResponse.Message      | string | message to be signed        | true     |
| PreLoginResponse.RandomServer | string | random nonce                | true     |
| PreLoginResponse.Updated      | string | update time of did document | true     |

## DID Login

```csharp
Task<LoginResponse> LoginAsync(string did, string nonce, string updateTime, string message, string signature)
```

Input params：

| Name       | Type   | Description                 | Required |
| ---------- | ------ | --------------------------- | -------- |
| did        | string | user did                    | true     |
| nonce      | string | random nonce                | true     |
| updateTime | string | update time of did document | true     |
| message    | string | message to be signed        | true     |
| signature  | string | signature of the message    | true     |

Output params：

| Name                      | Type   | Description  | Required |
| ------------------------- | ------ | ------------ | -------- |
| LoginResponse.UserId      | string | user did     | true     |
| LoginResponse.AccessToken | string | access token | true     |
| LoginResponse.DeviceId    | string | device id    | true     |
