From df0fce756247e9598c57354b764bdaf1ce709038 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 15 Mar 2015 20:36:59 -0400 Subject: Epirts.setPublishableKey(): Validate input --- 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; }; -- cgit v0.9.1