---
updatedAt: 2025-07-26T15:36:16.000Z
agentTools:
  projectIndex: https://docs.metakeep.xyz/llms.txt
---

# User Public Key (SDK)

## Getting the Public Key

The `getWallet` function in the SDK returns the `public key` of the user's asymmetric key pair.  The user might be asked to **go through a verification process** before the `public key` is returned.

This function returns the same response as the [`User Public Key`](https://docs.metakeep.xyz/reference/cryptography-asymmetric-v3getpublickey)  API endpoint.

```json Sample Response
{
    "status": "SUCCESS",
    "wallet": {
        "publicKey": "0x5fce1e85aa30d8b96bc3737f896d7b5b2a3ff47dc85b919fea052b282170cb0d"
    }
}
```

> 📘 Use [`User Public Key`](https://docs.metakeep.xyz/reference/cryptography-asymmetric-v3getpublickey)  API endpoint instead
>
> For lower user friction, we recommend using the [`User Public Key`](https://docs.metakeep.xyz/reference/cryptography-asymmetric-v3getpublickey) API endpoint instead of the SDK. The [`User Public Key`](https://docs.metakeep.xyz/reference/cryptography-asymmetric-v3getpublickey) API endpoint doesn't require user verification.
>
> **The SDK operation will always require user verification unless you[provide a user](https://docs.metakeep.xyz/reference/mobile-sdk-101#initializing-the-library) when initializing the SDK**

## Public key format

The public key is returned as the compressed `EdDSA` public key in hex format as defined in [RFC 8032](https://tools.ietf.org/html/rfc8032).

## Calling SDK

Here are some sample code snippets to call the SDK:

```javascript Web SDK
await sdk.getWallet();
```
```kotlin Android SDK - Kotlin
sdk.getWallet(
    Callback(
        onSuccess = { response: JsonResponse ->
            Log.d("onSuccess", response.toString())
        },
        onFailure = { error: JsonResponse ->
            Log.d("onFailure", error.toString())
        },
    ),
)

```
```swift iOS SDK - Swift
sdk.getWallet(
  callback: Callback(
    onSuccess: { (result: JsonResponse) in
      print("onSuccess")
      print(result.description)
    },
    onFailure: { (error: JsonResponse) in
      print("onFailure")
      print(error.description)
    }
  )
)
```
```javascript React Native SDK
await sdk.getWallet();
```
```javascript Flutter SDK
await sdk.getWallet();
```

On success, the callback `onSuccess` or the `Promise resolve` function is called with the response as a `JSON` object. This is what the data looks like:

```json Successful response from SDK
{
    "status": "SUCCESS",
    "wallet": {
        "publicKey": "0x5fce1e85aa30d8b96bc3737f896d7b5b2a3ff47dc85b919fea052b282170cb0d"
    }
}
```

Here's a reference implementation of this code for JS SDK: <https://jsfiddle.net/passbird/n86yhre5/>

## Error status

Callback `onFailure` or the `Promise reject` function is called when the user cancels the operation or if there's an error. The error object contains a status field, a string indicating the status of the operation. Here's what the error object looks like:

```json Error object
{
  status: "USER_REQUEST_DENIED"
}
```

Here's a table of all possible error status returned by the SDK

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Status
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        USER\_REQUEST\_DENIED
      </td>

      <td>
        The user has denied the request.
      </td>
    </tr>

    <tr>
      <td>
        INVALID\_EMAIL
      </td>

      <td>
        The SDK has been initialized with an invalid user email.
      </td>
    </tr>

    <tr>
      <td>
        APP\_ID\_REQUIRED
      </td>

      <td>
        No app-id was provided when initializing the SDK.
        You can find the app id in the MetaKeep Developer Console.
      </td>
    </tr>

    <tr>
      <td>
        APP\_NOT\_FOUND
      </td>

      <td>
        The provided app-id is invalid.
        You can find the correct app-id in the MetaKeep Developer Console.
      </td>
    </tr>

    <tr>
      <td>
        SOMETHING\_WENT\_WRONG
      </td>

      <td>
        An unknown error occurred.
        Please get in touch with us if you continue seeing this error.
      </td>
    </tr>
  </tbody>
</Table>

<br />

***

© 2025 Passbird Research, Inc. All rights reserved. This documentation and underlying technology are protected by patents, trademarks, and intellectual property rights under U.S. and international law.

***

&#x20;