-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwaltid-enterprise
executable file
·1934 lines (1505 loc) · 53.5 KB
/
waltid-enterprise
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# TODO
# review help
# check dependencies
# check instance running
# formatting
# linux compatibility
# windows compatibility
# status services?
# verification?
# issuance key_id
set -e
RESTORE='\033[0m'
RED='\033[00;31m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
BLUE='\033[00;34m'
PURPLE='\033[00;35m'
CYAN='\033[00;36m'
LIGHTGRAY='\033[00;37m'
LRED='\033[01;31m'
LGREEN='\033[01;32m'
LYELLOW='\033[01;33m'
LBLUE='\033[01;34m'
LPURPLE='\033[01;35m'
LCYAN='\033[01;36m'
WHITE='\033[01;37m'
BBACK='\033[1;30m'
BRED='\033[1;31m'
BFGREEN='\033[1;32m'
BYELLOW='\033[1;33m'
BBLUE='\033[1;34m'
BPURPLE='\033[1;35m'
BCYAN='\033[1;36m'
BWHITE='\033[1;37m'
BBWHITE='\033[1;97m'
BGCYAN='\033[0;106m'
CLI_NAME=" $0"
export WORKDIR=$(cd $(dirname $0) && pwd)
ENTERPRISE_RELEASE=$(cat .env | grep ENTERPRISE_API_DOCKER_IMAGE_TAG | cut -d= -f2)
ROOT_ORGANIZATION=waltid
TENANT=mycustomer
KMS_SERVICE="kms-service"
DID_SERVICE="did-service"
ISSUER_SERVICE="issuer-service"
VERIFIER_SERVICE="verifier-service"
USER_EMAIL="max.mustermann@example.org"
USER_PASS="password123456"
TTY_WIDTH=$(tput cols)
OUTPUT_WIDTH=$(expr $TTY_WIDTH \* 6 / 10) # 60% the terminal window width
auth_token=""
init() {
header
check_dependencies
check_running_instance
}
header() {
echo "============================================================================================="
info "walt.id Enterprise Stack Quickstarter v$(cat $WORKDIR/VERSION)"
echo "============================================================================================="
}
check_dependencies() {
info "Checking dependencies..."
REQUIREMENTS="jq curl tput"
for c in $REQUIREMENTS; do
info " Checking '$c'..." "NO_LINEBREAK_PLEASE"
if [[ -z "$(which $c)" ]]; then
echo -e "${RED}FAIL${RESTORE}"
error "'$c' not found. Please, install it."
exit -1
fi
echo -e "${GREEN}OK${RESTORE}"
# echo -e "\033[FOK"
# echo -e "$(tput cuu1)$(tput hpa $(tput cols))OK"
done
}
log() {
script_name=${0##*/}
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
if [[ ! -z "$2" ]]; then
echo -ne "== $script_name $timestamp $1"
else
echo -e "== $script_name $timestamp $1"
fi
}
info() {
log "${YELLOW}[INFO]${RESTORE} $1" "$2"
}
error() {
log "${RED}[ERROR]${RESTORE} $1" "$2"
}
check_running_instance() {
info "Checking if walt.id Enterprise is running..."
nc -z localhost 3000 &> /dev/null
if [[ $? != 0 ]]; then
error "Sorry. I could not find any running instance of the walt.id Enterprise Stack."
else
info "walt.id Enterprise is up and running. Let's rock 🤘"
fi
}
docker_hub_login(){
if [ ! -f .docker-token ]; then
error "I couldn't find and authorization token to log you in the Docker Hub. Please, ask the walt.id team for one and save it in a file called .docker-token in the current directory. To receive access you must be an Enterprise Stack customer."
exit -1
fi
password=$(cat .docker-token | grep -v "#" | grep -v -e '^[[:space:]]*$')
info "Autheticating to Docker Hub. Please use the password provided..."
docker login -u waltid -p $password
echo
}
pull_docker_image() {
info "Pulling Enterprise Stack v$ENTERPRISE_RELEASE"
docker pull waltid/waltid-enterprise-api:$ENTERPRISE_RELEASE
echo
}
start_container() {
info "Starting up Enterprise Stack v$ENTERPRISE_RELEASE"
docker compose up
}
run() {
docker_hub_login
pull_docker_image
start_container
}
get_superadmin_auth_token() {
info "Checking Super Admin authentication..."
if [ -f .auth_token ]; then
info "Super Admin already logged in."
else
info "Logging Super Admin in..."
superadmin_login
fi
AUTH_TOKEN=$(cat .auth_token)
eval $1=$AUTH_TOKEN
}
clean_all() {
info "Cleaning up..."
recreate_collections
rm -f .user_id
rm -f .auth_token
rm -f .user_auth_token
rm -f .did
rm -f .did_key
rm -f .status_key
# Remove docker images?
}
check_last_command_failure() {
if [[ $result < 0 ]]; then
echo -e"
${RED}
!!!!!!!!!!!
!! ERROR !!
!!!!!!!!!!!
${RESTORE}
Oops. I'm sorry. Something went wrong. Contact the walt.id guys to help you with it. Bye.
"
return -1
fi
result=0
}
pause() {
read -n1 -s
}
print() {
echo -e "\n$1\n" # | fmt -w $OUTPUT_WIDTH
}
pp() {
print "$1"
pause
}
get_user_auth_token() {
if [ -f .user_auth_token ]; then
info "User already logged in."
else
info "Logging user in..."
user_admin_login
fi
USER_AUTH_TOKEN=$(cat .user_auth_token)
info "Auth token: $USER_AUTH_TOKEN"
eval $1=$USER_AUTH_TOKEN
}
wizard_pre_message() {
echo -e "$(
cat <<EOF | fmt -w $OUTPUT_WIDTH
$1
EOF
)"
pause
result=0
}
wizard_pos_message() {
check_last_command_failure
echo -e "$(
cat <<EOF | fmt -w $OUTPUT_WIDTH
$1
EOF
)"
}
wizard_welcome() {
wizard_pre_message "
Welcome to the Quickstart Wizard of the walt.id Enterprise Stack! We will now guide you through each step to get you onboarded on our platform.
${BLUE}>> Press any key to continue...${RESTORE}
"
}
wizard_disclaimer() {
echo -e "
DISCLAIMER 1
-------------"
echo -e "
This is not a CLI for the walt.id Enterprise Stack. This script was built for educational purpose only. Use it to learn the basics of how to setup our product. Nothing else ;-)" | fmt -w $OUTPUT_WIDTH
echo -e "
DISCLAIMER 2
-------------"
echo -e "
In order to make you experience as smooth as possible, we need to recreate the whole database, just to make sure there's no data there that could cause any confusion and get in the way of the main purpose of this script: learning how to use the product.
Which means: all the data in your local walt.id Enterprise Stack instance will be lost.
" | fmt -w $OUTPUT_WIDTH
printf "%4s${BLUE}>> Are you ok with that? (y/N)${RESTORE} "
read -n1 AGREED
shopt -s nocasematch
if [[ "$AGREED" != "y" ]]; then
wizard_disclaimer_disagree
return -1
fi
wizard_disclaimer_agreed
}
wizard_disclaimer_disagree() {
print "
We understand. No worries. Friendship continues.
Let us give you 2 options:
1. Try each command by yourself and deal with eventual issues; or\n
2. Save the data you don't want to lose and come back again to this wizard ;-)
Tchüss!
"
}
wizard_disclaimer_agreed() {
print "
Cool. Thanks for understanding.
"
}
wizard_pre_clean_all() {
wizard_pre_message "
Now, let's clean the database and remove auxiliary files.
${BLUE}>> Press any key to run the command below...${RESTORE}
${BGCYAN}$CLI_NAME recreate-db \n${RESTORE}
"
}
wizard_pos_clean_all() {
wizard_pos_message "
Database cleaned and auxiliary files deleted.
"
}
wizard_pre_suerpadmin_create_account() {
wizard_pre_message "
The first thing we need to do is the creation of the so called Super Admin user. It's something like the 'root' in your OS.
${BLUE}>> Press any key to run the command below...${RESTORE}
${BGCYAN}$CLI_NAME superadmin-create-account \n${RESTORE}
"
}
wizard_pos_suerpadmin_create_account() {
wizard_pos_message "
Nice! The Super Admin user has just been created with the email and password specified in the ./config/superadmin-registration.conf file.
The Super Admin user can do anything in the platform. As the name suggests, he is the admin of the whole instance. He can manage all the resources in any tenant in any organization. So, please, never share this user's credential with anyone not related to the instance administration.
Learn more about the Super Admin here:
https://docs.walt.id/enterprise-stack/administration/access-and-permissions/super-admin/overview
"
}
wizard_pre_superadmin_login() {
wizard_pre_message "
Now, it's time to log him in.
${BLUE}>> Press any key to run the command below to get access to super powers...${RESTORE}
${BGCYAN}$CLI_NAME superadmin-login \n${RESTORE}
"
}
wizard_pos_superadmin_login() {
wizard_pos_message "
The Super Admin is now logged in.
Every command from now on will be executed with the Super Admin account.
"
}
wizard_pre_init_db() {
wizard_pre_message "
The next step is the database initialization. Since we've just recreated everything from scratch, it's not strictly necessary, but I'll show you how it works anyway.
${BLUE}>> Press any key to run the command below...${RESTORE}
${BGCYAN}$CLI_NAME init-db ${RESTORE}\n
"
}
wizard_pos_init_db() {
wizard_pos_message "
The database has been initialized according to the information provided in the config/database.conf file.
"
}
wizard_pre_create_organization() {
wizard_pre_message "
It's now time to create the root organization. If you allow me, I will call it '$ROOT_ORGANIZATION'. Once you learn how to do it, you should use your company's name instead.
You can find more info about organizations in the docs:
https://docs.walt.id/enterprise-stack/concepts#the-organization
${BLUE}>> Press any key to run the command below and create the '$ROOT_ORGANIZATION' organization...${RESTORE}
${BGCYAN}$CLI_NAME create-organization ${RESTORE}\n
"
}
wizard_pos_create_organization() {
print "
Awesome. The '$ROOT_ORGANIZATION' organization has been created.
"
# TODO Later
# This is how you database structure looks like so far.
# ┌────────────┐
# │ │
# │ waltid │
# │ │
# └────────────┘
#TODO Parameterize org name in the box
}
wizard_pre_list_organizations() {
# TODO What's a use case for more than one root organization?
wizard_pre_message "
At any time, you can list all the organizations in your Enterprise instance.
${BLUE}>> Press any key to run the command bellow to list all the organizations...${RESTORE}
${BGCYAN}$CLI_NAME list-organizations ${RESTORE}\n
"
}
wizard_pos_list_organizations() {
wizard_pos_message "
"
}
wizard_pre_create_user_account() {
wizard_pre_message "
You are probably aware that it's not a good idea to use a user with super powers for daily tasks, right? And, you know... big power leads to big responsibilities. We'd better create a user with less power.
We will now use the Super Admin account to create a new 'ordinary' user account.
Learn more about user accounts here:
https://docs.walt.id/enterprise-stack/administration/access-and-permissions/accounts/overview
${BLUE}>> Press any key to run the command below to create a not-so-super user...${RESTORE}
${BGCYAN}$CLI_NAME create-user-account ${RESTORE}\n
"
}
wizard_pos_create_user_account() {
wizard_pos_message "
The account '$USER_EMAIL' was successfully created with password '$USER_PASS'.
We will use it from now on.
"
}
wizard_pre_list_accounts() {
wizard_pre_message "
${BLUE}>> Press any key to run the command below to list all accounts registered in your instance...${RESTORE}
${BGCYAN}$CLI_NAME list-accounts ${RESTORE}\n
"
}
wizard_pos_list_accounts1() {
wizard_pos_message "
Notice that there are two user accounts: Superadmin and Max.
Now, before we move on. Let's take a closer look at the "role" property.
Each property in the 'roles' object represents a set of roles assigned to that user in a specific organization.
Take Max as our first example. He doesn't have any specific role. Which means he doesn't have any privileges on any resource (we will talk more about it later).
On the other hand, when we look at the Superadmin account. It has the role 'admin' in the '$ROOT_ORGANIZATION' organization. Now, why does it have these privileges? It's because it was this account who created that organization.
Every time an organization is created, an 'admin' role is automatically generated and assigned to its creator.
"
}
wizard_pos_list_accounts2() {
wizard_pos_message "
Now notice that Max also has the role '$ROOT_ORGANIZATION.admin'.
"
}
wizard_pre_list_org_resources() {
wizard_pre_message "
${BLUE}>> Press any key to list the resources currently available in our '$ROOT_ORGANIZATION' organization...${RESTORE}
${BGCYAN}$CLI_NAME list-org-resources ${RESTORE}\n
"
}
wizard_pos_list_org_resources() {
wizard_pos_message "
"
}
wizard_pre_list_tenant_resources() {
wizard_pre_message "
${BLUE}>> Press any key to list the resources currently available in the '$TENANT' tenant...${RESTORE}
${BGCYAN}$CLI_NAME list-tenant-resources ${RESTORE}\n
"
}
wizard_pos_list_tenant_resources() {
wizard_pos_message "
"
}
wizard_pre_list_keys() {
wizard_pre_message "
"
}
wizard_pos_list_keys() {
wizard_pos_message "
"
}
wizard_pre_add_admin_role() {
wizard_pre_message "
What if we now assign the same "$ROOT_ORGANIZATION.admin" role to Max? Does he deserve it?
${BLUE}>> Press any key to run the command below and give Max some power on the "$ROOT_ORGANIZATION" organization...${RESTORE}
${BGCYAN}$CLI_NAME add-admin-role ${RESTORE}\n
"
}
wizard_pos_add_admin_role() {
wizard_pos_message "
Congratz, Max. You are now a VIP member at "$ROOT_ORGANIZATION". However, you are not quite at the level of the Super Admin. But I’m sure you understand, right? ;-)
Learn more about roles here:
https://docs.walt.id/enterprise-stack/administration/access-and-permissions/roles/overview
"
}
wizard_pre_user_admin_login() {
wizard_pre_message "
Let's switch to Max's account and stop using the Super Admin account.
${BLUE}>> Press any key to log Max in...${RESTORE}
${BGCYAN}$CLI_NAME user-admin-login ${RESTORE}\n
"
}
wizard_pos_user_admin_login() {
wizard_pos_message "
Max is in charge now. He logged in successfully.
"
}
wizard_pre_list_org_resources_before_tenant() {
wizard_pre_message "
Let's now talk about a very important concept: resource.
Almost every entity in the walt.id Enterprise is a resource.
An organization is composed by resources. Let me show you.
${BLUE}>> Press any key to list the resources created by default in the '$ROOT_ORGANIZATION' organization...${RESTORE}
${BGCYAN}$CLI_NAME list-org-resources ${RESTORE}\n
"
}
wizard_pos_list_org_resources_before_tenant() {
wizard_pos_message "
By default, any organization is created with 2 resources in it: a role and a host-alias.
Yeah, roles and the host-alias are also a resource. The host-alias is used to access the enterprise stack API via a specific subdomain (It's a more advanced topic and something we won't discuss in more detail right now).
Resources are referenced with <organization_name>.<resource_name>. That's why the 'admin' role was referenced with '$ROOT_ORGANIZATION.admin'. It's a structure which will be used everywhere from now on.
What about adding more resources into the '$ROOT_ORGANIZATION' organization? Let's do it!
"
}
wizard_pre_create_tenant() {
wizard_pre_message "
Would it be good to store all your files in the root folder of your storage system? In most cases, the answer is no, correct? Especially when some of these files would refer to similar things but with different contexts. You would have to name each file with the full context to make sure you find them later. That's why we distribute them in a folder hierarchy. Each entry in the hierarchy represents an specific context, which allows you to do
'/Payments/2025/Feb/Company A/Proof of Payment.pdf'
instead of
'Proof_of_Payment_for_Company_A_in_Feb_2025.pdf'
This is what Tenants are about. They are organizations units (or namespaces, if you will) that allow you to isolate resources for different contexts.
You can give Tenants any semantics you want, just like you do in your file system. However, the most common use case for Tenants is the creation of customer specific contexts in such a way that everything related to one particular customer is isolated from other's.
So, for example, let's say walt.id has a managed Enterprise instance that is shared by multiple customers. Each customer would be a separated Tenant in the platform. Let's take a look!
${BLUE}>> Press any key to create an specific 'folder' for your new customer...
${BGCYAN}$CLI_NAME create-tenant ${RESTORE}\n
"
}
wizard_pos_create_tenant() {
wizard_pos_message "
Cool. The '$TENANT' tenant has been successfully created.
You can learn more about Tenants here:
https://docs.walt.id/enterprise-stack/administration/tenants/overview
"
}
wizard_pre_list_org_resources_after_tenant() {
wizard_pre_message "
Oh! Did I say that a tenant is also a resource in the root organization?
${BLUE}>> Press any key to list again the '$ROOT_ORGANIZATION' organization resources...${RESTORE}
${BGCYAN}$CLI_NAME list-org-resources ${RESTORE}\n
"
}
wizard_pos_list_org_resources_after_tenant() {
wizard_pos_message "
Notice how there are now 3 resources in our organization.
And, you know what? There is an interesting thing here... Tenants are an special type of resource. Why? Because they can be nested. It means that you can create a tenant inside a tenant, like '$ROOT_ORGANIZATION.$TENANT.a_department'. But it's not a topic for now. Let's move on.
Now it's time to reveal something new to you. If you scroll up a bit, you will see that I said that 'Almost every entity in the walt.id Enterprise is a resource.'. Yes, ALMOST, not 'only'.
Another very important concept in the Enterprise Stack are SERVICES.
In a rough definition, we can say that Resources are _static_ while Services are _dynamic_. Or also, Resources provide some _information_ to the instance whilst Services provide some _functionality_.
So, to enable credential issuance and verification, we need to instantiate Services inside of one or multiple tenants. That's what we are going to do now.
To learn more about Services in the Enterprise Stack, look at:
https://docs.walt.id/enterprise-stack/services/
Now, we are going to create a couple of services. All of them will be created inside the '$TENANT' tenant. Why? Just because we want those services to be customer specific.
By doing this, in addition to the security isolation that is created between the environments of each customer, preventing one customer from accessing the services of another, it also becomes possible to customize the services to the specifics of each of them.
"
}
wizard_pre_create_kms_service() {
wizard_pre_message "
The most basic resource in a decentralized identity solution is criptographic keys.
Before creating, we need to decide where to store them.
Despite the fact that we support several KMS solutions on the market (AWS, Oracle and Hashicorp), we're going to use a local key storage implementation which, although not ideal for production environment, is good enough for the educational purpose of this script.
${BLUE}>> Press any key to instantiate a Local KMS service in the '$TENANT' tenant...${RESTORE}
${BGCYAN}$CLI_NAME create-kms-service ${RESTORE}\n
"
}
wizard_pos_create_kms_service() {
wizard_pos_message "
The Local KMS has been successfully created and is eagerly awaiting some keys.
Learn more about the KMS Services here:
https://docs.walt.id/enterprise-stack/services/key-management-service/overview
"
}
wizard_pre_generate_did_key() {
wizard_pre_message "
Let's create your first key, which will be necessary for generating a Decentralized Identifier (DID). Both the key and the DID are needed for issuing a credential later on.
${BLUE}>> Press any key to create an asymetric key pair...${RESTORE}
${BGCYAN}$CLI_NAME generate-did-key ${RESTORE}\n
"
}
wizard_pos_generate_did_key() {
wizard_pos_message "
The key was created and saved in the local KMS (database of the Enterprise Stack). It was created with the Ed25519 algorithm and it's resource ID has been saved in the .did_key local file.
Learn more about the KMS service, here:
https://docs.walt.id/enterprise-stack/services/key-management-service/overview
"
}
# wizard_pre_generate_status_key() {
# wizard_pre_message "
# Another key will be needed: the key for the status... #TODO
# "
# }
# wizard_pos_generate_status_key() {
# wizard_pos_message "
# Status key successfuly created. #TODO
# "
# }
wizard_pre_create_did_service() {
wizard_pre_message "
One important concept in most Decentralized Identity ecosystems are... Decentralized Identifiers, also called DID ❤️
DIDs are a way to uniquely identify an entity. In the current context, we use DIDs to identify Issuers and Subjects.
You can learn more about it at:
https://docs.walt.id/community-stack/concepts/decentralised-identifiers
Let's now create the DID service, which we will later use to create our DIDs.
${BLUE}>> Press any key to run the command below...${RESTORE}
${BGCYAN}$CLI_NAME create-did-service ${RESTORE}\n
"
}
wizard_pos_create_did_service() {
wizard_pos_message "
DID service successfully created in the scope of tenant '$TENANT'.
Learn more about it at:
https://docs.walt.id/enterprise-stack/services/did-service/overview
"
}
wizard_pre_create_did() {
wizard_pre_message "
Now, it's time to use the DID service to generate the DID that will be used to identify our Issuer.
${BLUE}>> Press any key to run the command below...${RESTORE}
${BGCYAN}$CLI_NAME create-did ${RESTORE}\n
"
}
wizard_pos_create_did() {
wizard_pos_message "
Issuer DID of type did:key successfully created and saved in the '.did' file.
"
}
# wizard_pre_create_credential_status_service() {
# wizard_pre_message "
# ${BLUE}>> Press any key to run the command below...${RESTORE}
# ${BGCYAN}$CLI_NAME create-credential-status-service ${RESTORE}\n
# "
# }
# wizard_pos_create_credential_status_service() {
# wizard_pos_message "
# "
# }
wizard_pre_create_issuer_service() {
wizard_pre_message "
Creating Issuer Service...
${BLUE}>> Press any key to run the command below...${RESTORE}
${BGCYAN}$CLI_NAME create-issuer-service ${RESTORE}\n
"
}
wizard_pos_create_issuer_service() {
wizard_pos_message "
Issuer Service successfully created. Your are now ready to issue credentials.
Learn more about the issuer service here:
https://docs.walt.id/enterprise-stack/services/issuer-service/overview
"
}
wizard_pre_create_verifier_service() {
wizard_pre_message "
In order to verify a credential, we need to instantiate a Verifier Service in the respective tenant.
${BLUE}>> Press any key to run the command below...${RESTORE}
${BGCYAN}$CLI_NAME create-verifier-service ${RESTORE}\n
"
}
wizard_pos_create_verifier_service() {
wizard_pos_message "
Verifier Service successfully created. You are now ready to verify credentials.
Learn more about the verifier service here:
https://docs.walt.id/enterprise-stack/services/verifier-service/overview
"
}
wizard_pre_issue_jwt_vc() {
wizard_pre_message "
Everything we have done so far has had two main goals: to be able to issue and verify credentials. Let's start with the first one.
${BLUE}>> Press any key to run the command below and issue a W3C Credential...${RESTORE}
${BGCYAN}$CLI_NAME issue-jwt-vct ${RESTORE}\n
"
}
wizard_pos_issue_jwt_vc() {
wizard_pos_message "
The credential offer has been successfully created and saved in the .vc-offer file.
According to the OID4VC protocol, this offer can now be accepted by any compatible wallet.
Unfortunately, our Enterprise stack wallet service is still under development. Therefore we cannot move beyond this point yet.
"
}
thanks() {
wizard_pos_message "
Thanks for your attention and patience. We hope this wizard could give you a simple and straight overview of how our Enterprise Stack works.
Should you have any feedback, do not hesitate to get in touch.
Have a wonderful day,
walt.id
"
}
wizard() {
clear
init
wizard_welcome
wizard_disclaimer
wizard_pre_clean_all
clean_all
wizard_pos_clean_all
wizard_pre_suerpadmin_create_account
superadmin_create_account
wizard_pos_suerpadmin_create_account
wizard_pre_superadmin_login
superadmin_login
wizard_pos_superadmin_login
wizard_pre_init_db
init_db
wizard_pos_init_db
wizard_pre_create_organization
create_organization $ROOT_ORGANIZATION
wizard_pos_create_organization
wizard_pre_list_organizations
list_organizations
wizard_pos_list_organizations
wizard_pre_create_user_account
create_user_account
wizard_pos_create_user_account
wizard_pre_list_accounts
list_accounts
wizard_pos_list_accounts1
wizard_pre_add_admin_role
add_admin_role_to_user
wizard_pos_add_admin_role
wizard_pre_list_accounts
list_accounts "$ROOT_ORGANIZATION"
wizard_pos_list_accounts2
wizard_pre_user_admin_login
user_admin_login
wizard_pos_user_admin_login
wizard_pre_list_org_resources_before_tenant
list_org_resources
wizard_pos_list_org_resources_before_tenant
wizard_pre_create_tenant
create_tenant
wizard_pos_create_tenant
wizard_pre_list_org_resources_after_tenant
list_org_resources
wizard_pos_list_org_resources_after_tenant
wizard_pre_create_kms_service
create_kms_service
wizard_pos_create_kms_service
wizard_pre_list_tenant_resources
list_tenant_resources
wizard_pos_list_tenant_resources
wizard_pre_generate_did_key
generate_did_key
wizard_pos_generate_did_key
# wizard_pre_generate_status_key
# generate_status_key
# wizard_pos_generate_status_key
wizard_pre_create_did_service
create_did_service
wizard_pos_create_did_service
wizard_pre_list_tenant_resources
list_tenant_resources
wizard_pos_list_tenant_resources
wizard_pre_create_did
create_did
wizard_pos_create_did
# wizard_pre_create_credential_status_service
# create_credential_status_service
# wizard_pos_create_credential_status_service
wizard_pre_create_issuer_service
create_issuer_service
wizard_pos_create_issuer_service
wizard_pre_list_tenant_resources
list_tenant_resources
wizard_pos_list_tenant_resources
wizard_pre_create_verifier_service
create_verifier_service
wizard_pos_create_verifier_service
wizard_pre_list_tenant_resources
list_tenant_resources
wizard_pos_list_tenant_resources
wizard_pre_issue_jwt_vc
issue_jwt_vc
wizard_pos_issue_jwt_vc
thanks
}
superadmin_create_account() {
superadmin_token=$(cat config/superadmin-registration.conf | sed -n '2 p' | cut -d \" -f 2)
info "Registering token \"${superadmin_token}\" provided in the config/superadmin-registration.conf file"
response=$(curl -X 'POST' \
'http://localhost:3000/v1/superadmin/create-by-token' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-d "${superadmin_token}" 2> /dev/null)
if [[ $response == *"exception"* ]]; then
error "Super admin account could not be created."
error "$response"
result=-1
else
info "Super admin account successfully created."
fi
}
superadmin_login() {
superadmin_email=$(cat config/superadmin-registration.conf | grep identifier | cut -d \" -f 2)
superadmin_password=$(cat config/superadmin-registration.conf | grep password | cut -d \" -f 2)
info "Logging in super admin with credentials provided in the superadmin-registration.conf file"
response=$(curl -X 'POST' \
'http://localhost:3000/auth/account/emailpass' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d "{