mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
9bd8c5f723
Calls to `personal_sign` are now: - When hex encoded, preserved as hex encoded, but displayed as utf-8 text. - When not hex encoded, decoded as utf-8 text as hex for signing. - The messages proposed for signing are displayed as UTF-8 text. - When the message cannot be rendered as UTF-8 text, it is displayed as hexadecimal. Fixes #1173
26 lines
640 B
JavaScript
26 lines
640 B
JavaScript
var assert = require('assert')
|
|
var BinaryRenderer = require('../../../ui/app/components/binary-renderer')
|
|
|
|
describe('BinaryRenderer', function() {
|
|
|
|
let binaryRenderer
|
|
const message = 'Hello, world!'
|
|
const buffer = new Buffer(message, 'utf8')
|
|
const hex = buffer.toString('hex')
|
|
|
|
beforeEach(function() {
|
|
binaryRenderer = new BinaryRenderer()
|
|
})
|
|
|
|
it('recovers message', function() {
|
|
const result = binaryRenderer.hexToText(hex)
|
|
assert.equal(result, message)
|
|
})
|
|
|
|
|
|
it('recovers message with hex prefix', function() {
|
|
const result = binaryRenderer.hexToText('0x' + hex)
|
|
assert.equal(result, message)
|
|
})
|
|
})
|