Skip to content

Commit 5dbf730

Browse files
committed
2 parents de96ab5 + 9ff0c1c commit 5dbf730

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

mmv1/products/publicca/ExternalAccountKey.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,29 @@ properties:
7575
- name: 'b64MacKey'
7676
type: String
7777
description: |
78-
Base64-URL-encoded HS256 key. It is generated by the PublicCertificateAuthorityService
78+
Doubly Base64-URL-encoded HS256 key ('base64(base64(binary key))'). It is generated by the PublicCertificateAuthorityService
7979
when the ExternalAccountKey is created.
8080
sensitive: true
8181
output: true
82-
deprecation_message: '`b64_mac_key` is deprecated and will be removed in a future major release. Use `b64url_mac_key` instead.'
82+
deprecation_message: '`b64_mac_key` is deprecated and will be removed in a future major release. Use `mac_key` instead.'
8383
- name: 'b64urlMacKey'
8484
type: String
8585
description: |
86-
Base64-URL-encoded HS256 key. It is generated by the PublicCertificateAuthorityService
86+
Doubly Base64-URL-encoded HS256 key ('base64(base64(binary key))'). It is generated by the PublicCertificateAuthorityService
8787
when the ExternalAccountKey is created.'
8888
sensitive: true
8989
output: true
90+
deprecation_message: '`b64url_mac_key` is deprecated and will be removed in a future major release. Use `mac_key` instead.'
9091
custom_flatten: 'templates/terraform/custom_flatten/publicca_b64url_mac_key.go.tmpl'
9192
validation:
9293
function: 'verify.ValidateBase64URLString()'
94+
- name: 'MacKey'
95+
type: String
96+
description: |
97+
Base64-URL-encoded HS256 key. It is generated by the PublicCertificateAuthorityService
98+
when the ExternalAccountKey is created.'
99+
sensitive: true
100+
output: true
101+
custom_flatten: 'templates/terraform/custom_flatten/publicca_mac_key.go.tmpl'
102+
validation:
103+
function: 'verify.ValidateBase64URLString()'

mmv1/templates/terraform/custom_flatten/publicca_b64url_mac_key.go.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.Reso
1515
return ""
1616
}
1717

18-
dec, err := base64.RawStdEncoding.DecodeString(v.(string))
18+
dec, err := base64.URLEncoding.DecodeString(v.(string))
1919
if err != nil {
2020
return ""
2121
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
2+
if v == nil {
3+
return ""
4+
}
5+
6+
dec, err := base64.URLEncoding.DecodeString(v.(string))
7+
if err != nil {
8+
return ""
9+
}
10+
11+
return string(dec)
12+
}

0 commit comments

Comments
 (0)