From ec455ec8bdadb9f88615568bc76a1cf221fa269d Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Thu, 12 Mar 2020 15:17:23 -0400
Subject: [PATCH] Change all the names

---
 .github/workflows/ci.yaml                        |  4 ++--
 overlays.nix                                     |  6 +++---
 privacypass-repo.nix                             |  9 ---------
 privacypass.nix                                  | 10 ----------
 python-challenge-bypass-ristretto-repo.nix       |  9 +++++++++
 python-challenge-bypass-ristretto.nix            | 10 ++++++++++
 remove-setuptools-scm.patch                      |  4 ++--
 ristretto.nix                                    |  4 ++--
 setup.cfg                                        |  2 +-
 src/_zkapauthorizer/_plugin.py                   |  2 +-
 src/_zkapauthorizer/_storage_server.py           |  2 +-
 src/_zkapauthorizer/controller.py                | 16 +++++++++-------
 src/_zkapauthorizer/model.py                     |  4 ++--
 src/_zkapauthorizer/tests/privacypass.py         | 10 +++++-----
 src/_zkapauthorizer/tests/test_controller.py     |  8 ++++----
 .../tests/test_storage_protocol.py               |  2 +-
 src/_zkapauthorizer/tests/test_storage_server.py |  2 +-
 zkapauthorizer.nix                               |  4 ++--
 18 files changed, 55 insertions(+), 53 deletions(-)
 delete mode 100644 privacypass-repo.nix
 delete mode 100644 privacypass.nix
 create mode 100644 python-challenge-bypass-ristretto-repo.nix
 create mode 100644 python-challenge-bypass-ristretto.nix

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 0b6af69..67d138e 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -41,9 +41,9 @@ jobs:
       run: |
         python -m pip install wheel coverage
 
-    - name: "Install PrivacyPass master@HEAD"
+    - name: "Install python-challenge-bypass-ristretto master@HEAD"
       run: |
-        python -m pip install git+https://github.com/LeastAuthority/privacypass@master#egg=privacypass
+        python -m pip install git+https://github.com/LeastAuthority/python-challenge-bypass-ristretto@master#egg=python-challenge-bypass-ristretto
 
     - name: "Install Tahoe-LAFS master@HEAD"
       run: |
