---
title: "init(seedRepresentation:publicKey:)"
framework: cryptokit
role: symbol
role_heading: Initializer
path: "cryptokit/mlkem768/privatekey/init(seedrepresentation:publickey:)"
---

# init(seedRepresentation:publicKey:)

Initializes a private key from a seed representation and optional public key.

## Declaration

```swift
init<D>(seedRepresentation: D, publicKey: MLKEM768.PublicKey?) throws where D : DataProtocol
```

## Parameters

- `seedRepresentation`: The seed representation d||z, as specified in the ML-KEM.KeyGen_internal(d,z) algorithm (Algorithm 16) of FIPS 203.
- `publicKey`: An optional public key. Pass this to check that the initialized private key is consistent with the public key. The initializer throws if the public key doesn’t match the expected value.

## See Also

### Creating a private key

- [generate()](cryptokit/mlkem768/privatekey/generate().md)
- [init()](cryptokit/mlkem768/privatekey/init().md)
- [init(integrityCheckedRepresentation:)](cryptokit/mlkem768/privatekey/init(integritycheckedrepresentation:).md)
