import { VaultSourceID } from "buttercup" ; import EventEmitter from "eventemitter3" ; import { OTP } from "../types" ; const __emitter = new EventEmitter ( ) ; let __otpCodes = [ ] ; export function getOTPs ( ) { return __otpCodes ; } export function getEmitter ( ) { return __emitter ; } export function removeCodesForSource ( sourceID ) { __otpCodes = __otpCodes . filter ( item => item . sourceID !== sourceID ) ; __emitter . emit ( "updated" ) ; } export function setCodesForSource ( sourceID , codes ) { __otpCodes = __otpCodes . filter ( item => item . sourceID !== sourceID ) ; __otpCodes . push ( ... codes ) ; __emitter . emit ( "updated" ) ; }