Refactor import meta phone to set account address.

This commit is contained in:
Spencer Ofwiti 2021-04-21 15:04:04 +03:00
parent 6ac04cbdc6
commit d0e39a6fb2
2 changed files with 4 additions and 5 deletions

View File

@ -43,6 +43,7 @@ function sendit(uid, envelope) {
}
function doOne(keystore, filePath, address) {
let ethereum_address = '0x' + address;
const signer = new crdt.PGPSigner(keystore);
const j = JSON.parse(fs.readFileSync(filePath).toString());
@ -52,9 +53,8 @@ function doOne(keystore, filePath, address) {
const phone = o.tel[0].value;
cic.Phone.toKey(phone).then((uid) => {
const o = fs.readFileSync(filePath, 'utf-8');
const s = new crdt.Syncable(uid, o);
const s = new crdt.Syncable(uid, ethereum_address);
s.setSigner(signer);
s.onwrap = (env) => {
sendit(uid, env);

View File

@ -345,12 +345,11 @@ class Verifier:
address_recovered = address_recovered.replace('"', '')
try:
address = strip_0x(address)
address_recovered = strip_0x(address_recovered)
upper_address_recovered = strip_0x(address_recovered).upper()
except ValueError:
raise VerifierError(address_recovered, 'metadata (phone) address {} address recovered {}'.format(address, address_recovered))
if address != address_recovered:
if upper_address != upper_address_recovered:
raise VerifierError(address_recovered, 'metadata (phone)')