From eea43443cefa4b9888dc8dc621ee65aa056f0798 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Wed, 9 Oct 2019 09:29:47 -0400 Subject: [PATCH] docs --- src/_zkapauthorizer/tests/fixtures.py | 18 +++++++++++++ src/_zkapauthorizer/tests/privacypass.py | 33 ++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/_zkapauthorizer/tests/fixtures.py b/src/_zkapauthorizer/tests/fixtures.py index 20b0592..dbb49e6 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 9b46fe3..63c1f43 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 -- GitLab