Skip to content

Commit

Permalink
Add getAlgorithm method to all PseudoFunc implementations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaar, Bjørn-Andre committed Dec 11, 2023
1 parent 9506efe commit 77c247b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/no/ssb/dapla/dlp/pseudo/func/PseudoFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ public interface PseudoFunc {
/** Name of the function declaration (including any parameters), e.g. foo(param1,param2) */
String getFuncDecl();

/** Name of the encryption algorithm, e.g. TINK_FPE, TINK_DEEAD */
String getAlgorithm();

/**
* Preprocessing of input. This will be called before apply
*/
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/no/ssb/dapla/dlp/pseudo/func/map/MapFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
public class MapFunc extends AbstractPseudoFunc {
private final Mapper mapper;

@Override
public String getAlgorithm() {
return null;
}

public MapFunc(PseudoFuncConfig genericConfig) {
super(genericConfig.getFuncDecl());
this.mapper = loadMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ public class RedactFunc extends AbstractPseudoFunc {
private final RedactFuncConfigService configService = new RedactFuncConfigService();
private final RedactFuncConfig config;

// A.k.a Free Text Redaction
private static final String ALGORITHM = "REDACT";

@Override
public String getAlgorithm() {
return ALGORITHM;
}

public RedactFunc(@NonNull PseudoFuncConfig genericConfig) {
super(genericConfig.getFuncDecl());
this.config = configService.resolve(genericConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public class TinkDaeadFunc extends AbstractPseudoFunc {
private final TinkDaeadFuncConfigService configService = new TinkDaeadFuncConfigService();
private final TinkDaeadFuncConfig config;

private static final String ALGORITHM = "TINK-DAEAD";

@Override
public String getAlgorithm() {
return ALGORITHM;
}

public TinkDaeadFunc(@NonNull PseudoFuncConfig genericConfig) {
super(genericConfig.getFuncDecl());
this.config = configService.resolve(genericConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public class TinkFpeFunc extends AbstractPseudoFunc {
private final TinkFpeFuncConfigService configService = new TinkFpeFuncConfigService();
private final TinkFpeFuncConfig config;

private static final String ALGORITHM = "TINK-FPE";
@Override
public String getAlgorithm() {
return ALGORITHM;
}

public TinkFpeFunc(@NonNull PseudoFuncConfig genericConfig) {
super(genericConfig.getFuncDecl());
this.config = configService.resolve(genericConfig);
Expand Down

0 comments on commit 77c247b

Please sign in to comment.