Refactor import meta phone to set account address.
This commit is contained in:
parent
6ac04cbdc6
commit
d0e39a6fb2
@ -43,6 +43,7 @@ function sendit(uid, envelope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doOne(keystore, filePath, address) {
|
function doOne(keystore, filePath, address) {
|
||||||
|
let ethereum_address = '0x' + address;
|
||||||
const signer = new crdt.PGPSigner(keystore);
|
const signer = new crdt.PGPSigner(keystore);
|
||||||
|
|
||||||
const j = JSON.parse(fs.readFileSync(filePath).toString());
|
const j = JSON.parse(fs.readFileSync(filePath).toString());
|
||||||
@ -52,9 +53,8 @@ function doOne(keystore, filePath, address) {
|
|||||||
const phone = o.tel[0].value;
|
const phone = o.tel[0].value;
|
||||||
|
|
||||||
cic.Phone.toKey(phone).then((uid) => {
|
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.setSigner(signer);
|
||||||
s.onwrap = (env) => {
|
s.onwrap = (env) => {
|
||||||
sendit(uid, env);
|
sendit(uid, env);
|
||||||
|
@ -345,12 +345,11 @@ class Verifier:
|
|||||||
address_recovered = address_recovered.replace('"', '')
|
address_recovered = address_recovered.replace('"', '')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
address = strip_0x(address)
|
upper_address_recovered = strip_0x(address_recovered).upper()
|
||||||
address_recovered = strip_0x(address_recovered)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise VerifierError(address_recovered, 'metadata (phone) address {} address recovered {}'.format(address, address_recovered))
|
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)')
|
raise VerifierError(address_recovered, 'metadata (phone)')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user