Skip to content

Commit

Permalink
Revert "added fromNullable to reduces repetitive logic"
Browse files Browse the repository at this point in the history
This reverts commit ce5fc9c.
  • Loading branch information
gbubemismith committed Oct 16, 2023
1 parent ce5fc9c commit 6270592
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
23 changes: 12 additions & 11 deletions libs/common/src/models/export/fido2-credential.export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ export class Fido2CredentialExport {
}

static toDomain(req: Fido2CredentialExport, domain = new Fido2Credential()) {
domain.credentialId = EncString.fromNullable(req.credentialId);
domain.keyType = EncString.fromNullable(req.keyType);
domain.keyAlgorithm = EncString.fromNullable(req.keyAlgorithm);
domain.keyCurve = EncString.fromNullable(req.keyCurve);
domain.keyValue = EncString.fromNullable(req.keyValue);
domain.rpId = EncString.fromNullable(req.rpId);
domain.userHandle = EncString.fromNullable(req.userHandle);
domain.counter = EncString.fromNullable(req.counter);
domain.rpName = EncString.fromNullable(req.rpName);
domain.userDisplayName = EncString.fromNullable(req.userDisplayName);
domain.discoverable = EncString.fromNullable(req.discoverable);
domain.credentialId = req.credentialId != null ? new EncString(req.credentialId) : null;
domain.keyType = req.keyType != null ? new EncString(req.keyType) : null;
domain.keyAlgorithm = req.keyAlgorithm != null ? new EncString(req.keyAlgorithm) : null;
domain.keyCurve = req.keyCurve != null ? new EncString(req.keyCurve) : null;
domain.keyValue = req.keyValue != null ? new EncString(req.keyValue) : null;
domain.rpId = req.rpId != null ? new EncString(req.rpId) : null;
domain.userHandle = req.userHandle != null ? new EncString(req.userHandle) : null;
domain.counter = req.counter != null ? new EncString(req.counter) : null;
domain.rpName = req.rpName != null ? new EncString(req.rpName) : null;
domain.userDisplayName =
req.userDisplayName != null ? new EncString(req.userDisplayName) : null;
domain.discoverable = req.discoverable != null ? new EncString(req.discoverable) : null;
domain.creationDate = req.creationDate;
return domain;
}
Expand Down
4 changes: 0 additions & 4 deletions libs/common/src/platform/models/domain/enc-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export class EncString implements Encrypted {
return this.encryptedString;
}

static fromNullable(val: string | null) {
return val ? new EncString(val) : null;
}

static fromJSON(obj: Jsonify<EncString>): EncString {
if (obj == null) {
return null;
Expand Down

0 comments on commit 6270592

Please sign in to comment.