# PublicKey.validate

Validates a [`PublicKey.PublicKey`](/api/PublicKey/types#publickey). Returns `true` if valid, `false` otherwise.

## Imports

:::code-group
```ts [Named]
import { PublicKey } from 'ox'
```

```ts [Entrypoint]
import * as PublicKey from 'ox/PublicKey'
```
:::

## Examples

```ts twoslash
import { PublicKey } from 'ox'

const valid = PublicKey.validate({
  prefix: 4,
  y: '0x6e1c1f59ee1cf25b75a8d57b3c89e7e6b3b1da823df8b3b89497f30c1f000000'
})
// @log: false
```

## Definition

```ts
function validate(
  publicKey: ExactPartial<PublicKey>,
  options?: validate.Options,
): boolean
```

**Source:** [src/core/PublicKey.ts](https://github.com/wevm/ox/blob/main/src/core/PublicKey.ts#L568)

## Parameters

### publicKey

* **Type:** `ExactPartial<PublicKey>`

The public key object to assert.

### options

* **Type:** `validate.Options`
* **Optional**

#### options.compressed

* **Type:** `boolean`
* **Optional**

Whether or not the public key should be compressed.

## Return Type

`boolean`
