@startuml
/'
Copyright 2017-2018 Government of Canada - Public Services and Procurement Canada - buyandsell.gc.ca

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.
'/

skinparam ParticipantPadding 20
skinparam BaloxPadding 20

title Holder-Prover Agent On-Line Boot Sequence

box "Indy" #LightBlue
    participant "Ledger" as ledger
endbox
actor "Trust Anchor\nAgent" as tag
actor "Holder-Prover\n(e.g., The Org Book)\nAgent" as obag

=== BOOTSTRAP ==
note over ledger, obag
    Node pool is open (holder-prover agent is on-line)
endnote

obag -> obag: call get_nym(did)
group get_nym() implements
    obag -> ledger: Look up agent nym
    ledger --> obag: agent nym if present
end

alt Nym not present
    note over ledger, obag
        Trust anchor agent service wrapper API is up
    endnote

    obag -[#blue]> tag: call send_nym(did, verkey, alias, role)
    group send_nym() implements
        tag -[#blue]> ledger: send agent nym
        ledger --[#blue]> tag: agent nym
        tag --[#blue]> obag: agent nym
    end
end

obag -> obag: create, store link secret

@enduml
