diff --git a/src/_zkapauthorizer/tests/fixtures.py b/src/_zkapauthorizer/tests/fixtures.py index 20b05922495aefce85e12a69941276836840950a..dbb49e6568cae998024e71c866e67e40c88b089f 100644 --- a/src/_zkapauthorizer/tests/fixtures.py +++ b/src/_zkapauthorizer/tests/fixtures.py @@ -1,3 +1,21 @@ +# Copyright 2019 PrivateStorage.io, LLC +# +# 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. + +""" +Common fixtures to let the test suite focus on application logic. +""" + from __future__ import ( absolute_import, ) diff --git a/src/_zkapauthorizer/tests/privacypass.py b/src/_zkapauthorizer/tests/privacypass.py index 9b46fe3832bf1ce57a6852037e9bca5c3fb1fb37..63c1f4386652cc8cb5432e0d522966878c7f926b 100644 --- a/src/_zkapauthorizer/tests/privacypass.py +++ b/src/_zkapauthorizer/tests/privacypass.py @@ -1,3 +1,21 @@ +# Copyright 2019 PrivateStorage.io, LLC +# +# 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. + +""" +Ristretto-flavored PrivacyPass helpers for the test suite. +""" + from __future__ import ( absolute_import, ) @@ -8,6 +26,21 @@ from privacypass import ( ) 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 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. + + :return list[unicode]: The privacy passes. The returned list has one + element for each element of ``random_tokens``. + """ blinded_tokens = list( token.blind() for token