[**@sodot/sodot-node-sdk**](/node/api-ref) • **Docs**

***

[@sodot/sodot-node-sdk](/node/api-ref) / EcdsaPublicKey

# Class: EcdsaPublicKey

An ECDSA public key, generated by the [ECDSA.keygen](/node/api-ref/classes/Ecdsa#keygen) function.
You can get the compressed form (33 bytes) via the `serializeCompressed` function,
or the uncompressed form (65 bytes) via the `serializeUncompressed` function.

## Constructors

### new EcdsaPublicKey()

> **new EcdsaPublicKey**(`pubkey`): [`EcdsaPublicKey`](/node/api-ref/classes/EcdsaPublicKey)

#### Parameters

• **pubkey**: `string` | `Uint8Array`

The uncompressed public key as a Uint8Array or a hex string. If the Uint8Array is 65 bytes long (SEC1 encoding), the first byte will be ignored.

#### Returns

[`EcdsaPublicKey`](/node/api-ref/classes/EcdsaPublicKey)

A new EcdsaPublicKey object

## Methods

### pubKeyAsHex()

> **pubKeyAsHex**(): `string`

#### Returns

`string`

The public key as a hex string.

***

### serializeCompressed()

> **serializeCompressed**(): `Uint8Array`

#### Returns

`Uint8Array`

The compressed public key as a Uint8Array of length 33.

***

### serializeUncompressed()

> **serializeUncompressed**(): `Uint8Array`

#### Returns

`Uint8Array`

The uncompressed public key as a Uint8Array of length 65.