diff --git a/overlays.nix b/overlays.nix
index c3f9f6a..ed2d8d1 100644
--- a/overlays.nix
+++ b/overlays.nix
@@ -22,9 +22,9 @@ self: super: {
       # re-package it ourselves as a library.
       tahoe-lafs = python-self.callPackage ((import ./tahoe-lafs.nix) + "/nix") { };
 
-      # we depend on the privacypass python library, a set of bindings to the
-      # challenge-bypass-ristretto Rust library
-      privacypass = python-self.callPackage ./privacypass.nix { };
+      # we depend on the challenge-bypass-ristretto python package, a set of
+      # bindings to the challenge-bypass-ristretto Rust crate.
+      challenge-bypass-ristretto = python-self.callPackage ./python-challenge-bypass-ristretto.nix { };
 
       # And add ourselves to the collection too.
       zkapauthorizer = python-self.callPackage ./zkapauthorizer.nix { };
diff --git a/privacypass-repo.nix b/privacypass-repo.nix
deleted file mode 100644
index a37cce7..0000000
--- a/privacypass-repo.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-let
-  pkgs = import <nixpkgs> {};
-in
-  pkgs.fetchFromGitHub {
-    owner = "LeastAuthority";
-    repo = "privacypass";
-    rev = "17ee180eda6dc9ff30d86b9666ee5c0d511434dc";
-    sha256 = "0yz2pdm3q8z7cs0cl8aw3k6x6rb9zq088bvis3f6vaaidzd061h6";
-  }
\ No newline at end of file
diff --git a/privacypass.nix b/privacypass.nix
deleted file mode 100644
index 5b03288..0000000
--- a/privacypass.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ callPackage }:
-let
-  src = import ./privacypass-repo.nix;
-  privacypass = callPackage "${src}" { };
-in
-  privacypass.overrideAttrs (old: {
-    patches = [
-      ./remove-setuptools-scm.patch
-    ];
-  })
diff --git a/python-challenge-bypass-ristretto-repo.nix b/python-challenge-bypass-ristretto-repo.nix
new file mode 100644
index 0000000..de9af87
--- /dev/null
+++ b/python-challenge-bypass-ristretto-repo.nix
@@ -0,0 +1,9 @@
+let
+  pkgs = import <nixpkgs> {};
+in
+  pkgs.fetchFromGitHub {
+    owner = "LeastAuthority";
+    repo = "python-challenge-bypass-ristretto";
+    rev = "e15f0f02d43cd16e712cde26e87b4854bedff5e6";
+    sha256 = "1xrzcf01z2hzhajbnv6csc1dqld8apkvv6x202hjc9y88rb2mmpb";
+  }
\ No newline at end of file
diff --git a/python-challenge-bypass-ristretto.nix b/python-challenge-bypass-ristretto.nix
new file mode 100644
index 0000000..0824d34
--- /dev/null
+++ b/python-challenge-bypass-ristretto.nix
@@ -0,0 +1,10 @@
+{ callPackage }:
+let
+  src = import ./python-challenge-bypass-ristretto-repo.nix;
+  python-challenge-bypass-ristretto = callPackage "${src}" { };
+in
+  python-challenge-bypass-ristretto.overrideAttrs (old: {
+    patches = [
+      ./remove-setuptools-scm.patch
+    ];
+  })
diff --git a/remove-setuptools-scm.patch b/remove-setuptools-scm.patch
index 1ec1586..1149ea6 100644
--- a/remove-setuptools-scm.patch
+++ b/remove-setuptools-scm.patch
@@ -3,7 +3,7 @@ index 6da2d4d..32262dd 100644
 --- a/setup.py
 +++ b/setup.py
 @@ -21,7 +21,7 @@ setup(
-     packages=['privacypass', 'privacypass.tests'],
+     packages=['challenge_bypass_ristretto', 'challenge_bypass_ristretto.tests'],
      zip_safe=False,
      platforms='any',
 -    setup_requires=['milksnake', 'setuptools_scm'],
@@ -15,7 +15,7 @@ index 6da2d4d..32262dd 100644
              "hypothesis",
          ],
      },
