@startuml
actor Prover as P
participant "Issuer" as I
participant "Verifier" as V
participant "Public Repo" as S

note over I, S #white
    dashed arrows: a value may be cached, so a call to the ledger/public storage may not be needed
    <font color=green>green:</font> submit/get to/from Public Repo
    black: communication between Issuer/Prover/Verifier
    <font color=red>red:</font> store locally
endnote

== Claim Definition setup ==

note over I: Define **Claim definition** with attributes **m1, m2, ..., ml**

I -[#green]> S: Store **Claim Definition**

== Issuer Setup for each Claim Definition==

note over I: **1.** Generate Primary Keys: **PK** and **SK**\n**2.** Generate Non-revocation Keys: **PKr** and **SKr**

I -> I: Store Private Keys **SK**, **SKr**

I -[#green]> S: Store Primary and Revocation Public Keys: **PK, PKr**


note over I:**3.**  Create accumulator with keys: **accum**, **PKaccum**, **SKaccum**, **Tails**

I -> I: Store Private Key **SKaccum**

I -[#green]> S: Store **PKaccum, accum**

I -[#green]> S: Store **Tails**


== Claim Issuance for a Claim Definition==


note over P: Generate Master Secret **m1**

P -> P: Store **m1**

S -[#green]-> P: Get **PK** and **PKr**

note over P: **P1.** generate U, vPrime, Ur and vrPrime with prover-generated values

P -> P: Store **vPrime**, **vrPrime**

P -[#black]> I: **P2.** Request Claim for the given Claim Def, U and Ur.

note over I
    **I1.** Set attribute values **m3,...ml** and encode to 256 bits
    **I2.** Select accumulator with ID=iA (issue a new one if needed)
    **I3.** generate revocation context **m2**
end note

I -> I: Store **m2,...,ml**

S -[#green]-> I: Get **PK, PKr, accum, PKaccum** values


note over I
    **I5.** Create Primary Claim Credentials **c1=c1(...,{m2,m3,...ml},...)**
    **I6.** Create Non-Revocation Credentials **c2**
    **I7.** Update Revocation Registry (**accum**)
end note

I -[#green]> S: Store new accumulator update: **accum**

I -[#black]> P: Send **c1**, **c2**, **m2**

S -[#green]-> P: Get **PKaccum** value

note over P
    **P3.** update **c1**, **c2** with **vPrime, vrPrime**
    **P4.** Check that **c2** is correct
end note

P -> P: Store **c1,c2,m2**


== Presentation for each Claim Definition ==

note over P
    **P1.** Take nonce **n1** from a Verifier's link
    **P1.** Take **revealedAttributes, predicates, accumSeqNo/TS** from a Verifier's link
end note

S -[#green]-> P: Get **PK,PKr,PKaccum,Tails**

note over P: **P3.** Check accumSeqNo/TS of the last **accum**\n and update the latest accum if needed

S -[#green]> P: Update **accum** and get all issued/revoced since the last update

note over P
    **P4.** Update **c2** (witness) for the latest **accum**
    **P5.** Create Primary Proof for **c1** and each predicate: **PrC**
    **P6.** Create NonRevocationProof for **c2**: **PrP**
end note

P -[#black]> V: Send Full Proof: **Pr=(PrC, PrP)**

S -[#green]-> V: Get **PK, PKr, PKaccum, accum**

note over V: **V1.** Verify **Pr**



@enduml