diff options
author | P. J. McDermott <pj@pehjota.net> | 2015-03-15 20:36:59 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2015-03-15 20:36:59 (EDT) |
commit | df0fce756247e9598c57354b764bdaf1ce709038 (patch) | |
tree | f3f173cc8e0eb19fef9d871dc77aaf2db5a20d46 | |
parent | 1bc38897ec440bc607c36767eafa15d0f1af1d6c (diff) | |
download | epirts.js-df0fce756247e9598c57354b764bdaf1ce709038.zip epirts.js-df0fce756247e9598c57354b764bdaf1ce709038.tar.gz epirts.js-df0fce756247e9598c57354b764bdaf1ce709038.tar.bz2 |
Epirts.setPublishableKey(): Validate input
-rw-r--r-- | epirts.js | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -57,6 +57,12 @@ var Stripe = Epirts = (function() { }()); pub.setPublishableKey = function(key) { + if (typeof key !== 'string') { + throw new Error('Invalid publishable key'); + } + if (!key.match(/^pk_[A-Za-z0-9_]+/)) { + throw new Error('Invalid publishable key'); + } _key = key; }; |