C# Class ApexLumia.Utils

Show file Open project: ApexHAB/apex-lumia

Public Methods

Method Description
UrlEncodeRelaxed ( string value ) : string

URL encodes a string based on section 5.1 of the OAuth spec. Namely, percent encoding with [RFC3986], avoiding unreserved characters, upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs.

The Uri.EscapeDataString method is supposed to take on RFC 3986 behavior if certain elements are present in a .config file. Even if this actually worked (which in my experiments it doesn't), we can't rely on every host actually having this configuration element present.

base64ify ( string thing ) : string

Encode a string into a Base64 string version.

hmacsha1ify ( string thing, string key ) : byte[]
rfc3339 ( ) : string
sha256ify ( string thing ) : string

Hash a string using SHA256

uniqueAlphanumericString ( ) : string
unix_timestamp ( ) : int

Guess what: it gives you a UNIX timestamp.

Method Details

UrlEncodeRelaxed() public static method

URL encodes a string based on section 5.1 of the OAuth spec. Namely, percent encoding with [RFC3986], avoiding unreserved characters, upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs.
The Uri.EscapeDataString method is supposed to take on RFC 3986 behavior if certain elements are present in a .config file. Even if this actually worked (which in my experiments it doesn't), we can't rely on every host actually having this configuration element present.
public static UrlEncodeRelaxed ( string value ) : string
value string The value to escape.
return string

base64ify() public static method

Encode a string into a Base64 string version.
public static base64ify ( string thing ) : string
thing string The string to encode into a Base64 version.
return string

hmacsha1ify() public static method

public static hmacsha1ify ( string thing, string key ) : byte[]
thing string
key string
return byte[]

rfc3339() public static method

public static rfc3339 ( ) : string
return string

sha256ify() public static method

Hash a string using SHA256
public static sha256ify ( string thing ) : string
thing string The string to hash.
return string

uniqueAlphanumericString() public static method

public static uniqueAlphanumericString ( ) : string
return string

unix_timestamp() public static method

Guess what: it gives you a UNIX timestamp.
public static unix_timestamp ( ) : int
return int