-
The minimum size of the key in bytes.
Declaration
Swift
public static let MinimumSizeInBytes: UInt32 -
The maximum size of the key in bytes.
Declaration
Swift
public static let MaximumSizeInBytes: UInt32 -
The default key size in bytes.
Declaration
Swift
public static let DefaultSizeInBytes: UInt32 -
Initialize a new key with a given size.
The size needs to be within the given bounds:
MinimumSizeInBytes≤sizeInBytes≤MaximumSizeInBytes.Declaration
Swift
public init?(sizeInBytes: UInt32)Parameters
sizeInBytesThe size of the key in bytes.
-
Initialize a new key with the default size.
Declaration
Swift
public convenience init() -
Restores a key from a given byte array. The byte array is copied to a secure location and overwritten with zeroes to avoid the key being compromised in memory.
Warning
Do not initialize new keys with this function. If you need a new key, use
init?(sizeInBytes:)instead. This initializer is only to restore secret keys that were persisted.Declaration
Swift
public override init?(bytes: inout Bytes)Parameters
bytesThe key.
-
Restores a key from a given hex string.
Warning
Do not initialize new keys with this function. If you need a new key, use
init?(sizeInBytes:)instead. This initializer is only to restore secret keys that were persisted.See
Data(hex:ignore:)Declaration
Swift
public convenience init?(hex: String, ignore: String? = nil)Parameters
hexThe key as a hex encoded string.
ignoreA character set that should be ignored when decoding the key.
-
Creates a hashing key from other key material.
Precondition
MinimumSizeInBytes≤other.sizeInBytes≤MaximumSizeInBytesDeclaration
Swift
override init(_ other: KeyMaterial)Parameters
otherThe other key material.
View on GitHub
Key Class Reference