Skip to content
Snippets Groups Projects
Unverified Commit f4b364cc authored by Jean-Paul Calderone's avatar Jean-Paul Calderone Committed by GitHub
Browse files

Merge pull request #49 from PrivateStorageio/update-zkapauthorizer

Bump to branch that fixes the Copyable/ShareStat issue

Also adjust the system tests to account for the new authorization requirements.
parents e48fb3fd 78881a32
No related branches found
No related tags found
No related merge requests found
......@@ -12,11 +12,11 @@ from json import dumps
from time import sleep
def main():
if len(argv) != 4:
if len(argv) != 5:
raise SystemExit(
"usage: %s <client api root> <issuer api root> <voucher>",
"usage: %s <client api root> <client api token path> <issuer api root> <voucher>",
)
clientAPIRoot, issuerAPIRoot, voucher = argv[1:]
clientAPIRoot, clientAPITokenPath, issuerAPIRoot, voucher = argv[1:]
if not clientAPIRoot.endswith("/"):
clientAPIRoot += "/"
if not issuerAPIRoot.endswith("/"):
......@@ -24,11 +24,16 @@ def main():
zkapauthz = clientAPIRoot + "storage-plugins/privatestorageio-zkapauthz-v1"
with open(clientAPITokenPath) as p:
clientAPIToken = p.read().strip()
# Submit a charge to the issuer (which is also the PaymentServer).
charge_response = post(
issuerAPIRoot + "v1/stripe/charge",
dumps(charge_json(voucher)),
headers={"content-type": "application/json"},
headers={
"content-type": "application/json",
},
)
charge_response.raise_for_status()
......@@ -36,6 +41,11 @@ def main():
response = put(
zkapauthz + "/voucher",
dumps({"voucher": voucher}),
headers={
"content-type": "application/json",
"authorization": "tahoe-lafs " + clientAPIToken,
}
)
if response.status_code // 100 != 2:
print("Unexpected response: {}".format(response.content))
......@@ -43,7 +53,12 @@ def main():
# Poll the vouchers list for a while to see it get redeemed.
def find_redeemed_voucher():
response = get(zkapauthz + "/voucher/" + voucher)
response = get(
zkapauthz + "/voucher/" + voucher,
headers={
"authorization": "tahoe-lafs " + clientAPIToken,
},
)
response.raise_for_status()
actual = response.json()
print("Actual response: {}".format(actual))
......
......@@ -230,7 +230,7 @@ in {
#
# Storage appears to be working so try to get a client to speak with it.
#
${runOnNode "client" [ run-client introducerFURL issuerURL ]}
${runOnNode "client" [ run-client "/tmp/client" introducerFURL issuerURL ]}
$client->waitForOpenPort(3456);
# Make sure the fake Stripe API server is ready for requests.
......@@ -245,7 +245,13 @@ in {
# Get some ZKAPs from the issuer.
eval {
${runOnNode "client" [ get-passes "http://127.0.0.1:3456" issuerURL voucher ]}
${runOnNode "client" [
get-passes
"http://127.0.0.1:3456"
"/tmp/client/private/api_auth_token"
issuerURL
voucher
]}
} or do {
my ($code, $log) = $client->execute('cat /tmp/stdout /tmp/stderr');
$client->log($log);
......
......@@ -12,7 +12,7 @@ from subprocess import check_output
from configparser import ConfigParser
def main():
(introducerFURL, issuerURL) = argv[1:]
(nodePath, introducerFURL, issuerURL) = argv[1:]
run(["tahoe", "--version"])
run([
......@@ -21,7 +21,7 @@ def main():
"--shares-happy", "1",
"--shares-total", "1",
"--introducer", introducerFURL,
"/tmp/client",
nodePath,
])
# Add necessary ZKAPAuthorizer configuration bits.
......
......@@ -4,6 +4,6 @@ in
pkgs.fetchFromGitHub {
owner = "PrivateStorageio";
repo = "ZKAPAuthorizer";
rev = "7b4796470764f47f6b2f57d7678cc2311e5bd18e";
sha256 = "1b5z7mha8sak46b2sxdd44hqc0a1wx7frcydzgzs25ncq4a516aa";
rev = "17d66c052bfd08f8d00301cc431a83c70f05db0f";
sha256 = "10ss41lk2mlb3ys7b8dc9dkcdiabkvi8clklkm75llk0g5bkvvss";
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment