This repository was archived by the owner on Nov 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
81 lines (65 loc) · 2.53 KB
/
Copy pathindex.d.ts
File metadata and controls
81 lines (65 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { Component } from 'react'
export interface Account {
handle: string
hostname: string
password: string
}
export interface InboxEntry {
hostname: string
email: string
}
export interface ParsedEntries {
accounts: { [key: string]: Account }
inbox: { [key: string]: InboxEntry }
}
export interface AccountMatch extends Account {
id: string
score: number
}
export type PaymentInformation = (
{ type: 'apple', transactionIdentifier: string } |
{ type: 'stripe', email: string, plan: string, token: string }
)
export type SubscriptionStatus = (
'trialing' |
'active' |
'past_due' |
'canceled' |
'unpaid'
)
export type EmptyState = { kind: 'empty' }
export type LockedState = { kind: 'locked', handle: string, secretKey: string, syncToken: string }
export type UnlockedState = { kind: 'unlocked', handle: string, parsedEntries: ParsedEntries, secretKey: string, syncToken: string }
export type ConnectedState = { kind: 'connected', handle: string, parsedEntries: ParsedEntries, hasPaymentInformation: boolean, secretKey: string, subscriptionStatus: SubscriptionStatus, syncToken: string, trialDaysLeft: number }
export type State = (EmptyState | LockedState | UnlockedState | ConnectedState)
export default class CtrlpanelCore extends Component {
currentState: State
handle: string | undefined
secretKey: string | undefined
syncToken: string | undefined
hasAccount: boolean
locked: boolean
parsedEntries: ParsedEntries | undefined
addEventListener (event: 'update', fn: () => void): void
randomAccountPassword (): Promise<string>
randomHandle (): Promise<string>
randomMasterPassword (): Promise<string>
randomSecretKey (): Promise<string>
lock (): Promise<void>
reset (syncToken: string): Promise<void>
signup (handle: string, secretKey: string, masterPassword: string): Promise<void>
login (handle: string, secretKey: string, masterPassword: string): Promise<void>
unlock (masterPassword: string): Promise<void>
connect (): Promise<void>
sync (): Promise<void>
setPaymentInformation (paymentInformation: PaymentInformation): Promise<void>
accountsForHostname (hostname: string): Promise<AccountMatch[]>
createAccount (id: string, data: Account): Promise<void>
deleteAccount (id: string): Promise<void>
updateAccount (id: string, data: Account): Promise<void>
createInboxEntry (id: string, data: InboxEntry): Promise<void>
deleteInboxEntry (id: string): Promise<void>
importFromDeseatme (exportToken: string): Promise<void>
clearStoredData (): Promise<void>
deleteUser (): Promise<void>
}