@@ -29,22 +29,26 @@ readonly -f sign_nonce
2929# Args:
3030# $1 - name of the variable holding the auth token (passed to curl_with_auth)
3131# $2 - WSM base URL
32- # $3 - app resource ID (the challenge requestor)
33- # $4 - path to the Ed25519 private signing key
34- # $5 - workspace ID containing the secret
35- # $6 - secret resource ID
32+ # $3 - app workspace ID (workspace containing the app resource)
33+ # $4 - app resource ID (the challenge requestor)
34+ # $5 - path to the Ed25519 private signing key
35+ # $6 - workspace ID containing the secret
36+ # $7 - secret resource ID
3637# Outputs: decrypted secret value on stdout
3738function retrieve_secret() {
3839 local token_var=" $1 "
3940 local wsm_url=" $2 "
40- local app_resource_id=" $3 "
41- local key_file=" $4 "
42- local secret_workspace_id=" $5 "
43- local secret_resource_id=" $6 "
41+ local app_workspace_id=" $3 "
42+ local app_resource_id=" $4 "
43+ local key_file=" $5 "
44+ local secret_workspace_id=" $6 "
45+ local secret_resource_id=" $7 "
4446
4547 local challenge_request
46- challenge_request=" $( jq -n --arg appResourceId " ${app_resource_id} " \
47- ' {"identifier": {"appResourceId": $appResourceId}}' ) "
48+ challenge_request=" $( jq -n \
49+ --arg workspaceId " ${app_workspace_id} " \
50+ --arg resourceId " ${app_resource_id} " \
51+ ' {"identifier": {"app": {"workspaceId": $workspaceId, "resourceId": $resourceId}}}' ) "
4852
4953 local nonce
5054 nonce=" $( curl_with_auth " ${token_var} " -s -f -X POST \
@@ -62,11 +66,12 @@ function retrieve_secret() {
6266
6367 local read_request
6468 read_request=" $( jq -n \
65- --arg appResourceId " ${app_resource_id} " \
69+ --arg workspaceId " ${app_workspace_id} " \
70+ --arg resourceId " ${app_resource_id} " \
6671 --arg nonce " ${nonce} " \
6772 --arg signature " ${signature} " \
6873 ' {
69- "identifier": {"appResourceId ": $appResourceId },
74+ "identifier": {"app ": {"workspaceId": $workspaceId, "resourceId": $resourceId} },
7075 "nonce": $nonce,
7176 "signature": $signature
7277 }' ) "
0 commit comments