summaryrefslogtreecommitdiff
path: root/packages/aml-backoffice-ui/src/utils/types.ts
blob: fd70d4e4d07be9c4ecc96beb8b86258106280507 (plain)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
export namespace AmlExchangeBackend {
  // FIXME: placeholder
  export interface AmlError {
    code: number;
    hint: string;
  }
  export interface AmlDecisionDetails {
    // Array of AML decisions made for this account. Possibly
    // contains only the most recent decision if "history" was
    // not set to 'true'.
    aml_history: AmlDecisionDetail[];

    // Array of KYC attributes obtained for this account.
    kyc_attributes: KycDetail[];
  }

  type AmlOfficerPublicKeyP = string;

  export interface AmlDecisionDetail {
    // What was the justification given?
    justification: string;

    // What is the new AML state.
    new_state: Integer;

    // When was this decision made?
    decision_time: Timestamp;

    // What is the new AML decision threshold (in monthly transaction volume)?
    new_threshold: Amount;

    // Who made the decision?
    decider_pub: AmlOfficerPublicKeyP;
  }
  export interface KycDetail {
    // Name of the configuration section that specifies the provider
    // which was used to collect the KYC details
    provider_section: string;

    // The collected KYC data.  NULL if the attribute data could not
    // be decrypted (internal error of the exchange, likely the
    // attribute key was changed).
    attributes?: Object;

    // Time when the KYC data was collected
    collection_time: Timestamp;

    // Time when the validity of the KYC data will expire
    expiration_time: Timestamp;
  }

  interface Timestamp {
    // Seconds since epoch, or the special
    // value "never" to represent an event that will
    // never happen.
    t_s: number | "never";
  }

  type PaytoHash = string;
  type Integer = number;
  type Amount = string;
  // EdDSA signatures are transmitted as 64-bytes base32
  // binary-encoded objects with just the R and S values (base32_ binary-only).
  type EddsaSignature = string;

  export interface AmlRecords {
    // Array of AML records matching the query.
    records: AmlRecord[];
  }

  interface AmlRecord {
    // Which payto-address is this record about.
    // Identifies a GNU Taler wallet or an affected bank account.
    h_payto: PaytoHash;

    // What is the current AML state.
    current_state: AmlState;

    // Monthly transaction threshold before a review will be triggered
    threshold: Amount;

    // RowID of the record.
    rowid: Integer;
  }

  export enum AmlState {
    normal = 0,
    pending = 1,
    frozen = 2,
  }


  export interface AmlDecision {

    // Human-readable justification for the decision.
    justification: string;

    // At what monthly transaction volume should the
    // decision be automatically reviewed?
    new_threshold: Amount;

    // Which payto-address is the decision about?
    // Identifies a GNU Taler wallet or an affected bank account.
    h_payto: PaytoHash;

    // What is the new AML state (e.g. frozen, unfrozen, etc.)
    // Numerical values are defined in AmlDecisionState.
    new_state: Integer;

    // Signature by the AML officer over a
    // TALER_MasterAmlOfficerStatusPS.
    // Must have purpose TALER_SIGNATURE_MASTER_AML_KEY.
    officer_sig: EddsaSignature;

    // When was the decision made?
    decision_time: Timestamp;

    // Optional argument to impose new KYC requirements
    // that the customer has to satisfy to unblock transactions.
    kyc_requirements?: string[];
  }


}