import { Injectable } from '@angular/core' ; /**
 * A stored credential. The interface here is deliberately different from that
 * in the OpenYOLO API, to demonstrate the very likely case where a credential
 * provider is storing data in a different form from what must be provided
 * via the SPI.
 */ export interface StoredCredential { id : string ; display : string ; from : string ; password : string ; } const credentialsKey = 'credentials' ; @ Injectable ( ) export class CredentialStoreService { constructor ( ) { } getAllCredentials ( ) { let credentialsStr = localStorage . getItem ( credentialsKey ) ; if ( ! credentialsStr ) { return [ { id : 'alice@gmail.com' , display : 'Alice McTesterson' , from : 'https://www.example.com' , password : 'alice4tw' } , { id : '(650)555-1234' , display : 'Bob McTesterson' , from : 'https://www.example.com' , password : 'bob4tw' } ] ; } let credentials = JSON . parse ( credentialsStr ) ; return credentials ; } }