cic-internal-integration/apps/cic-meta/src/assets/phone.ts

32 lines
554 B
TypeScript
Raw Normal View History

2021-02-08 18:31:29 +01:00
import { ArgPair, Syncable } from '../sync';
import { Addressable, mergeKey } from '../digest';
2021-02-08 18:31:29 +01:00
class Phone extends Syncable implements Addressable {
address: string
value: number
constructor(address:string, v:string) {
2021-02-08 18:31:29 +01:00
const o = {
msisdn: v,
}
super('', o);
Phone.toKey(v).then((phid) => {
this.id = phid;
this.address = address;
});
}
public static async toKey(msisdn:string) {
return await mergeKey(Buffer.from(msisdn), Buffer.from(':cic.phone'));
2021-02-08 18:31:29 +01:00
}
public key(): string {
return this.id;
}
}
export {
Phone,
}