Memory

public class Memory

This class is used to securely store values in memory.

  • The size of the memory region in bytes.

    Declaration

    Swift

    public let sizeInBytes: UInt32
  • Allocates a secure memory region. The region is filled with 0xdb.

    Declaration

    Swift

    public init(sizeInBytes: UInt32)

    Parameters

    sizeInBytes

    The size of the memory region in bytes.

  • Copies bytes from a byte array to a secure memory location and wipes the input.

    Declaration

    Swift

    public convenience init(_ bytes: inout Bytes)

    Parameters

    bytes

    The byte array.

  • Read raw bytes memory region.

    Usually you do not need to call this function.

    Declaration

    Swift

    public func withUnsafeBytes<ResultType, ContentType>(body: (UnsafePointer<ContentType>) throws -> ResultType) rethrows -> ResultType

    Parameters

    body

    A code block where the memory region is readable.

    Return Value

    The result from the body code block.