mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
e4b8cddf02
CSF = Storybook’s Component Story Format (CSF) See https://storybook.js.org/docs/formats/component-story-format/ Note that the migrations still use CommonJS require, so the default export as an object is quite ergonomic (& I don't want to touch the migrations).
39 lines
617 B
JavaScript
39 lines
617 B
JavaScript
const mockHex = '0xabcdef0123456789'
|
|
const mockKey = Buffer.alloc(32)
|
|
let cacheVal
|
|
|
|
const mockEncryptor = {
|
|
|
|
encrypt (_, dataObj) {
|
|
cacheVal = dataObj
|
|
return Promise.resolve(mockHex)
|
|
},
|
|
|
|
decrypt () {
|
|
return Promise.resolve(cacheVal || {})
|
|
},
|
|
|
|
encryptWithKey (key, dataObj) {
|
|
return this.encrypt(key, dataObj)
|
|
},
|
|
|
|
decryptWithKey (key, text) {
|
|
return this.decrypt(key, text)
|
|
},
|
|
|
|
keyFromPassword () {
|
|
return Promise.resolve(mockKey)
|
|
},
|
|
|
|
generateSalt () {
|
|
return 'WHADDASALT!'
|
|
},
|
|
|
|
getRandomValues () {
|
|
return 'SOO RANDO!!!1'
|
|
},
|
|
|
|
}
|
|
|
|
export default mockEncryptor
|