> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Device ID From Public Key • AI Agent SDK

> device_id_from_public_key: Return the stable device id: hex SHA-256 of the raw public-key bytes.

# device\_id\_from\_public\_key

Function

> This function is defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

Return the stable device id: hex SHA-256 of the raw public-key bytes.

`public_key` must be standard base64 (RFC 4648, padded, no whitespace) of
the raw key bytes. Hashing the decoded bytes keeps the id independent of
how a client spells the encoding. Raises `ValueError` on invalid base64.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def device_id_from_public_key(public_key: str) -> str
```

## Parameters

**public\_key** `str` *required*

No description available.

### Returns

**Returns** `str`

The result of the operation.

## Uses

* `hexdigest`
* `hashlib.sha256`
* `base64.b64decode`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L362)
>
> `praisonaiagents/gateway/protocols.py` at line 362


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.