Browser Extension for managing identities and logging in to Fabric applications.
Additional extension features and configurations can be accessed in the settings page on the top-right corner of the first home-page
- Wallet password, also used to encrypt data before being stored
- Import/Export seed phrases
- Enable/Disable Chains for each identity
- Create additional identities
npm inpm run build(one-off compile) ornpm start(webpack dev server for iteration)- Open
chrome://extensions/in Chromium - Enable Developer mode, click Load unpacked, and select this repo’s
assets/directory (webpack output) - The extension should appear in the toolbar; pin it if you want quick access.
Use a minimal local server (backed by @fabric/http) that serves the compiled assets/ tree (same files you load as unpacked in Chromium):
- In one terminal, start the harness (runs
npm run build, then the server):npm run serve:test
- In Chromium, load unpacked extension from
assets/(see Quick Start). - Popup UI in a normal tab (no
chrome-extension://URL): openhttp://127.0.0.1:3003/popup.html(or setPORT— e.g.PORT=3044matchesplaywright.config.ts/npm run test:ui).IdentityManagerfalls back whenchrome.storageis missing so you can click through the UI; persistence only works inside the real extension popup. - Content script harness: open
http://127.0.0.1:3003/test.htmlon the same port as step 3. - Validate on
test.html:window.fabricExtensionwindow.fabricExtension.chrome.runtime.sendMessage({ type: 'FABRIC_ACTION' }, console.log)→ response includessuccess: trueandsource: 'local-test-server'.
- Upon clicking the extension icon for the first time, a new tab opens with onboarding modals showcasing extension features and options to import or create a new seed.
- Users will be asked to set an encryption password (which could later be changed in the settings)
- When choosing to create a new seed, a 12 word seed phrase will be given and seed verification page will display afterwards.
- After completing these steps, user would be navigated to localhost:3000 a demo fabric application (portal-web) to be hosted with a separate terminal window.
- When wallet has been imported / initiated, users could toggle and view addresses of different chains.
- While on fabric applications, users could test the signing feature by clicking the login button when on portal-web or by entering
window.portal.request()in the console
Data stored in leveldb is encrypted with the subtleCrypto AES-GCM algorithm. Encryption methods are found in fabric/core/types/subtleCrypto
- Description : Import Key for SubtleCrypto Encryption
- Description : Generate Key for SubtleCrypto Encryption
- Description : Encrypt data
- Params
- {ArrayBuffer} data : Data to be encrypted
- {CryptoKey} key : Key to be used for encryption
- {Uint8Array} iv : Initial Vector for encryption
- Description : Decrypt data
- Params
- {ArrayBuffer} data : Data to be decrypted
- {CryptoKey} key : Key to be used for decryption
- {Uint8Array} iv : Initial Vector for decryption
- Description : Encrypt data to string
- Params
- {ArrayBuffer} data : Data to be encrypted
- Description : Decrypt data from string
- Params
- {String} data : Data to be decrypted
Per-chain derivation and address formatting live in src/UIElements/IdentityManager.tsx (BIP32 / bech32 paths). Add shared config there or in a new src/config/chains.ts when you formalize multiple chains.
- Description : Initialize leveldb with chain flags set to true
- Description : Set seed phrase to setting
- Params
- {Array} phrase : 12 seed phrases
- Description : Insert a new account
- Params
- {object} account : Account Info
- Description : Insert identity into an account
- Params
- {IIdentity} identity : array of identities generated from account
- {number} accountId : index of account generated from seed.
- Description : Enable/disable chain operability for specified idenity
- Params
- {number} accountId : Account index
- {number} identity : identity index
- {number} chain : chain's id listed in browser extension
- {boolean} state : boolean to enable or disable chain
- Description : Enable/disable chain operability for wallet
- Params
- {Array} settings : Chain Settings
- Description : Check if there is an account in the store
- Description : Get global chain state
- Description : Get specific account from the store
- Params
- {number} accountId : Account Index
- Description : Check if the password inputed is same as saved in the store
- Params
- {number} accountId : Account Index
- {string} passHash : Hashed Password
- Description : Change the password in the store
- Params
- {number} accountId : Account Index
- {string} password : Hashed Password
- Description : Retrieves private key of account in the store
- Params
- {number} accountId : Account Index
- Description : Get Count of identities of an account
- Params
- {number} accountId : Account Index