Check for both v0 & v1 files (#762)

This commit is contained in:
Jaco Greeff 2019-02-27 10:58:07 +01:00 committed by GitHub
parent 29f76b1636
commit 7858192058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,11 +95,11 @@ class Restore extends React.PureComponent<Props, State> {
private onChangeFile = (file: Uint8Array): void => {
try {
const json = JSON.parse(u8aToString(file));
const isFileValid = keyring.decodeAddress(json.address).length === 32 &&
isHex(json.encoded) &&
isObject(json.meta) &&
json.encoding.content[0] === 'pkcs8' &&
json.encoding.content[1] === 'ed25519';
const isFileValid = keyring.decodeAddress(json.address).length === 32 && isHex(json.encoded) && isObject(json.meta) && (
Array.isArray(json.encoding.content)
? json.encoding.content[0] === 'pkcs8'
: json.encoding.content === 'pkcs8'
);
this.setState({
isFileValid,