-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migration of audit event data structures from enterprise
- Loading branch information
1 parent
e5a1eac
commit 5b8682f
Showing
17 changed files
with
219 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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
16 changes: 16 additions & 0 deletions
16
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/AuditEvent.kt
This file contains 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,16 @@ | ||
package id.walt.commons.audit | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
sealed class AuditEvent( | ||
@SerialName("_id") val id: String, | ||
val eventType: EventType | ||
) { | ||
abstract val target: String | ||
abstract val timestamp: Long | ||
abstract val status: EventStatus | ||
abstract val callId: String? | ||
abstract val error: String? | ||
} |
6 changes: 6 additions & 0 deletions
6
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/DeviceFlow.kt
This file contains 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,6 @@ | ||
package id.walt.commons.audit | ||
|
||
enum class DeviceFlow { | ||
Multi, | ||
Single | ||
} |
18 changes: 18 additions & 0 deletions
18
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/DidEvent.kt
This file contains 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,18 @@ | ||
package id.walt.commons.audit | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlin.uuid.ExperimentalUuidApi | ||
import kotlin.uuid.Uuid | ||
|
||
@OptIn(ExperimentalUuidApi::class) | ||
@Serializable | ||
class DidEvent( | ||
override val target: String, | ||
override val timestamp: Long, | ||
override val status: EventStatus, | ||
val didEventType: DidEventType, | ||
val didMethod: String, | ||
override val callId: String? = null, | ||
override val error: String? = null | ||
) : AuditEvent(Uuid.random().toHexString(), EventType.DIDEvent) |
8 changes: 8 additions & 0 deletions
8
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/DidEventType.kt
This file contains 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,8 @@ | ||
package id.walt.commons.audit | ||
|
||
enum class DidEventType { | ||
Create, | ||
Update, | ||
Delete, | ||
Resolve | ||
} |
7 changes: 7 additions & 0 deletions
7
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/EventStatus.kt
This file contains 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,7 @@ | ||
package id.walt.commons.audit | ||
|
||
enum class EventStatus { | ||
Open, | ||
Success, | ||
Failure | ||
} |
21 changes: 21 additions & 0 deletions
21
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/EventType.kt
This file contains 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,21 @@ | ||
package id.walt.commons.audit | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
enum class EventType { | ||
@SerialName("IssuanceEvent") IssuanceEvent, | ||
@SerialName("VerificationEvent") VerificationEvent, | ||
@SerialName("KeyEvent") KeyEvent, | ||
@SerialName("DIDEvent") DIDEvent; | ||
|
||
override fun toString(): String { | ||
return when (this) { | ||
IssuanceEvent -> "IssuanceEvent" | ||
VerificationEvent -> "VerificationEvent" | ||
DIDEvent -> "DIDEvent" | ||
KeyEvent -> "KeyEvent" | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...id-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/IssuanceEvent.kt
This file contains 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,21 @@ | ||
package id.walt.commons.audit | ||
|
||
import id.walt.oid4vc.data.ProofType | ||
import kotlinx.serialization.Serializable | ||
import kotlin.uuid.ExperimentalUuidApi | ||
import kotlin.uuid.Uuid | ||
|
||
@OptIn(ExperimentalUuidApi::class) | ||
@Serializable | ||
class IssuanceEvent( | ||
override val target: String, | ||
override val timestamp: Long, | ||
override val status: EventStatus, | ||
val sessionId: String, | ||
val credentialConfigurationId: String, | ||
val format: String?, | ||
val proofType: ProofType? = null, | ||
val holderId: String? = null, | ||
override val callId: String? = null, | ||
override val error: String? = null | ||
) : AuditEvent(Uuid.random().toHexString(), EventType.IssuanceEvent) |
18 changes: 18 additions & 0 deletions
18
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/KeyEvent.kt
This file contains 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,18 @@ | ||
package id.walt.commons.audit | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlin.uuid.ExperimentalUuidApi | ||
import kotlin.uuid.Uuid | ||
|
||
@OptIn(ExperimentalUuidApi::class) | ||
@Serializable | ||
class KeyEvent( | ||
override val target: String, | ||
override val timestamp: Long, | ||
override val status: EventStatus, | ||
val keyEventType: KeyEventType, | ||
val keyAlgorithm: String, | ||
override val callId: String? = null, | ||
override val error: String? = null | ||
) : AuditEvent(Uuid.random().toHexString(), EventType.KeyEvent) |
8 changes: 8 additions & 0 deletions
8
waltid-services/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/KeyEventType.kt
This file contains 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,8 @@ | ||
package id.walt.commons.audit | ||
|
||
enum class KeyEventType { | ||
Create, | ||
Import, | ||
Export, | ||
Rotation | ||
} |
21 changes: 21 additions & 0 deletions
21
...ervices/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/VerificationEvent.kt
This file contains 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,21 @@ | ||
package id.walt.commons.audit | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlin.uuid.ExperimentalUuidApi | ||
import kotlin.uuid.Uuid | ||
|
||
@OptIn(ExperimentalUuidApi::class) | ||
@Serializable | ||
class VerificationEvent( | ||
override val target: String, | ||
override val timestamp: Long, | ||
override val status: EventStatus, | ||
val sessionId: String, | ||
val format: String, | ||
val signatureAlgorithm: String, | ||
val credentialType: String? = null, | ||
val holderId: String? = null, | ||
override val callId: String? = null, | ||
override val error: String? = null | ||
) : AuditEvent(Uuid.random().toHexString(), EventType.VerificationEvent) |
10 changes: 10 additions & 0 deletions
10
...ces/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/filter/DidEventFilter.kt
This file contains 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,10 @@ | ||
package id.walt.commons.audit.filter | ||
|
||
import id.walt.commons.audit.DidEventType | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class DidEventFilter( | ||
val didEventType: Set<DidEventType>? = null, | ||
val didMethod: Set<String>? = null | ||
) |
18 changes: 18 additions & 0 deletions
18
...rvices/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/filter/EventFilter.kt
This file contains 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,18 @@ | ||
package id.walt.commons.audit.filter | ||
|
||
import id.walt.commons.audit.EventStatus | ||
import id.walt.commons.audit.EventType | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class EventFilter( | ||
val eventType: Set<EventType>? = null, | ||
val status: Set<EventStatus>? = null, | ||
val fromTimestamp: Long? = null, | ||
val toTimestamp: Long? = null, | ||
val callId: String? = null, | ||
val issuanceEventFilter: IssuanceEventFilter? = null, | ||
val verificationEventFilter: VerificationEventFilter? = null, | ||
val keyEventFilter: KeyEventFilter? = null, | ||
val didEventFilter: DidEventFilter? = null | ||
) |
14 changes: 14 additions & 0 deletions
14
...altid-service-commons/src/main/kotlin/id/walt/commons/audit/filter/IssuanceEventFilter.kt
This file contains 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,14 @@ | ||
package id.walt.commons.audit.filter | ||
|
||
import id.walt.oid4vc.data.CredentialFormat | ||
import id.walt.oid4vc.data.ProofType | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class IssuanceEventFilter( | ||
val credentialConfigurationId: Set<String>? = null, | ||
val format: Set<CredentialFormat>? = null, | ||
val sessionId: String? = null, | ||
val proofType: Set<ProofType>? = null, | ||
val holder: Set<String>? = null, | ||
) |
10 changes: 10 additions & 0 deletions
10
...ces/waltid-service-commons/src/main/kotlin/id/walt/commons/audit/filter/KeyEventFilter.kt
This file contains 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,10 @@ | ||
package id.walt.commons.audit.filter | ||
|
||
import id.walt.commons.audit.KeyEventType | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class KeyEventFilter( | ||
val keyEventType: Set<KeyEventType>? = null, | ||
val keyAlgorithm: Set<String>? = null, | ||
) |
20 changes: 20 additions & 0 deletions
20
...d-service-commons/src/main/kotlin/id/walt/commons/audit/filter/VerificationEventFilter.kt
This file contains 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,20 @@ | ||
package id.walt.commons.audit.filter | ||
|
||
import id.walt.commons.audit.DeviceFlow | ||
import id.walt.oid4vc.data.CredentialFormat | ||
import id.walt.oid4vc.data.ProofType | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class VerificationEventFilter( | ||
val format: Set<CredentialFormat>? = null, | ||
val signatureAlgorithm: Set<String>? = null, | ||
val sessionId: String? = null, | ||
val holder: Set<String>? = null, | ||
val credentialType: Set<String>? = null, | ||
val ecosystem: Set<String>? = null, | ||
val walletId: Set<String>? = null, | ||
val protocol: Set<String>? = null, | ||
val deviceFlow: Set<DeviceFlow>? = null, | ||
val asyncFlow: Set<Boolean>? = null | ||
) |