Functions

The following functions are available globally.

  • Low level decoding of base 64 byte arrays

    Declaration

    Objective-C

    void *UA_NewBase64Decode(const char *inputBuffer, size_t length,
                             size_t *outputLength)

    Swift

    func UA_NewBase64Decode(_ inputBuffer: UnsafePointer<Int8>!, _ length: Int, _ outputLength: UnsafeMutablePointer<Int>!) -> UnsafeMutableRawPointer!

    Parameters

    inputBuffer

    Pointer to a char array where the data to be decoded resides

    length

    Length of inputBuffer array

    outputLength

    Address of variable to write in length of decoded array

    Return Value

    void* to an array containing the decoded data

  • Low level encoding of base 64 byte arrays from an input array

    Declaration

    Objective-C

    char *UA_NewBase64Encode(const void *inputBuffer, size_t length,
                             _Bool separateLines, size_t *outputLength)

    Swift

    func UA_NewBase64Encode(_ inputBuffer: UnsafeRawPointer!, _ length: Int, _ separateLines: Bool, _ outputLength: UnsafeMutablePointer<Int>!) -> UnsafeMutablePointer<Int8>!

    Parameters

    inputBuffer

    Pointer to a char array, or any arbitrary array of Byte size data

    length

    Length of input buffer

    separateLines

    Whether to separate lines of text during encoding

    outputLength

    Pointer to variable where length of returned array will reside

    Return Value

    pointer to an array of converted data

  • Returns an NSData object of decoded 64 bit values, could be turned into a byte array, or directly into a NSString

    Declaration

    Objective-C

    NSData *UA_dataFromBase64String(NSString *aString)

    Swift

    func UA_dataFromBase64String(_ aString: String!) -> Data!

    Parameters

    aString

    base 64 encoded NSString that needs to be decoded

    Return Value

    NSData object containing decoded data which can be converted to a byte array or NSString, uses NSASCIIStringEncoding

  • Takes a byte array filled with ASCII encoded representation of data, for our purposes this is a NSString of the app key or secret converted to an NSData object

    Declaration

    Objective-C

    NSString *UA_base64EncodedStringFromData(NSData *data)

    Swift

    func UA_base64EncodedStringFromData(_ data: Data!) -> String!

    Parameters

    data

    NSData representation of a string that needs to be converted to base 64 encoding, expects NSASCIIStringEncoding

    Return Value

    NSString, base 64 encoded using NSASCIIStringEncoding