Skip to content

Instantly share code, notes, and snippets.

@PierreRochard
Created January 31, 2016 17:59
Show Gist options
  • Save PierreRochard/9d53d91cd5515b19ba0d to your computer and use it in GitHub Desktop.
Save PierreRochard/9d53d91cd5515b19ba0d to your computer and use it in GitHub Desktop.
# Install
sudo yum install autoconf automake libtool
sudo pip install cython
git clone https://github.com/jedisct1/libsodium
cd libsodium
autoreconf -i
./configure
make && make check
sudo make install
cd ..
git clone https://github.com/rescrv/libmacaroons
cd libmacaroons
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
autoreconf -i
# Edit https://github.com/rescrv/libmacaroons/blob/1558d0641b0b9a2a1b5cf0ec1f8812ca04533799/configure.ac#L42 to be >= '3.4'
./configure --enable-python-bindings
make
sudo make install
export PYTHONPATH="/usr/local/local/lib64/python3.4/site-packages/"
# Test
import macaroons
secret = 'this is our super secret key; only we should know it'
public = 'we used our secret key'
location = 'http://mybank/'
M = macaroons.create(location, secret, public)
M.identifier
M.signature
M.serialize()
print(M.inspect())
# Result
[ec2-user@ip-172-31-43-89 libmacaroons]$ python3
Python 3.4.3 (default, Apr 1 2015, 18:10:40)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import macaroons
>>> secret = 'this is our super secret key; only we should know it'
>>> public = 'we used our secret key'
>>> location = 'http://mybank/'
>>> M = macaroons.create(location, secret, public)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Argument '_location' has incorrect type (expected bytes, got str)
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment