# Method

## verifyDidLogin

```typescript
export async function verifyDidLogin<T extends 'did_login' | 'did_login$Kilt' = 'did_login'>(
  message: HexString | Uint8Array | string,
  data: RequestRpcs<T>[T][1],
  resolver?: DidResolver
): Promise<boolean> {
......
}
```

**Description**

This SDK function aims for helping developers to authenticate User. This should be invoked after using the `didLogin(params)` function in the Provider, `verifyDidLogin(params)` function helps verify whether the User is actually the Owner of the DID.

**Params**

* `message`: the message which the User signed on (this should be the same with the `massage` in `didLogin(params)`)
* `signature`: the signature on that message, started with '0x'
* `publicKey`: the publicKey of User's `AuthenticationKey`, which is contains in the DID info (can be obtained by `getCurrentDid()` function in the Provider.

**Return** `Boolean` -- Whether the signature is actually signed by the User (in other word -- Whether developers should allow the User to login)

**Usage**

Check more details about [this SDK Function on our Github](https://github.com/zCloak-Network/zkid-login/tree/master/packages/verify).

```typescript
import { verifyDidLogin } from '@zcloak/login-verify';

// to sign message
const message = '';

const did = await provider.getCurrentDid();

const signature = await provider.didLogin(message);

// to verify the signature in order to authenticate the user
const result = verifyDidLogin(message, signature, did.authenticationKey);

console.log(result)
```

## verifyCredentialDigest

```typescript
export async function verifyCredentialDigest<
  T extends
    | 'did_requestCredentialDigest'
    | 'did_requestCredentialDigest$Kilt' = 'did_requestCredentialDigest'
>(
  credentialDigest: RequestRpcs<T>[T][1],
  challenge: string,
  owner: T extends 'did_requestCredentialDigest' ? DidUrl : DidUri,
  resolver?: DidResolver
): Promise<boolean> {
......
}
```

**Description**

This [`verifyCredentialDigest`](https://github.com/zCloak-Network/zkid-login/blob/master/packages/verify/src/verifyCredentialDigest.ts#L27) method provided in our SDK can be used to check whether the Digest Disclosure is valid, whether the User is the Credential’s Owner.

**Params**

* `credentialDigest`: the `RequestCredentialDigestReponse` of login-rpc, can be obtained use `did_requestCredentialDigest` method
* `challenge`: a random string, the same with the `challenge` in the `did_requestCredentialDigest` method
* `owner`: the credential owner

**Return**

`boolean` -- The Verification result of the Digest Disclosure

**Usage**

Check more details about [this SDK Function on our Github](https://github.com/zCloak-Network/zkid-login/tree/master/packages/verify).

```typescript
import { verifyCredentialDigest } from '@zcloak/login-verify';

const challenge = '';

const did = await provider.getCurrentDid();

// verify credential digest
const credentialDigest = await provider.requestCredentialDigest(challenge);

const result = await verifyCredentialDigest(credentialDigest, challenge, did.didUri);
```

## verifyCredentialContent

```typescript
export async function verifyCredentialContent<
  T extends
    | 'did_requestCredentialContent'
    | 'did_requestCredentialContent$Kilt' = 'did_requestCredentialContent'
>(
  credential: RequestRpcs<T>[T][1],
  challenge: string,
  owner: T extends 'did_requestCredentialContent' ? DidUrl : DidUri,
  resolver?: DidResolver
): Promise<boolean> {
......
}
```

**Description**

This [`verifyCredentialContent`](https://github.com/zCloak-Network/zkid-login/blob/master/packages/verify/src/verifyCredentialContent.ts#L27) method provided in our SDK can be used to check whether the Selective Disclosure or All Credential Content Disclosure is valid, whether the User is the Credential's Owner.

**Params**

* `credentialDigest`: the `RequestCredentialContentReponse` of login-rpc, can be obtained use `did_requestCredentialContent` method
* `challenge`: a random string, the same with the `challenge` in the `did_requestCredentialDigest` method
* `owner`: the credential owner

**Return**

`boolean` -- The Verification result of the **Selective Disclosure** or **All Credential Content Disclosure**.

**Usage**

Check more details about [this SDK Function on our Github](https://github.com/zCloak-Network/zkid-login/tree/master/packages/verify).

```typescript
import { verifyCredentialContent } from '@zcloak/login-verify';

const challenge = '';

const did = await provider.getCurrentDid();

const credential = await provider.requestCredentialContent(challenge);

// verify credential content
const result = await verifyCredentialContent(credential, challenge, did.didUri);

console.log(result);
```


---

# 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.zkid.app/introduction/method.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.
