Skip to content

Commit d6e0084

Browse files
Add secret key values and allow them to be used in lambdas (#1250)
Co-authored-by: Daniel King <daniel.king@fusionauth.io>
1 parent 76c8a48 commit d6e0084

2 files changed

Lines changed: 305 additions & 59 deletions

File tree

src/main/java/io/fusionauth/domain/Key.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public boolean equals(Object o) {
127127

128128
@JsonIgnore
129129
public String getDisplayName() {
130-
if (algorithm == null) {
130+
if (type == KeyType.Secret || algorithm == null) {
131131
return name + " (" + type.name() + ")";
132132
}
133133

@@ -195,6 +195,10 @@ public boolean use(KeyUse use) {
195195
}
196196

197197
public KeyUse use() {
198+
// Secret keys are not used for signing or verification
199+
if (type == KeyType.Secret) {
200+
return KeyUse.VerifyOnly;
201+
}
198202
// If we have an algorithm and it is either HMAC or a key pair, then we can sign and verify.
199203
if (algorithm != null && (isPair() || type == KeyType.HMAC)) {
200204
return KeyUse.SignAndVerify;
@@ -215,7 +219,8 @@ public enum KeyAlgorithm {
215219
RS256("SHA256withRSA"),
216220
RS384("SHA384withRSA"),
217221
RS512("SHA512withRSA"),
218-
Ed25519("Ed25519");
222+
Ed25519("Ed25519"),
223+
None("None");
219224

220225
public String algorithm;
221226

@@ -232,7 +237,8 @@ public enum KeyType {
232237
EC,
233238
RSA,
234239
HMAC,
235-
OKP
240+
OKP,
241+
Secret
236242
}
237243

238244
public static class CertificateInformation {

0 commit comments

Comments
 (0)