1 | # Airbitz Javascript UI
|
2 |
|
3 | This repo implements a UI layer on top of [airbitz-core-js](https://github.com/Airbitz/airbitz-core-js) to provide web applications the interface required to do all the accounts management in just a small handful of Javascript API calls. All UI operates in an overlay iframe on top of the current HTML view.
|
4 |
|
5 | ## Build from source repo
|
6 |
|
7 | `npm install` to fetch the dependencies.
|
8 | `npm run build` to create the web bundle.
|
9 |
|
10 | ## Basic usage
|
11 |
|
12 | Get an API key from
|
13 |
|
14 | https://developer.airbitz.co
|
15 |
|
16 | You'll need an account on the Airbitz Mobile App which you can download for iOS and Android at
|
17 |
|
18 | https://airbitz.co/app
|
19 |
|
20 | On the `developer.airbitz.co` page, scan the QR code using the Airbitz Mobile App after signing in and register an email address.
|
21 |
|
22 | Install from npm
|
23 |
|
24 | npm install airbitz-core-js-ui --save
|
25 |
|
26 | or just include this repo somewhere in your server's path.
|
27 |
|
28 | Include the `abcui.js` file in your code
|
29 |
|
30 | <script src="/path-to-abcui/assets/js/abcui.js"></script>
|
31 |
|
32 | where `/path-to-abcui/` leads to the root directory of this repo when accessed via HTTP.
|
33 |
|
34 | Now start diving in and make some calls
|
35 |
|
36 | Initialize the library
|
37 |
|
38 | _abcUi = abcui.makeABCUIContext({'apiKey': 'api-key-here',
|
39 | 'accountType': 'account:repo:com.mydomain.myapp',
|
40 | 'bundlePath': '/path-to-abcui/',
|
41 | 'vendorName': 'My Awesome Project',
|
42 | 'vendorImageUrl': 'https://mydomain.com/mylogo.png'});
|
43 |
|
44 | Create an overlay popup where a user can register a new account or login to a previously created account via password or PIN.
|
45 |
|
46 | _abcUi.openLoginWindow(function(error, account) {
|
47 | _account = account;
|
48 | });
|
49 |
|
50 | ![Login UI](https://airbitz.co/go/wp-content/uploads/2016/08/Screen-Shot-2016-08-26-at-12.50.04-PM.png)
|
51 |
|
52 |
|
53 | Launch an account management window for changing password, PIN, and recovery questions
|
54 |
|
55 | _abcUi.openManageWindow(_account, function(error) {
|
56 |
|
57 | });
|
58 |
|
59 | ![Manage UI](https://airbitz.co/go/wp-content/uploads/2016/08/Screen-Shot-2016-08-26-at-12.50.26-PM.png)
|
60 |
|
61 | Get a rootkey that can be used as raw entropy for a cryptocurrency master key
|
62 |
|
63 | > Note that this is a temporary API as production API will store keys in an ABCWallet object
|
64 |
|
65 | _account.repoInfo.dataKey.toString('base64')
|
66 |
|
67 | Logoff a user
|
68 |
|
69 | _account.logout();
|
70 |
|
71 | ## Sample website repo
|
72 |
|
73 | See a sample implementation at [airbitz-core-js-sample](https://github.com/Airbitz/airbitz-core-js-sample)
|
74 |
|
75 | # Detailed Docs
|
76 |
|
77 | https://developer.airbitz.co/javascript/#airbitz-account-management-ui
|