Kotlin conversion: DecryptionResult

This commit is contained in:
Paul Schaub 2023-10-31 13:26:33 +01:00
parent a89e70c19e
commit 2391ffc9b2
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 16 additions and 29 deletions

View file

@ -1,29 +0,0 @@
// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import sop.util.Optional;
public class DecryptionResult {
private final Optional<SessionKey> sessionKey;
private final List<Verification> verifications;
public DecryptionResult(SessionKey sessionKey, List<Verification> verifications) {
this.sessionKey = Optional.ofNullable(sessionKey);
this.verifications = Collections.unmodifiableList(verifications);
}
public Optional<SessionKey> getSessionKey() {
return sessionKey;
}
public List<Verification> getVerifications() {
return new ArrayList<>(verifications);
}
}

View file

@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package sop
import sop.util.Optional
data class DecryptionResult
internal constructor(val sessionKey: Optional<SessionKey>, val verifications: List<Verification>) {
constructor(
sessionKey: SessionKey?,
verifications: List<Verification>
) : this(Optional.ofNullable(sessionKey), verifications)
}