---
title: llarp::service::Identity

---

# llarp::service::Identity





## Public Functions

|                | Name           |
| -------------- | -------------- |
| void | **[RegenerateKeys](Classes/structllarp_1_1service_1_1Identity.md#function-regeneratekeys)**() |
| bool | **[BEncode](Classes/structllarp_1_1service_1_1Identity.md#function-bencode)**([llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) const |
| void | **[EnsureKeys](Classes/structllarp_1_1service_1_1Identity.md#function-ensurekeys)**(fs::path fpath, bool needBackup) |
| bool | **[KeyExchange](Classes/structllarp_1_1service_1_1Identity.md#function-keyexchange)**([path_dh_func](Namespaces/namespacellarp.md#using-path-dh-func) dh, [SharedSecret](Classes/structllarp_1_1AlignedBuffer.md) & sharedkey, const [ServiceInfo](Classes/structllarp_1_1service_1_1ServiceInfo.md) & other, const [KeyExchangeNonce](Classes/structllarp_1_1AlignedBuffer.md) & N) const |
| bool | **[DecodeKey](Classes/structllarp_1_1service_1_1Identity.md#function-decodekey)**(const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & key, [llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) |
| std::optional< [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) > | **[EncryptAndSignIntroSet](Classes/structllarp_1_1service_1_1Identity.md#function-encryptandsignintroset)**(const [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) & i, llarp_time_t now) const |
| bool | **[Sign](Classes/structllarp_1_1service_1_1Identity.md#function-sign)**([Signature](Classes/structllarp_1_1Signature.md) & sig, const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & buf) const |
| void | **[Clear](Classes/structllarp_1_1service_1_1Identity.md#function-clear)**()<br>zero out all secret key members  |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| [SecretKey](Classes/structllarp_1_1SecretKey.md) | **[enckey](Classes/structllarp_1_1service_1_1Identity.md#variable-enckey)**  |
| [SecretKey](Classes/structllarp_1_1SecretKey.md) | **[signkey](Classes/structllarp_1_1service_1_1Identity.md#variable-signkey)**  |
| [PrivateKey](Classes/structllarp_1_1PrivateKey.md) | **[derivedSignKey](Classes/structllarp_1_1service_1_1Identity.md#variable-derivedsignkey)**  |
| [PQKeyPair](Classes/structllarp_1_1AlignedBuffer.md) | **[pq](Classes/structllarp_1_1service_1_1Identity.md#variable-pq)**  |
| uint64_t | **[version](Classes/structllarp_1_1service_1_1Identity.md#variable-version)**  |
| [VanityNonce](Classes/structllarp_1_1AlignedBuffer.md) | **[vanity](Classes/structllarp_1_1service_1_1Identity.md#variable-vanity)**  |
| [ServiceInfo](Classes/structllarp_1_1service_1_1ServiceInfo.md) | **[pub](Classes/structllarp_1_1service_1_1Identity.md#variable-pub)**  |

## Public Functions Documentation

### function RegenerateKeys

```cpp
void RegenerateKeys()
```


### function BEncode

```cpp
bool BEncode(
    llarp_buffer_t * buf
) const
```


### function EnsureKeys

```cpp
void EnsureKeys(
    fs::path fpath,
    bool needBackup
)
```


**Parameters**: 

  * **needBackup** determines whether existing keys will be cycled 


### function KeyExchange

```cpp
bool KeyExchange(
    path_dh_func dh,
    SharedSecret & sharedkey,
    const ServiceInfo & other,
    const KeyExchangeNonce & N
) const
```


### function DecodeKey

```cpp
bool DecodeKey(
    const llarp_buffer_t & key,
    llarp_buffer_t * buf
)
```


### function EncryptAndSignIntroSet

```cpp
std::optional< EncryptedIntroSet > EncryptAndSignIntroSet(
    const IntroSet & i,
    llarp_time_t now
) const
```


### function Sign

```cpp
bool Sign(
    Signature & sig,
    const llarp_buffer_t & buf
) const
```


### function Clear

```cpp
void Clear()
```

zero out all secret key members 

## Public Attributes Documentation

### variable enckey

```cpp
SecretKey enckey;
```


### variable signkey

```cpp
SecretKey signkey;
```


### variable derivedSignKey

```cpp
PrivateKey derivedSignKey;
```


### variable pq

```cpp
PQKeyPair pq;
```


### variable version

```cpp
uint64_t version = llarp::constants::proto_version;
```


### variable vanity

```cpp
VanityNonce vanity;
```


### variable pub

```cpp
ServiceInfo pub;
```


-------------------------------

Updated on 2024-11-10 at 05:10:02 +0000