Skip to content

Commit

Permalink
Merge pull request #76 from cryptimeleon/feature/fix-pseudo-randomness
Browse files Browse the repository at this point in the history
Extract randomness and remove bug with same randomless for different promotions
  • Loading branch information
this-kramer authored Feb 16, 2022
2 parents 4d7b047 + 002cbcd commit bba3365
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 71 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Next Release

- Extract client-side pseudorandomness and include promotionId to PRF input [#76](https://github.com/cryptimeleon/incentive-system/pull/76)
- Add streak and VIP promotion, polishing of the promotion api [71](https://github.com/cryptimeleon/incentive-system/pull/71)
- Integrate promotions to app, ui updates, and project refactoring [#70](https://github.com/cryptimeleon/incentive-system/pull/70)
- Add v1 of service that integrates promotion and the crypto protocols [#65](https://github.com/cryptimeleon/incentive-system/pull/65)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CryptoRepository(
val userKeyPair = cryptoMaterial.ukp
val incentiveSystem = IncentiveSystem(pp)

val joinRequest = incentiveSystem.generateJoinRequest(providerPublicKey, userKeyPair)
val joinRequest = incentiveSystem.generateJoinRequest(providerPublicKey, userKeyPair, promotionParameters)
val joinResponse = cryptoApiService.runIssueJoin(
jsonConverter.serialize(joinRequest.representation),
promotionParameters.promotionId.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FakeCryptoRepository(
override suspend fun runIssueJoin(promotionParameters: PromotionParameters, dummy: Boolean) {
if (!dummy) {
val incentiveSystem = IncentiveSystem(pp)
val joinRequest = incentiveSystem.generateJoinRequest(providerKeyPair.pk, userKeyPair)
val joinRequest = incentiveSystem.generateJoinRequest(providerKeyPair.pk, userKeyPair, promotionParameters)
val joinResponse = incentiveSystem.generateJoinRequestResponse(
promotionParameters,
providerKeyPair,
Expand All @@ -59,4 +59,4 @@ class FakeCryptoRepository(
) {
TODO("Not yet implemented")
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public static BenchmarkResult runBenchmark(
start = Instant.now();
joinRequest = incentiveSystem.generateJoinRequest(
ppk,
userKeyPair
userKeyPair,
promotionParameters
);
finish = Instant.now();
tJoinRequest[i] = Duration.between(start, finish).toNanos();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public void fullProtocolTestRun() {
// user generates join request
var joinRequest = incSys.generateJoinRequest(
pkp.getPk(),
ukp
ukp,
promotionParameters
);

// serialize and deserialize join request to ensure serialization does not break anything
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void runFullWorkflow() {
var userKeyPair = incentiveSystem.generateUserKeys();

log.info("Send join request to server and retrieve token");
var joinRequest = incentiveSystem.generateJoinRequest(providerPublicKey, userKeyPair);
var joinRequest = incentiveSystem.generateJoinRequest(providerPublicKey, userKeyPair, testPromotion.getPromotionParameters());
var serializedJoinResponse = incentiveClient.sendJoinRequest(
jsonConverter.serialize(joinRequest.getRepresentation()),
jsonConverter.serialize(userKeyPair.getPk().getRepresentation()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void promotionServiceTest(@Autowired WebTestClient webClient) {
Promotion promotionToJoin = promotions.get(0);

// Create request to send
var joinRequest = incentiveSystem.generateJoinRequest(pkp.getPk(), ukp);
var joinRequest = incentiveSystem.generateJoinRequest(pkp.getPk(), ukp, promotionToJoin.getPromotionParameters());

// Send request and process response to assert correct behavior
var serializedJoinResponse = webClient.post()
Expand Down

0 comments on commit bba3365

Please sign in to comment.