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

# init(seedRepresentation:publicKey:)

Initializes a private key from the seed representation.

## Declaration

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

## Parameters

- `seedRepresentation`: The seed representation of the private key. This parameter needs to be 32 bytes long.
- `publicKey`: The public key associated with the secret key.

## Discussion

Discussion This initializer implements the ML-DSA.KeyGen_internal algorithm (Algorithm 16) of FIPS 204. If a public key is provided, a consistency check is performed between it and the derived public key.

## See Also

### Creating a private key

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