summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. 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)
commitdf0fce756247e9598c57354b764bdaf1ce709038 (patch)
treef3f173cc8e0eb19fef9d871dc77aaf2db5a20d46
parent1bc38897ec440bc607c36767eafa15d0f1af1d6c (diff)
downloadepirts.js-df0fce756247e9598c57354b764bdaf1ce709038.zip
epirts.js-df0fce756247e9598c57354b764bdaf1ce709038.tar.gz
epirts.js-df0fce756247e9598c57354b764bdaf1ce709038.tar.bz2
Epirts.setPublishableKey(): Validate input
-rw-r--r--epirts.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/epirts.js b/epirts.js
index 4bdfbfc..3db67d0 100644
--- a/epirts.js
+++ b/epirts.js
@@ -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;
};