--    use_scm_version=True,
+-    use_scm_version=_myversion,
      url='https://github.com/',
      milksnake_tasks=[
          build_native
diff --git a/ristretto.nix b/ristretto.nix
index 4e09128..a2bd2c0 100644
--- a/ristretto.nix
+++ b/ristretto.nix
@@ -1,5 +1,5 @@
 { fetchFromGitHub, callPackage }:
 let
-  src = import ./privacypass-repo.nix { inherit fetchFromGitHub; };
+  src = import ./python-challenge-bypass-ristretto-repo.nix { inherit fetchFromGitHub; };
 in
-  callPackage "${src}/ristretto.nix" { }
+  callPackage "${src}/challenge-bypass-ristretto.nix" { }
diff --git a/setup.cfg b/setup.cfg
index 659b206..51670ee 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -34,7 +34,7 @@ install_requires =
     attrs
     zope.interface
     aniso8601
-    privacypass
+    python-challenge-bypass-ristretto
     # Inherit our Twisted dependency from tahoe-lafs so we don't accidentally
     # get the extras wrong here and break stuff.
     tahoe-lafs
diff --git a/src/_zkapauthorizer/_plugin.py b/src/_zkapauthorizer/_plugin.py
index a1935a5..2ed966d 100644
--- a/src/_zkapauthorizer/_plugin.py
+++ b/src/_zkapauthorizer/_plugin.py
@@ -55,7 +55,7 @@ from allmydata.node import (
 from allmydata.client import (
     _Client,
 )
-from privacypass import (
+from challenge_bypass_ristretto import (
     SigningKey,
 )
 
diff --git a/src/_zkapauthorizer/_storage_server.py b/src/_zkapauthorizer/_storage_server.py
index 8c83282..d8c747b 100644
--- a/src/_zkapauthorizer/_storage_server.py
+++ b/src/_zkapauthorizer/_storage_server.py
@@ -68,7 +68,7 @@ from allmydata.interfaces import (
 from allmydata.storage.common import (
     storage_index_to_dir,
 )
-from privacypass import (
+from challenge_bypass_ristretto import (
     TokenPreimage,
     VerificationSignature,
     SigningKey,
diff --git a/src/_zkapauthorizer/controller.py b/src/_zkapauthorizer/controller.py
index 7553971..a0fa9fc 100644
--- a/src/_zkapauthorizer/controller.py
+++ b/src/_zkapauthorizer/controller.py
@@ -77,7 +77,7 @@ from treq.client import (
     HTTPClient,
 )
 
-import privacypass
+import challenge_bypass_ristretto
 
 from ._base64 import (
     urlsafe_b64decode,
@@ -407,7 +407,9 @@ class RistrettoRedeemer(object):
 
     def random_tokens_for_voucher(self, voucher, count):
         return list(
-            RandomToken(privacypass.RandomToken.create().encode_base64().decode("ascii"))
+            RandomToken(
+                challenge_bypass_ristretto.RandomToken.create().encode_base64().decode("ascii"),
+            )
             for n
             in range(count)
         )
@@ -415,7 +417,7 @@ class RistrettoRedeemer(object):
     @inlineCallbacks
     def redeem(self, voucher, encoded_random_tokens):
         random_tokens = list(
-            privacypass.RandomToken.decode_base64(token.token_value.encode("ascii"))
+            challenge_bypass_ristretto.RandomToken.decode_base64(token.token_value.encode("ascii"))
             for token
             in encoded_random_tokens
         )
@@ -457,19 +459,19 @@ class RistrettoRedeemer(object):
         marshaled_proof = result[u"proof"]
         marshaled_public_key = result[u"public-key"]
 
-        public_key = privacypass.PublicKey.decode_base64(
+        public_key = challenge_bypass_ristretto.PublicKey.decode_base64(
             marshaled_public_key.encode("ascii"),
         )
         self._log.info("Decoded public key")
         clients_signed_tokens = list(
-            privacypass.SignedToken.decode_base64(
+            challenge_bypass_ristretto.SignedToken.decode_base64(
                 marshaled_signed_token.encode("ascii"),
             )
             for marshaled_signed_token
             in marshaled_signed_tokens
         )
         self._log.info("Decoded signed tokens")
-        clients_proof = privacypass.BatchDLEQProof.decode_base64(
+        clients_proof = challenge_bypass_ristretto.BatchDLEQProof.decode_base64(
             marshaled_proof.encode("ascii"),
         )
         with less_limited_stack():
@@ -492,7 +494,7 @@ class RistrettoRedeemer(object):
         assert isinstance(unblinded_tokens, list)
         assert all(isinstance(element, UnblindedToken) for element in unblinded_tokens)
         unblinded_tokens = list(
-            privacypass.UnblindedToken.decode_base64(token.unblinded_token.encode("ascii"))
+            challenge_bypass_ristretto.UnblindedToken.decode_base64(token.unblinded_token.encode("ascii"))
             for token
             in unblinded_tokens
         )
diff --git a/src/_zkapauthorizer/model.py b/src/_zkapauthorizer/model.py
index 114715b..18ce4f0 100644
--- a/src/_zkapauthorizer/model.py
+++ b/src/_zkapauthorizer/model.py
@@ -648,8 +648,8 @@ class UnblindedToken(object):
 
     :ivar unicode unblinded_token: The base64 encoded serialized form of the
         unblinded token.  This can be used to reconstruct a
-        ``privacypass.UnblindedToken`` using that class's ``decode_base64``
-        method.
+        ``challenge_bypass_ristretto.UnblindedToken`` using that class's
+        ``decode_base64`` method.
     """
     unblinded_token = attr.ib(
         validator=attr.validators.and_(
diff --git a/src/_zkapauthorizer/tests/privacypass.py b/src/_zkapauthorizer/tests/privacypass.py
index 63c1f43..fcc3c67 100644
--- a/src/_zkapauthorizer/tests/privacypass.py
+++ b/src/_zkapauthorizer/tests/privacypass.py
@@ -20,7 +20,7 @@ from __future__ import (
     absolute_import,
 )
 
-from privacypass import (
+from challenge_bypass_ristretto import (
     BatchDLEQProof,
     PublicKey,
 )
@@ -29,14 +29,14 @@ def make_passes(signing_key, for_message, random_tokens):
     """
     Create a number of cryptographically correct privacy passes.
 
-    :param privacypass.SigningKey signing_key: The key to use to sign the
-        passes.
+    :param challenge_bypass_ristretto.SigningKey signing_key: The key to use
+        to sign the passes.
 
     :param unicode for_message: The request-binding message with which to
         associate the passes.
 
-    :param list[privacypass.RandomToken] random_tokens: The random tokens to
-        feed in to the pass generation process.
+    :param list[challenge_bypass_ristretto.RandomToken] random_tokens: The
+        random tokens to feed in to the pass generation process.
 
     :return list[unicode]: The privacy passes.  The returned list has one
         element for each element of ``random_tokens``.
diff --git a/src/_zkapauthorizer/tests/test_controller.py b/src/_zkapauthorizer/tests/test_controller.py
index 0dd8bdd..37997ee 100644
--- a/src/_zkapauthorizer/tests/test_controller.py
+++ b/src/_zkapauthorizer/tests/test_controller.py
@@ -82,7 +82,7 @@ from treq.testing import (
     StubTreq,
 )
 
-from privacypass import (
+from challenge_bypass_ristretto import (
     SecurityException,
     PublicKey,
     BlindedToken,
@@ -452,9 +452,9 @@ def ristretto_verify(signing_key, message, marshaled_passes):
     Verify that the given passes were generated in a process that involved a
     signature from the given signing key and using the given message.
 
-    :param privacypass.SigningKey signing_key: A signing key which should have
-        signed some random blinded tokens earlier in the lifecycle of the
-        passes to verify.
+    :param SigningKey signing_key: A signing key which should have signed some
+        random blinded tokens earlier in the lifecycle of the passes to
+        verify.
 
     :param bytes message: Request binding data which is involved in the
         generation of the passes to verify.
diff --git a/src/_zkapauthorizer/tests/test_storage_protocol.py b/src/_zkapauthorizer/tests/test_storage_protocol.py
index 569f852..713a0c3 100644
--- a/src/_zkapauthorizer/tests/test_storage_protocol.py
+++ b/src/_zkapauthorizer/tests/test_storage_protocol.py
@@ -65,7 +65,7 @@ from foolscap.referenceable import (
     LocalReferenceable,
 )
 
-from privacypass import (
+from challenge_bypass_ristretto import (
     RandomToken,
     random_signing_key,
 )
diff --git a/src/_zkapauthorizer/tests/test_storage_server.py b/src/_zkapauthorizer/tests/test_storage_server.py
index c00b4a9..55f4402 100644
--- a/src/_zkapauthorizer/tests/test_storage_server.py
+++ b/src/_zkapauthorizer/tests/test_storage_server.py
@@ -48,7 +48,7 @@ from hypothesis.strategies import (
     one_of,
     just,
 )
-from privacypass import (
+from challenge_bypass_ristretto import (
     RandomToken,
     random_signing_key,
 )
diff --git a/zkapauthorizer.nix b/zkapauthorizer.nix
index abd0315..5b113d7 100644
--- a/zkapauthorizer.nix
+++ b/zkapauthorizer.nix
@@ -1,6 +1,6 @@
 { lib
 , buildPythonPackage, sphinx, git
-, attrs, zope_interface, aniso8601, twisted, tahoe-lafs, privacypass, treq
+, attrs, zope_interface, aniso8601, twisted, tahoe-lafs, challenge-bypass-ristretto, treq
 , fixtures, testtools, hypothesis, pyflakes, coverage
 , hypothesisProfile ? null
 , collectCoverage ? false
@@ -33,7 +33,7 @@ buildPythonPackage rec {
     aniso8601
     twisted
     tahoe-lafs
-    privacypass
+    challenge-bypass-ristretto
     treq
   ];
 
-- 
GitLab