Merge remote-tracking branch 'origin/import-master'

Conflicts:
	src/oauth.erl
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
new file mode 100644
index 0000000..1944625
--- /dev/null
+++ b/CHANGELOG.txt
@@ -0,0 +1,35 @@
+v1.2.2 (2011-11-18) 994f3d4
+
+  * Add support for new tagged tuple returned by http_uri:parse/1 (R15B)
+
+
+v1.2.1 (2011-10-17) 7969309
+
+  * Updated to use a constant time algorithm to compare signature strings
+
+
+v1.2.0 (2011-06-23) 29cb478
+
+  * Added oauth:get/3 and oauth:post/3 functions
+
+  * Collapsed into just a single module
+
+
+v1.1.1 (2011-01-29) 18cee77
+
+  * Updated to use the correct request parameter normalization algorithm
+
+
+v1.1.0 (2011-01-24) 3bea612
+
+  * Updated to use the new public key API introduced in R14B (public_key-0.8)
+
+
+v1.0.2 (2010-11-26) d9bfb30
+
+  * Added oauth:get/6 and oauth:post/6 with additional HttpcOptions parameter
+
+
+v1.0.1 (2010-11-26) 2c9269b
+
+  * First version numbered version!
diff --git a/License.txt b/License.txt
new file mode 100644
index 0000000..bb37db3
--- /dev/null
+++ b/License.txt
@@ -0,0 +1,22 @@
+Copyright (c) 2008-2011 Tim Fletcher <http://tfletcher.com/>
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index a334677..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License.  You may obtain a copy
-## of the License at
-##
-##   http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
-## License for the specific language governing permissions and limitations under
-## the License.
-
-oauthebindir = $(localerlanglibdir)/erlang-oauth/ebin
-
-oauth_file_collection = \
-	oauth.app.in \
-    oauth.erl
-
-# Removed oauth_rsa_sha1.beam until we require R12B5 or
-# we add a ./configure option to enable it.
-
-oauthebin_make_generated_file_list = \
-	oauth.app \
-    oauth.beam
-
-oauthebin_DATA = \
-	$(oauthebin_make_generated_file_list)
-
-EXTRA_DIST = \
-	$(oauth_file_collection)
-
-CLEANFILES = \
-    $(oauthebin_make_generated_file_list)
-
-%.app: %.app.in
-	cp $< $@
-
-%.beam: %.erl
-	$(ERLC) $(ERLC_FLAGS) $<
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..d943634
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,57 @@
+An Erlang OAuth implementation.
+
+Quick start (client usage):
+
+  $ make
+  ...
+  $ erl -pa ebin -s crypto -s inets
+  ...
+  1> Consumer = {"key", "secret", hmac_sha1}.
+  ...
+  2> RequestTokenURL = "http://term.ie/oauth/example/request_token.php".
+  ...
+  3> {ok, RequestTokenResponse} = oauth:get(RequestTokenURL, [], Consumer).
+  ...
+  4> RequestTokenParams = oauth:params_decode(RequestTokenResponse).
+  ...
+  5> RequestToken = oauth:token(RequestTokenParams).
+  ...
+  6> RequestTokenSecret = oauth:token_secret(RequestTokenParams).
+  ...
+  7> AccessTokenURL = "http://term.ie/oauth/example/access_token.php".
+  ...
+  8> {ok, AccessTokenResponse} = oauth:get(AccessTokenURL, [], Consumer, RequestToken, RequestTokenSecret).
+  ...
+  9> AccessTokenParams = oauth:params_decode(AccessTokenResponse).
+  ...
+  10> AccessToken = oauth:token(AccessTokenParams).
+  ...
+  11> AccessTokenSecret = oauth:token_secret(AccessTokenParams).
+  ...
+  12> URL = "http://term.ie/oauth/example/echo_api.php".
+  ...
+  13> {ok, Response} = oauth:get(URL, [{"hello", "world"}], Consumer, AccessToken, AccessTokenSecret).
+  ...
+  14> oauth:params_decode(Response).
+  ...
+
+
+Consumer credentials are represented as follows:
+
+  {Key::string(), Secret::string(), plaintext}
+
+  {Key::string(), Secret::string(), hmac_sha1}
+
+  {Key::string(), RSAPrivateKeyPath::string(), rsa_sha1}  % client side
+
+  {Key::string(), RSACertificatePath::string(), rsa_sha1}  % server side
+
+
+The percent encoding/decoding implementations are based on those found in
+the ibrowse library, written by Chandrashekhar Mullaparthi.
+
+Example client/server code is at http://github.com/tim/erlang-oauth-examples.
+
+Unit tests are at http://github.com/tim/erlang-oauth-tests.
+
+Erlang/OTP R14B or greater is required for RSA-SHA1.
diff --git a/THANKS.txt b/THANKS.txt
new file mode 100644
index 0000000..56344c1
--- /dev/null
+++ b/THANKS.txt
@@ -0,0 +1,15 @@
+Thanks to the following for patches and suggestions:
+
+* Fernando Benavides <github.com/elbrujohalcon>
+
+* Jan Lehnardt <github.com/janl>
+
+* Jason Davies <github.com/jasondavies>
+
+* Jebu Ittiachen <github.com/jebu>
+
+* Paul Bonser <github.com/pib>
+
+* Roberto Aloi <github.com/prof3ta>
+
+* naoya_t <github.com/naoyat>
diff --git a/oauth.app.in b/oauth.app.in
deleted file mode 100644
index a8ec17c..0000000
--- a/oauth.app.in
+++ /dev/null
@@ -1,20 +0,0 @@
-{application, oauth, [
-  {description, "Erlang OAuth implementation"},
-  {vsn, "7d85d3ef"},
-  {modules, [
-    oauth,
-    oauth_hmac_sha1,
-    oauth_http,
-    oauth_plaintext,
-    oauth_rsa_sha1,
-    oauth_unix,
-    oauth_uri
-  ]},
-  {registered, []},
-  {applications, [
-    kernel,
-    stdlib,
-    crypto,
-    inets
-  ]}
-]}.
diff --git a/rebar.config b/rebar.config
new file mode 100644
index 0000000..815f982
--- /dev/null
+++ b/rebar.config
@@ -0,0 +1,3 @@
+{erl_opts, [
+  {platform_define, "(R14|R15)", 'no_sha_hmac'}
+]}.
diff --git a/src/oauth.app.src b/src/oauth.app.src
new file mode 100644
index 0000000..ae05b41
--- /dev/null
+++ b/src/oauth.app.src
@@ -0,0 +1,7 @@
+{application, oauth, [
+  {description, "An Erlang OAuth 1.0 implementation"},
+  {vsn, "1.3.0"},
+  {modules, [oauth]},
+  {registered, []},
+  {applications, [kernel, stdlib, crypto, public_key, inets]}
+]}.
diff --git a/oauth.erl b/src/oauth.erl
similarity index 100%
rename from oauth.erl
rename to src/oauth.erl