-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agent): add mediation grant message
Fixes ATL-3022
- Loading branch information
1 parent
617640c
commit d53119c
Showing
3 changed files
with
37 additions
and
63 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...rc/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/MediationGrant.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,36 @@ | ||
package io.iohk.atala.prism.walletsdk.prismagent.protocols | ||
|
||
import io.iohk.atala.prism.apollo.uuid.UUID | ||
import io.iohk.atala.prism.domain.models.Message | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.decodeFromString | ||
import kotlinx.serialization.json.Json | ||
|
||
sealed class MediationProtocolError : Throwable() { | ||
class InvalidMediationGrantError : MediationProtocolError() | ||
} | ||
|
||
class MediationGrant { | ||
@Serializable | ||
data class Body(var routingDid: String) | ||
|
||
var id: String | ||
var type = ProtocolType.DidcommMediationGrant.value | ||
var body: Body | ||
|
||
constructor( | ||
id: String = UUID.randomUUID4().toString(), | ||
body: Body | ||
) { | ||
this.id = id | ||
this.body = body | ||
} | ||
|
||
constructor(fromMessage: Message) { | ||
if (fromMessage.piuri != ProtocolType.DidcommMediationGrant.value) { | ||
throw MediationProtocolError.InvalidMediationGrantError() | ||
} | ||
this.id = fromMessage.id | ||
this.body = Json.decodeFromString(fromMessage.body) | ||
} | ||
} |
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
62 changes: 0 additions & 62 deletions
62
...c/commonMain/kotlin/io/iohk/atala/prism/walletsdk/prismagent/protocols/MediatorRequest.kt
This file was deleted.
Oops, something went wrong.