import { CredentialsData } from "../types" ; const __store = { } ; export interface CredentialsPayload { data : CredentialsData ; masterPassword : string | null ; purposes : Array < string > ; open : boolean ; } export function credentialsAllowsPurpose ( id , purpose ) { const { purposes } = getCredentials ( id ) ; return purposes . includes ( purpose ) ; } export function getCredentials ( id ) { return __store [ id ] || null ; } export function removeCredentials ( id ) { __store [ id ] = null ; delete __store [ id ] ; } export function setCredentials ( id , value ) { __store [ id ] = value ; }