mirror of
https://github.com/google/nomulus
synced 2026-04-10 11:39:29 +00:00
Expose the functionality to decrypt given data using keyring
This allows us to provide the keyring a blob of encrypted data and a key name, and have it decrypt it for us. Also fixed javadoc length in Keyring.java. It seems like it was using a 80-character length limit. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=222995542
This commit is contained in:
@@ -20,6 +20,7 @@ import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Qualifier;
|
||||
@@ -134,4 +135,10 @@ public final class KeyModule {
|
||||
static Function<String, String> provideEncryptedDataRetriever(Keyring keyring) {
|
||||
return keyring::getEncryptedData;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Named("keyringDecrypter")
|
||||
static BiFunction<String, String, byte[]> provideKeyringDecrypter(Keyring keyring) {
|
||||
return keyring::getDecryptedData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user