JezK
Edit File: crypto.js.map
{"version":3,"file":"crypto.js","names":["crypto","require","stream","hash","content","type","createHash","update","digest","HashStream","options","_hash","_updated","chunk","encoding","callback","sum","getHash","Transform"],"sourceRoot":"../../src","sources":["util/crypto.js"],"sourcesContent":["/* @flow */\n\nconst crypto = require('crypto');\nconst stream = require('stream');\n\nexport function hash(content: string, type: string = 'md5'): string {\n return crypto.createHash(type).update(content).digest('hex');\n}\n\ntype HashOptions = duplexStreamOptions;\n\nexport class HashStream extends stream.Transform {\n constructor(options?: HashOptions) {\n super(options);\n this._hash = crypto.createHash('sha1');\n this._updated = false;\n }\n\n _hash: crypto$Hash;\n _updated: boolean;\n\n _transform(chunk: Buffer | string, encoding: string, callback: (error: ?Error, data?: Buffer | string) => void) {\n this._updated = true;\n this._hash.update(chunk);\n callback(null, chunk);\n }\n\n getHash(): string {\n return this._hash.digest('hex');\n }\n\n test(sum: string): boolean {\n return this._updated && sum === this.getHash();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAGC,OAAO,CAAC,QAAQ,CAAC;AAChC,IAAMC,MAAM,GAAGD,OAAO,CAAC,QAAQ,CAAC;AAEzB,SAASE,IAAI,CAACC,OAAe,EAAgC;EAAA,IAA9BC,IAAY,uEAAG,KAAK;EACxD,OAAOL,MAAM,CAACM,UAAU,CAACD,IAAI,CAAC,CAACE,MAAM,CAACH,OAAO,CAAC,CAACI,MAAM,CAAC,KAAK,CAAC;AAC9D;AAAC,IAIYC,UAAU;EAAA;EAAA;EACrB,oBAAYC,OAAqB,EAAE;IAAA;IAAA;IACjC,0BAAMA,OAAO;IAAE;IAAA;IACf,MAAKC,KAAK,GAAGX,MAAM,CAACM,UAAU,CAAC,MAAM,CAAC;IACtC,MAAKM,QAAQ,GAAG,KAAK;IAAC;EACxB;EAAC;IAAA;IAAA,OAKD,oBAAWC,KAAsB,EAAEC,QAAgB,EAAEC,QAAyD,EAAE;MAC9G,IAAI,CAACH,QAAQ,GAAG,IAAI;MACpB,IAAI,CAACD,KAAK,CAACJ,MAAM,CAACM,KAAK,CAAC;MACxBE,QAAQ,CAAC,IAAI,EAAEF,KAAK,CAAC;IACvB;EAAC;IAAA;IAAA,OAED,mBAAkB;MAChB,OAAO,IAAI,CAACF,KAAK,CAACH,MAAM,CAAC,KAAK,CAAC;IACjC;EAAC;IAAA;IAAA,OAED,cAAKQ,GAAW,EAAW;MACzB,OAAO,IAAI,CAACJ,QAAQ,IAAII,GAAG,KAAK,IAAI,CAACC,OAAO,EAAE;IAChD;EAAC;EAAA;AAAA,EAtB6Bf,MAAM,CAACgB,SAAS;AAAA"}