Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Initializer

init(key:)

Initializes a new ECDSA.PrivateKey with ECDSA parameters.
init(key: String) throws

Parameters

parameters

The ECDSAParameters tuple containing the x and y coordinates of the public key. These coordinates should be base64 URL encoded strings.

privateKey

A base64 URL encoded string representation of the private key. If provided, it is used to create the private key for the instance. Defaults to nil.

Discussion

Throws

  • JWTError/generic with the identifier ecCoordinates if the x and y coordinates from parameters cannot be interpreted as base64 encoded data.

  • JWTError/generic with the identifier ecPrivateKey if the provided privateKey is non-nil but cannot be interpreted as a valid PrivateKey.

Note

The ECDSAParameters tuple is assumed to have x and y properties that are base64 URL encoded strings representing the respective coordinates of an ECDSA public key.