# Translating to CHAPI documentation

## For Wallets

CHAPI exposes four main methods from its two packages:

* `loadOnce` from `credential-handler-polyfill`
* `installHandler` from `web-credential-handler`
* `activeHandler` from `web-credential-handler`
* `receiveCredentialEvent` from `web-credential-handler`

LearnCard exposes three of these methods for you, while implicitly calling `loadOnce` for you at construction time in the CHAPI plugin.

* `learnCard.invoke.installChapiHandler` wraps `installHandler`
* `learnCard.invoke.activateChapiHandler` wraps `activeHandler`
* `learnCard.invoke.receiveChapiEvent` wraps `receiveCredentialEvent`

In the case of `installHandler` and `receiveCredentialEvent`, these two methods are exposed directly, with only types added to help make them easier to use.

When using `activeChapiHandler` instead of `activateHandler`, LearnCard will default the `mediatorOrigin` to `` `https://authn.io/mediator?${encodedURIComponent(window.location.origin)` `` for you. This can be overrided by simply passing in a custom `mediatorOrigin` when calling `activateChapiHandler`.

## For Issuers

The method `storePresentationViaChapi` loosely wraps the `window.navigator.credentials.store` method. However, `learnCard.invoke.storePresentationViaChapi` will automatically convert a raw Verifiable Presentation into the `WebCredential` class for you before calling `window.navigator.credentials.store`.


---

# 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.learncard.com/how-to-guides/implement-flows/chapi/translating-to-chapi-documentation.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.
