-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from matrix-org/valere/crypto_session_status
Add a new crypto session state event
- Loading branch information
Showing
6 changed files
with
245 additions
and
2 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/CryptoSessionStateChange.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,73 @@ | ||
/* | ||
* Copyright (c) 2021 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.analytics.plan | ||
|
||
import im.vector.app.features.analytics.itf.VectorAnalyticsEvent | ||
|
||
// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT | ||
// https://github.com/matrix-org/matrix-analytics-events/ | ||
|
||
/** | ||
* Describe the current session crypto state, that is if the session is verified | ||
* or not, if recovery is correctly setup. | ||
*/ | ||
data class CryptoSessionStateChange( | ||
val recoveryState: RecoveryState, | ||
val verificationState: VerificationState, | ||
) : VectorAnalyticsEvent { | ||
|
||
enum class VerificationState { | ||
/** | ||
* The device is unverified. | ||
*/ | ||
NotVerified, | ||
|
||
/** | ||
* The device is considered to be verified, it has been signed by its | ||
* user identity. | ||
*/ | ||
Verified, | ||
} | ||
|
||
enum class RecoveryState { | ||
|
||
/** | ||
* No default secret storage key exists or it is disabled explicitly | ||
* using the account data event. | ||
*/ | ||
Disabled, | ||
|
||
/** | ||
* Secret storage is set up and we have all the secrets locally. | ||
*/ | ||
Enabled, | ||
|
||
/** | ||
* Secret storage is set up but we're missing some secrets. | ||
*/ | ||
Incomplete, | ||
} | ||
|
||
override fun getName() = "CryptoSessionState" | ||
|
||
override fun getProperties(): Map<String, Any>? { | ||
return mutableMapOf<String, Any>().apply { | ||
put("recoveryState", recoveryState.name) | ||
put("verificationState", verificationState.name) | ||
}.takeIf { it.isNotEmpty() } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"type": "object", | ||
"description": "Describe the current session crypto state, that is if the session is verified or not, if recovery is correctly setup.", | ||
"properties": { | ||
"eventName": { | ||
"enum": ["CryptoSessionState"] | ||
}, | ||
"verificationState": { | ||
"type": "string", | ||
"oneOf": [ | ||
{"const": "Verified", "description": "The device is considered to be verified, it has been signed by its user identity."}, | ||
{"const": "NotVerified", "description": "The device is unverified."} | ||
] | ||
}, | ||
"recoveryState": { | ||
"type": "string", | ||
"oneOf": [ | ||
{"const": "Enabled", "description": "Secret storage is set up and we have all the secrets locally."}, | ||
{"const": "Disabled", "description": "No default secret storage key exists or it is disabled explicitly using the account data event."}, | ||
{"const": "Incomplete", "description": "Secret storage is set up but we're missing some secrets."} | ||
] | ||
} | ||
}, | ||
"required": ["eventName","verificationState", "recoveryState"], | ||
"additionalProperties": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// Copyright 2021 New Vector Ltd | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
|
||
// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT | ||
// https://github.com/matrix-org/matrix-analytics-events/ | ||
|
||
/// Describe the current session crypto state, that is if the session is verified or not, if recovery is correctly setup. | ||
extension AnalyticsEvent { | ||
public struct CryptoSessionStateChange: AnalyticsEventProtocol { | ||
public let eventName = "CryptoSessionState" | ||
|
||
public let recoveryState: RecoveryState | ||
public let verificationState: VerificationState | ||
|
||
public init(recoveryState: RecoveryState, verificationState: VerificationState) { | ||
self.recoveryState = recoveryState | ||
self.verificationState = verificationState | ||
} | ||
|
||
public enum VerificationState: String { | ||
/// The device is unverified. | ||
case NotVerified | ||
/// The device is considered to be verified, it has been signed by its user identity. | ||
case Verified | ||
} | ||
|
||
public enum RecoveryState: String { | ||
/// No default secret storage key exists or it is disabled explicitly using the account data event. | ||
case Disabled | ||
/// Secret storage is set up and we have all the secrets locally. | ||
case Enabled | ||
/// Secret storage is set up but we're missing some secrets. | ||
case Incomplete | ||
} | ||
|
||
public var properties: [String: Any] { | ||
return [ | ||
"recoveryState": recoveryState.rawValue, | ||
"verificationState": verificationState.rawValue | ||
] | ||
} | ||
} | ||
} |
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