Skip to content

Commit 50730c3

Browse files
committed
fixup! identity service refactoring
Signed-off-by: Angelo De Caro <[email protected]>
1 parent 53a72e6 commit 50730c3

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

docs/services/identity.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,38 @@ This registry relies on the token driver to implement the specific wallet functi
4141

4242
In essence, the Token-SDK identity service provides a secure and flexible framework for managing access control within your system.
4343

44-
The identity service is locate under [`token/services/identity`](./../../token/services/identity).
44+
The identity service is locate under [`token/services/identity`](./../../token/services/identity).
45+
46+
## Understanding Roles in More Detail
47+
48+
Building on the concept of long-term identities, we'll now explore how they are grouped into roles within the identity service.
49+
50+
Each role acts as a container for long-term identities, which are then used to create wallets. Here's the interface that defines a role:
51+
52+
```go
53+
// Role is a container of long-term identities.
54+
// A long-term identity is then used to construct a wallet.
55+
type Role interface {
56+
// MapToID returns the long-term identity and its identifier for the given index.
57+
// The index can be an identity or a label (string).
58+
MapToID(v interface{}) (view.Identity, string, error)
59+
// GetIdentityInfo returns the long-term identity info associated to the passed id
60+
GetIdentityInfo(id string) driver.IdentityInfo
61+
// RegisterIdentity registers the given identity
62+
RegisterIdentity(id string, path string) error
63+
// IDs returns the identifiers contained in this role
64+
IDs() ([]string, error)
65+
// Reload the roles with the respect to the passed public parameters
66+
Reload(pp driver.PublicParameters) error
67+
}
68+
```
69+
70+
This interface offers functions for managing identities within the role.
71+
You, as the developer, have the flexibility to implement a role using any identity representation that best fits your application's needs.
72+
For example, a role could even encompass identities based on various cryptographic schemes.
73+
74+
The identity service conveniently provides two built-in implementations of the Role interface.
75+
Both implementations leverage the concept of Hyperledger Fabric MSP ([https://hyperledger-fabric.readthedocs.io/en/latest/msp.html](https://hyperledger-fabric.readthedocs.io/en/latest/msp.html)):
76+
77+
* **MSP X.509:** This implementation retrieves long-term identities from local folders adhering to the X.509-based MSP format.
78+
* **MSP Idemix:** This implementation loads long-term identities from local folders that follow the Idemix-based MSP format.

0 commit comments

Comments
 (0)