-
Notifications
You must be signed in to change notification settings - Fork 1
[MS-1087] Add external CoSync biometric models #1487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
BurningAXE
wants to merge
1
commit into
main
Choose a base branch
from
MS-1087-Stable-CoSync-Models
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
...com/simprints/infra/events/event/cosync/CoSyncEnrolmentRecordCreationEventDeserializer.kt
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...ents/src/main/java/com/simprints/infra/events/event/cosync/CoSyncEnrolmentRecordEvents.kt
This file was deleted.
Oops, something went wrong.
111 changes: 111 additions & 0 deletions
111
...a/events/src/main/java/com/simprints/infra/events/event/cosync/v1/BiometricReferenceV1.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| package com.simprints.infra.events.event.cosync.v1 | ||
|
|
||
| import androidx.annotation.Keep | ||
| import com.fasterxml.jackson.annotation.JsonInclude | ||
| import com.fasterxml.jackson.annotation.JsonSubTypes | ||
| import com.fasterxml.jackson.annotation.JsonTypeInfo | ||
| import com.simprints.infra.events.event.domain.models.subject.BiometricReference | ||
| import com.simprints.infra.events.event.domain.models.subject.FaceReference | ||
| import com.simprints.infra.events.event.domain.models.subject.FingerprintReference | ||
|
|
||
| /** | ||
| * V1 external schema for biometric references (polymorphic base type). | ||
| * | ||
| * Uses Jackson polymorphic serialization with "type" discriminator field. | ||
| */ | ||
| @Keep | ||
| @JsonTypeInfo( | ||
| use = JsonTypeInfo.Id.NAME, | ||
| include = JsonTypeInfo.As.EXISTING_PROPERTY, | ||
| property = "type", | ||
| ) | ||
| @JsonSubTypes( | ||
| JsonSubTypes.Type(value = FaceReferenceV1::class, name = "FACE_REFERENCE"), | ||
| JsonSubTypes.Type(value = FingerprintReferenceV1::class, name = "FINGERPRINT_REFERENCE"), | ||
| ) | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| sealed class BiometricReferenceV1( | ||
| open val id: String, | ||
| open val format: String, | ||
| val type: String, | ||
| ) | ||
|
|
||
| /** | ||
| * V1 face reference with face templates. | ||
| */ | ||
| @Keep | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| data class FaceReferenceV1( | ||
| override val id: String, | ||
| val templates: List<FaceTemplateV1>, | ||
| override val format: String, | ||
| val metadata: Map<String, String>? = null, | ||
| ) : BiometricReferenceV1(id, format, "FACE_REFERENCE") | ||
|
|
||
| /** | ||
| * V1 fingerprint reference with fingerprint templates. | ||
| */ | ||
| @Keep | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| data class FingerprintReferenceV1( | ||
| override val id: String, | ||
| val templates: List<FingerprintTemplateV1>, | ||
| override val format: String, | ||
| val metadata: Map<String, String>? = null, | ||
| ) : BiometricReferenceV1(id, format, "FINGERPRINT_REFERENCE") | ||
|
|
||
| /** | ||
| * Converts internal BiometricReference to V1 external schema. | ||
| */ | ||
| fun BiometricReference.toCoSyncV1(): BiometricReferenceV1 = when (this) { | ||
| is FaceReference -> this.toCoSyncV1() | ||
| is FingerprintReference -> this.toCoSyncV1() | ||
| } | ||
|
|
||
| /** | ||
| * Converts V1 external schema to internal BiometricReference. | ||
| */ | ||
| fun BiometricReferenceV1.toDomain(): BiometricReference = when (this) { | ||
| is FaceReferenceV1 -> this.toDomain() | ||
| is FingerprintReferenceV1 -> this.toDomain() | ||
| } | ||
|
|
||
| /** | ||
| * Converts internal FaceReference to V1 external schema. | ||
| */ | ||
| fun FaceReference.toCoSyncV1() = FaceReferenceV1( | ||
| id = id, | ||
| templates = templates.map { it.toCoSyncV1() }, | ||
| format = format, | ||
| metadata = metadata, | ||
| ) | ||
|
|
||
| /** | ||
| * Converts V1 external schema to internal FaceReference. | ||
| */ | ||
| fun FaceReferenceV1.toDomain() = FaceReference( | ||
| id = id, | ||
| templates = templates.map { it.toDomain() }, | ||
| format = format, | ||
| metadata = metadata, | ||
| ) | ||
|
|
||
| /** | ||
| * Converts internal FingerprintReference to V1 external schema. | ||
| */ | ||
| fun FingerprintReference.toCoSyncV1() = FingerprintReferenceV1( | ||
| id = id, | ||
| templates = templates.map { it.toCoSyncV1() }, | ||
| format = format, | ||
| metadata = metadata, | ||
| ) | ||
|
|
||
| /** | ||
| * Converts V1 external schema to internal FingerprintReference. | ||
| */ | ||
| fun FingerprintReferenceV1.toDomain() = FingerprintReference( | ||
| id = id, | ||
| templates = templates.map { it.toDomain() }, | ||
| format = format, | ||
| metadata = metadata, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BurningAXE I don't yet understand why we are exporting the TokenizableString class info to the calling apps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because properties in the model are using it? :D If we strip it we'll have to guess about the tokenization state of those fields. Which is already the case with some historical data but does not need to continue.
Do you see any issues with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just see that tokenization handling adds a lot of it complexity