@@ -24,8 +24,9 @@ def __init__(self, app=None):
24
24
self .storefront = None
25
25
self .username = None
26
26
self .password = None
27
- self .private_key = None
28
27
self .openssl = None
28
+ self .access_key = None
29
+ self .private_key = None
29
30
if app is not None :
30
31
self .init_app (app )
31
32
@@ -39,8 +40,10 @@ def init_app(self, app):
39
40
Because FastSpring actually has a testing mode, these
40
41
options are all mandatory.
41
42
42
- The FASTSPRING_PRIVATE_KEY option is a path to the
43
- RSA private key used for encrypting secured payloads.
43
+ For secure payloads, configure the path to the RSA
44
+ private key with the FASTSPRING_PRIVATE_KEY option,
45
+ and the API access key with the FASTSPRING_ACCESS_KEY
46
+ option.
44
47
"""
45
48
app .extensions ['fastspring' ] = self
46
49
self .storefront = app .config ['FASTSPRING_STOREFRONT' ]
@@ -49,6 +52,7 @@ def init_app(self, app):
49
52
private_key = app .config .get ('FASTSPRING_PRIVATE_KEY' )
50
53
if private_key is not None :
51
54
self .openssl = openssl_backend ()
55
+ self .access_key = app .config ['FASTSPRING_ACCESS_KEY' ]
52
56
with open (private_key , 'rb' ) as fp :
53
57
self .private_key = load_pem_private_key (
54
58
fp .read (), password = None , backend = self .openssl )
@@ -93,6 +97,7 @@ def render_head(self, webhook=None, session=None, payload=None):
93
97
html = render_template_string (
94
98
HEAD_TEMPLATE ,
95
99
storefront = self .storefront ,
100
+ access_key = self .access_key ,
96
101
webhook = webhook ,
97
102
session = session ,
98
103
payload = payload )
@@ -271,6 +276,7 @@ def milliseconds_to_datetime(m):
271
276
src="https://d1f8f9xcsvx3ha.cloudfront.net/sbl/0.7.2/fastspring-builder.min.js"
272
277
type="text/javascript"
273
278
{% if webhook %}data-popup-closed="fastspringOnPopupClosed"{% endif %}
279
+ {% if access_key %}data-access-key="{{ access_key }}"{% endif %}
274
280
data-storefront="{{ storefront }}">
275
281
</script>
276
282
"""
0 commit comments