Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E2E tests #19

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/main/java/io/github/tap30/hiss/key/KeyHashGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public void generateAndLogHashes(Collection<Key> keys) {
}

/**
* @param keys
* @return map of key ID to key hash.
*/
public Map<String, String> generateHashes(Collection<Key> keys) {
Expand All @@ -44,12 +43,20 @@ public Map<String, String> generateHashes(Collection<Key> keys) {
}

/**
* @param keys
* @return invalid key IDs.
*/
public Set<String> validateKeyHashes(Collection<Key> keys) {
return keys.stream()
.filter(key -> StringUtils.hasText(key.getKeyHash()))
.filter(key -> {
if (StringUtils.hasText(key.getKeyHash())) {
return true;
} else {
logger.log(Level.WARNING,
"Key {0} does not have hash; supply it as soon as possible.",
key.getId());
return false;
}
})
.filter(key -> !verifyer.verify(key.getKey(), key.getKeyHash().getBytes(CHARSET)).verified)
.map(Key::getId)
.collect(Collectors.toSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.function.Supplier;

// Todo: improve doc

/**
* Sample Envs:
* <br>
Expand Down
Loading
Loading