├── .gitignore ├── spec ├── infrastructure │ ├── jasmine-standalone-1.0.0 │ │ ├── src │ │ │ ├── Song.js │ │ │ └── Player.js │ │ ├── spec │ │ │ ├── SpecHelper.js │ │ │ └── PlayerSpec.js │ │ ├── SpecRunner.html │ │ └── lib │ │ │ └── jasmine-1.0.0 │ │ │ ├── MIT.LICENSE │ │ │ ├── jasmine.css │ │ │ └── jasmine-html.js │ ├── rsa2.js │ └── jasmine-jquery-1.3.1.js ├── SpecRunner.html.erb ├── braintree_form_spec.js └── braintree_spec.js ├── lib ├── sjcl │ ├── config.mk │ ├── core │ │ ├── codecHex.js │ │ ├── codecBytes.js │ │ ├── codecString.js │ │ ├── hmac.js │ │ ├── pbkdf2.js │ │ ├── codecBase64.js │ │ ├── sjcl.js │ │ ├── cbc.js │ │ ├── srp.js │ │ ├── sha1.js │ │ ├── ocb2.js │ │ ├── bitArray.js │ │ ├── ccm.js │ │ ├── aes.js │ │ ├── sha256.js │ │ ├── convenience.js │ │ ├── ecc.js │ │ ├── random.js │ │ └── bn.js │ ├── README │ │ ├── INSTALL │ │ ├── bsd.txt │ │ └── COPYRIGHT │ └── configure ├── jsbn │ ├── LICENSE │ ├── base64.js │ ├── rsa.js │ └── jsbn.js ├── braintree.js └── asn1.js ├── package.json ├── README.md ├── LICENSE ├── CHANGELOG.md └── Rakefile /.gitignore: -------------------------------------------------------------------------------- 1 | /spec/SpecRunner.html 2 | -------------------------------------------------------------------------------- /spec/infrastructure/jasmine-standalone-1.0.0/src/Song.js: -------------------------------------------------------------------------------- 1 | function Song() { 2 | } 3 | 4 | Song.prototype.persistFavoriteStatus = function(value) { 5 | // something complicated 6 | throw new Error("not yet implemented"); 7 | }; -------------------------------------------------------------------------------- /lib/sjcl/config.mk: -------------------------------------------------------------------------------- 1 | SOURCES= core/sjcl.js core/aes.js core/bitArray.js core/codecString.js core/codecHex.js core/codecBase64.js core/sha256.js core/ccm.js core/ocb2.js core/hmac.js core/pbkdf2.js core/random.js core/convenience.js 2 | COMPRESS= core_closure.js 3 | -------------------------------------------------------------------------------- /spec/infrastructure/jasmine-standalone-1.0.0/spec/SpecHelper.js: -------------------------------------------------------------------------------- 1 | beforeEach(function() { 2 | this.addMatchers({ 3 | toBePlaying: function(expectedSong) { 4 | var player = this.actual; 5 | return player.currentlyPlayingSong === expectedSong 6 | && player.isPlaying; 7 | } 8 | }) 9 | }); 10 | -------------------------------------------------------------------------------- /spec/infrastructure/jasmine-standalone-1.0.0/src/Player.js: -------------------------------------------------------------------------------- 1 | function Player() { 2 | } 3 | Player.prototype.play = function(song) { 4 | this.currentlyPlayingSong = song; 5 | this.isPlaying = true; 6 | }; 7 | 8 | Player.prototype.pause = function() { 9 | this.isPlaying = false; 10 | }; 11 | 12 | Player.prototype.resume = function() { 13 | if (this.isPlaying) { 14 | throw new Error("song is already playing"); 15 | } 16 | 17 | this.isPlaying = true; 18 | }; 19 | 20 | Player.prototype.makeFavorite = function() { 21 | this.currentlyPlayingSong.persistFavoriteStatus(true); 22 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@github/braintree-encryption", 3 | "description": "Javascript Library for Client-side Encryption with Braintree", 4 | "version": "1.3.15", 5 | "main": "target/braintree-1.3.10.js", 6 | "files": [ 7 | "target/" 8 | ], 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/github/braintree-encryption.git" 12 | }, 13 | "publishConfig": { 14 | "registry": "https://npm.pkg.github.com" 15 | }, 16 | "keywords": [ 17 | "braintree", 18 | "payments" 19 | ], 20 | "author": "braintree ", 21 | "license": "MIT", 22 | "homepage": "https://github.com/braintree/braintree-encryption" 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Braintree.js 2 | 3 | This library is for use with [Braintree's payment gateway](http://braintreepayments.com/) in concert with one of [the supported client libraries](http://braintreepayments.com/docs). It encrypts sensitive payment information in a web browser using the public key of an asymmetric key pair. 4 | 5 | > :grey_exclamation: Notice: `braintree-encryption.js` is an older integration method - [braintree-web](https://github.com/braintree/braintree-web) is the place to go for current integrations and filing issues or PRs. 6 | 7 | ## Getting Started 8 | 9 | See our developer quick start for an example of how to use Braintree.js 10 | 11 | ## Documentation 12 | 13 | * [Official documentation](https://www.braintreepayments.com/docs/javascript) 14 | 15 | ## License 16 | 17 | See the LICENSE file. 18 | -------------------------------------------------------------------------------- /lib/sjcl/core/codecHex.js: -------------------------------------------------------------------------------- 1 | /** @fileOverview Bit array codec implementations. 2 | * 3 | * @author Emily Stark 4 | * @author Mike Hamburg 5 | * @author Dan Boneh 6 | */ 7 | 8 | /** @namespace Hexadecimal */ 9 | sjcl.codec.hex = { 10 | /** Convert from a bitArray to a hex string. */ 11 | fromBits: function (arr) { 12 | var out = "", i, x; 13 | for (i=0; i>> 24); 18 | tmp <<= 8; 19 | } 20 | return out; 21 | }, 22 | /** Convert from an array of bytes to a bitArray. */ 23 | toBits: function (bytes) { 24 | var out = [], i, tmp=0; 25 | for (i=0; i 3 | 4 | 5 | Jasmine Test Runner 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /lib/sjcl/core/codecString.js: -------------------------------------------------------------------------------- 1 | /** @fileOverview Bit array codec implementations. 2 | * 3 | * @author Emily Stark 4 | * @author Mike Hamburg 5 | * @author Dan Boneh 6 | */ 7 | 8 | /** @namespace UTF-8 strings */ 9 | sjcl.codec.utf8String = { 10 | /** Convert from a bitArray to a UTF-8 string. */ 11 | fromBits: function (arr) { 12 | var out = "", bl = sjcl.bitArray.bitLength(arr), i, tmp; 13 | for (i=0; i>> 24); 18 | tmp <<= 8; 19 | } 20 | return decodeURIComponent(escape(out)); 21 | }, 22 | 23 | /** Convert from a UTF-8 string to a bitArray. */ 24 | toBits: function (str) { 25 | str = unescape(encodeURIComponent(str)); 26 | var out = [], i, tmp=0; 27 | for (i=0; i bs) { 20 | key = Hash.hash(key); 21 | } 22 | 23 | for (i=0; i