File tree 4 files changed +16
-14
lines changed
catalyst_voices/packages/internal
catalyst_voices_models/lib/src/user
4 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 1
1
enum AccountRole {
2
- voter (roleNumber: 0 ),
2
+ /// An account role that is assigned to every account.
3
+ /// Allows to vote for proposals.
4
+ voter (number: 0 ),
3
5
4
- // TODO(dtscalac): the RBAC specification doesn't define yet the role number
5
- // for the proposer, replace this arbitrary number when it's specified.
6
- proposer (roleNumber: 1 ),
6
+ /// A delegated representative that can vote on behalf of other accounts.
7
+ drep (number: 1 ),
7
8
8
- // TODO(dtscalac): the RBAC specification doesn't define yet the role number
9
- // for the drep, replace this arbitrary number when it's specified.
10
- drep (roleNumber: 2 );
9
+ /// An account role that can create new proposals.
10
+ proposer (number: 3 );
11
11
12
12
/// The RBAC specified role number.
13
- final int roleNumber ;
13
+ final int number ;
14
14
15
- const AccountRole ({required this .roleNumber });
15
+ const AccountRole ({required this .number });
16
16
17
17
/// Returns the role which is assigned to every user.
18
18
static AccountRole get root => voter;
Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ import 'package:catalyst_voices_models/catalyst_voices_models.dart';
3
3
4
4
/// Derives key pairs from a seed phrase.
5
5
final class KeyDerivation {
6
+ /// See: https://github.com/input-output-hk/catalyst-voices/pull/1300
7
+ static const int _purpose = 508 ;
8
+ static const int _type = 139 ;
9
+ static const int _account = 0 ; // Future Use
6
10
final CatalystKeyDerivation _keyDerivation;
7
11
8
12
const KeyDerivation (this ._keyDerivation);
@@ -44,9 +48,7 @@ final class KeyDerivation {
44
48
45
49
/// The path feed into key derivation algorithm
46
50
/// to generate a key pair from a seed phrase.
47
- ///
48
- // TODO(dtscalac): update when RBAC specifies it
49
51
String _roleKeyDerivationPath (AccountRole role) {
50
- return "m/${role .roleNumber }'/1234' " ;
52
+ return "m/$_purpose '/$ _type '/$ _account '/$ {role .number }/0 " ;
51
53
}
52
54
}
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ final class RegistrationTransactionBuilder {
82
82
// TODO(dtscalac): when RBAC specification will define other roles
83
83
// they should be registered here
84
84
RoleData (
85
- roleNumber: AccountRole .root.roleNumber ,
85
+ roleNumber: AccountRole .root.number ,
86
86
roleSigningKey: const LocalKeyReference (
87
87
keyType: LocalKeyReferenceType .x509Certs,
88
88
offset: 0 ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ void main() {
31
31
for (final role in AccountRole .values) {
32
32
final keyPair = await keyDerivation.deriveKeyPair (
33
33
masterKey: masterKey,
34
- path: "m/${role .roleNumber }'/1234'" ,
34
+ path: "m/${role .number }'/1234'" ,
35
35
);
36
36
expect (keyPair, isNotNull);
37
37
}
You can’t perform that action at this time.
0 commit comments