PrivateKey
public struct PrivateKey : ECPrivateKey, DiffieHellmanKeyAgreement
Undocumented
-
Generates a new X25519 private key.
Declaration
Swift
public init()
-
Returns the associated X25519 public key.
Declaration
Swift
public var publicKey: PublicKey { get }
Return Value
The public key
-
Initializes the key with data.
Declaration
Swift
public init<D>(rawRepresentation: D) throws where D : ContiguousBytes
Parameters
data
The 32-bytes representation of the private key.
-
Performs an elliptic curve Diffie-Hellmann key agreement over X25519.
Throws
Throws if the operation failed to be performed.Declaration
Swift
public func sharedSecretFromKeyAgreement(with publicKeyShare: PublicKey) throws -> SharedSecret
Parameters
publicKeyShare
The public key share to perform the key agreement with.
Return Value
The shared secret
-
A data representation of the private key
Declaration
Swift
public var rawRepresentation: Data { get }