FT4 accounts configuration
This section guides you through installing the FT4 library and configuring your accounts.
Install the FT4 library
Before diving into account configuration, you need to install the FT4 library to manage accounts effectively. Add the following code to your chromia.yml
file:
libs:
ft4:
registry: https://gitlab.com/chromaway/ft4-lib.git
path: rell/src/lib/ft4
tagOrBranch: v1.1.0r
rid: x"FEEB0633698E7650D29DCCFE2996AD57CDC70AA3BDF770365C3D442D9DFC2A5E"
insecure: false
iccf:
registry: https://gitlab.com/chromaway/core/directory-chain
path: src/iccf
tagOrBranch: 1.32.2
rid: x"1D567580C717B91D2F188A4D786DB1D41501086B155A68303661D25364314A4D"
insecure: false
Configure FT4 accounts
In this app, you will add FT4 accounts to your model, enhancing your authentication mechanism.
Start by importing the necessary modules:
import lib.ft4.core.accounts.{ account, single_sig_auth_descriptor, create_account_with_auth };
Next, define an account within the user
entity:
entity user {
mutable name;
key id: byte_array;
key account;
}
This setup enforces a one-to-one mapping between an FT4 account and a user. Now, modify the create_user
operation to also create an FT4 account:
operation register_user(name) {
val account = register_account();
val user = create user ( name, account.id, account );
create follower ( user = user, follower = user );
}
For detailed information on account permissions and the FT4 framework, refer to the FT4 Accounts and Tokens documentation.
Next, move the test section under the blockchain tag in your chromia.yml
and add the admin public key:
blockchains:
my_news_feed:
module: main
test:
modules:
- test
moduleArgs:
lib.ft4.core.admin:
admin_pubkey: x"023BEE5A479CE5AF31F6F64EDE7BEAD394E92E4D973E1727782DB577A55E878563"
compile:
rellVersion: 0.13.14
database:
schema: schema_my_news_feed
test:
modules:
- test
moduleArgs:
lib.ft4.core.admin:
admin_pubkey: x"023BEE5A479CE5AF31F6F64EDE7BEAD394E92E4D973E1727782DB577A55E878563"
libs:
ft4:
registry: https://gitlab.com/chromaway/ft4-lib.git
path: rell/src/lib/ft4
tagOrBranch: v1.1.0r
rid: x"FEEB0633698E7650D29DCCFE2996AD57CDC70AA3BDF770365C3D442D9DFC2A5E"
insecure: false
iccf:
registry: https://gitlab.com/chromaway/core/directory-chain
path: src/iccf
tagOrBranch: 1.32.2
rid: x"1D567580C717B91D2F188A4D786DB1D41501086B155A68303661D25364314A4D"
insecure: false
For further details on configuring your chromia.yml
file, refer to the Chromia Project Configuration documentation.