---
# System prepended metadata

title: sequence diagrams NYM DIR

---

# sequence diagrams NYM DIR

generated using UML tool such as [plantuml](plantuml.com)

## Account Setup 

```
title wallet create

@startuml
!theme materia-outline
UserClient -> Backend: credential (I) request w/ email (w/o code, w/o phone(code))
UserEmail <- Backend: email verification code
UserClient -> Backend: credential (I updated) request w/ email and email verification code (w/o phone, w/o phone code)
UserClient -> Backend: credential request (I updated) w/ phone number
UserPhone <- Backend: phone verification code
UserClient -> Backend: credential request (I updated) phone verification code (AND? user image base64)
UserClient <- Backend: issue credential (based on I latest) onboarding complete
@enduml
```

![](https://i.imgur.com/UWKlzET.png)

OR

![](https://i.imgur.com/np8ID8l.png)

## Wallet Create

```
title wallet create

@startuml
!theme materia-outline
UserClient -> AriesAgent: create wallet (key created via account onboarding in app)
UserClient <- AriesAgent: created wallet
UserClient <- AriesAgent: OOB invitation (mediator)
UserClient -> AriesAgent: Accept OOB invitation (auto, mediator)
@enduml
```

![](https://i.imgur.com/D8sa2Bw.png)


## Peer Connection

```
title peer connection

@startuml
!theme materia-outline
PeerClient -> AriesAgent: Create invitation/QR code
UserClient <- AriesAgent: Send inviation/QR code
UserClient <-> UserClient: scan QR code invitation
UserClient -> AriesAgent: Accept invitation (possibly mediator)
UserClient <-> PeerClient: Connection (possibly via mediator)
@enduml
```

![](https://i.imgur.com/SH8hacT.png)


## Peer messaging 

```
title peer messaging*

footer *requires connection

@startuml
!theme materia-outline
PeerClient <-> UserClient: Send Basic message
PeerClient <-> UserClient: Receive Basic message
PeerClient <-> UserClient: Send Basic message response
PeerClient <-> UserClient: Receive Basic message response

PeerClient <-> UserClient: Send message with form data
PeerClient <-> UserClient: Receive message with form data
PeerClient <-> UserClient: Send message with form data response
PeerClient <-> UserClient: Receive message with form data response

@enduml
```

![](https://i.imgur.com/YH8Ydh4.png)


If message contains form data we should show this as clickable link and open a new view rendering the form to fill in or render a filled in form
Form data should be based on schemas/credential definitions [see also](https://drive.google.com/drive/u/0/folders/15fchb6HL2Oa-N67WLrpgp9SxppXZ1srE)

## Credential Offer

```
title credential offer

@startuml
!theme materia-outline
UserClient <- PeerClient: Send Credential offer based on form data or in-person shown docs
UserClient -> PeerClient: Receive Credential Offer
UserClient -> PeerClient: Decline Credential Offer OR
UserClient -> PeerClient: Accept Credential Offer
UserClient <- PeerClient: Send Credential Offer
UserClient <- PeerClient: Receive Credential Offer
UserClient <- UserClient: Store Credential in Wallet
@enduml
```

![](https://i.imgur.com/o4jePjF.png)


## TODO: (not in app yet - not in mockups) Proof Request

```
title proof request

@startuml
!theme materia-outline
UserClient <- PeerClient: Send Proof Request
UserClient -> PeerClient: Receive Proof Request
UserClient -> PeerClient: Decline Proof Request OR
UserClient <- UserClient: Select Attributes from Credentials to fulfill request
UserClient -> PeerClient: Send Proof
PeerClient <- UserClient: Receive Proof Request
UserClient <- PeerClient: Proof Acked
@enduml
```

![](https://i.imgur.com/3V89RBU.png)

