---
# System prepended metadata

title: Person Credential Issuance Flow

---

# Person Credential Issuance Flow

```mermaid
sequenceDiagram
    participant issuer as IAS
    participant holder as BC Wallet
    alt Issuer Initiated (after connecting)
        issuer->>holder: Start Issuance (ca.bc.gov.flows/person/start)
        holder-->>issuer: OK
    end
    holder->>issuer: Start Issuance (ca.bc.gov.flows/person/start)
    issuer-->>holder: OK
    issuer->>holder: Wait for 'Proof Request'
    holder-->>issuer: OK
    issuer->>holder: App Attestation Proof Request
    holder-->>issuer: App Attestation Verifiable Presentation
    issuer->>holder: Wait for 'Credential Offer'
    issuer-->>holder: OK
    issuer->>holder: Credential Offer
    holder-->>issuer: Credential Offer Accepeted
    issuer->>holder: Issue Credential
    holder-->>issuer: Issue Credential (ack)
    issuer->>holder: Issuance Complete
    holder-->>issuer: OK
    

```
## State Diagram
```mermaid
---
title: Holder
---
stateDiagram-v2
    started: ⏱️ Started
    waiting_for_pr : ⏱️Waiting 'X' seconds for Proof Request 'Y'
    pr_received : Proof Request Received
    presentation_sent : Presentation Sent
    waiting_for_co : ⏱️Waiting 'X' seconds for Credential Offer 'Y'
    co_received : Credential Offer Received
    co_accepted : Credential Offer Accepted
    
    credential_received: Credential Received/Issued
    
    [*] --> started: ➡️ ca.bc.gov.flows/person/start
    started --> waiting_for_pr: ⬅️ ca.bc.gov.flows/person/wait
    waiting_for_pr --> pr_received
    pr_received --> presentation_sent: ⚡
    presentation_sent --> waiting_for_co:  ⬅️ ca.bc.gov.flows/person/wait
    waiting_for_co --> co_received
    co_received --> co_accepted: 👤
    co_accepted --> credential_received
    credential_received --> [*]: ⬅️ ca.bc.gov.flows/person/done

```
⚡: Automated (no user interaction)
👤: User interaction required
⬅️: incoming message
➡️: outgoing message
⏱️: Waiting for some signal

## DRPC API
### Wallet's Received Messages
```json!
[
    {
        "jsonrpc": "2.0", "method": "flow/create",
        "params":{
             "id": "flow_123",
        }
    },
    {
        "jsonrpc": "2.0", "method": "flow/step/create",
        "params":{
            "flow":"flow_123",
            "id": "step1",
            "action": "wait_for_presentation",
            "reference": "some_proof_request_id?"
            
        }
    },
    {
        "jsonrpc": "2.0", "method": "flow/step/create",
        "params": {
            "flow":"flow_123",
            "id": "step2",
            "action": "wait_for_issuance",
            "timeout": [5, 10],
            "reference": "some_credential_offer_id?"
            "requires": ["step1"]
        }
    },
    {
        "jsonrpc": "2.0", "method": "flow/run",
        "params":{
             "id": "flow_123",
        }
    },
]
```
Note: wait for 1 step with no `requires`
```json
[
    {"jsonrpc": "2.0", "result": true},
    {"jsonrpc": "2.0", "result": true},
    {"jsonrpc": "2.0", "result": true},
    {"jsonrpc": "2.0", "result": true},
]
```
### Wallet's Sent Messages
```json!
[
    {"jsonrpc": "2.0", "method": "flow/step/update", "params":{"type": "step", "id": "flow_123", "status": "done"}},
    {"jsonrpc": "2.0", "method": "flow/step/update", "params":{"type": "step", "id": "flow_123", "status": "done", "error":{"code":"", "message": ""}}},

]
```

### Wallet's Received Messages
```json!
[
    {"jsonrpc": "2.0", "method": "flow/flow/update", "params":{"type": "step", "id": "flow_123", "status": "done", "error":{"code":"", "message": ""}}},

]
```