Skip to content

Commit 77379d2

Browse files
committed
more comments
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent 77ac0c8 commit 77379d2

File tree

19 files changed

+236
-195
lines changed

19 files changed

+236
-195
lines changed

token/core/fabtoken/v1/driver/base.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity"
1717
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/config"
1818
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/deserializer"
19-
driver2 "github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/driver"
2019
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/membership"
2120
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/role"
2221
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/wallet"
@@ -43,7 +42,7 @@ func (d *base) DefaultValidator(pp driver.PublicParameters) (driver.Validator, e
4342

4443
func (d *base) newWalletService(
4544
tmsConfig core.Config,
46-
binder driver2.NetworkBinderService,
45+
binder identity.NetworkBinderService,
4746
storageProvider identity.StorageProvider,
4847
qe driver.QueryEngine,
4948
logger logging.Logger,

token/core/zkatdlog/nogh/v1/driver/base.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity"
1818
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/config"
1919
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/deserializer"
20-
idriver "github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/driver"
2120
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/idemix"
2221
msp2 "github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/idemix/crypto"
2322
"github.com/hyperledger-labs/fabric-token-sdk/token/services/identity/membership"
@@ -58,7 +57,7 @@ func (d *Base) DefaultValidator(pp driver.PublicParameters) (driver.Validator, e
5857

5958
func (d *Base) NewWalletService(
6059
tmsConfig core.Config,
61-
binder idriver.NetworkBinderService,
60+
binder identity.NetworkBinderService,
6261
storageProvider identity.StorageProvider,
6362
qe driver.QueryEngine,
6463
logger logging.Logger,

token/driver/wallet.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ type CertifierWallet interface {
131131
GetCertifierIdentity() (Identity, error)
132132
}
133133

134+
// IdentityConfiguration contains configuration-related information of an identity
134135
type IdentityConfiguration struct {
135136
ID string
136137
Type string

token/services/identity/driver/common.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

token/services/identity/driver/config.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,37 @@ SPDX-License-Identifier: Apache-2.0
66

77
package driver
88

9+
// ConfiguredIdentity describes an identity entry parsed from configuration.
10+
//
11+
// Fields:
12+
// - ID: the unique identifier for the identity
13+
// - Default: whether this identity should be considered the default
14+
// - Path: file-system path or location where credentials/configuration live
15+
// - CacheSize: per-identity cache size used by the identity service; 0 means no cache
16+
// - Opts: provider-specific options (opaque)
917
type ConfiguredIdentity struct {
1018
ID string `yaml:"id"`
1119
Default bool `yaml:"default,omitempty"`
1220
Path string `yaml:"path"`
1321
CacheSize int `yaml:"cacheSize"`
14-
Type string `yaml:"type,omitempty"`
1522
Opts interface{} `yaml:"opts,omitempty"`
1623
}
1724

25+
// String returns the identity's ID and satisfies fmt.Stringer.
1826
func (i *ConfiguredIdentity) String() string {
1927
return i.ID
2028
}
2129

30+
// Config is a read-only view over identity service configuration.
31+
// Implementors provide lookup helpers used by the identity service to resolve configured
32+
// identities and to normalize configured paths.
2233
type Config interface {
2334
// CacheSizeForOwnerID returns the cache size to be used for the given owner wallet.
24-
// If not defined, the function returns -1
35+
// If not defined for the given id, the function returns -1.
2536
CacheSizeForOwnerID(id string) int
37+
38+
// TranslatePath maps a configured relative or templated path to an absolute
39+
// runtime path. Implementations should resolve variables and perform any
40+
// environment-specific transformations required to locate credential files.
2641
TranslatePath(path string) string
27-
IdentitiesForRole(role IdentityRoleType) ([]ConfiguredIdentity, error)
2842
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
package driver
8+
9+
import (
10+
"context"
11+
12+
tdriver "github.com/hyperledger-labs/fabric-token-sdk/token/driver"
13+
)
14+
15+
// IdentityType identifies the type of identity.
16+
// It is an alias for tdriver.IdentityType and is used by deserializers to choose the correct
17+
// decoding logic for different identity representations.
18+
type IdentityType = tdriver.IdentityType
19+
20+
// TypedSignerDeserializer converts a raw byte representation into a concrete
21+
// Signer for a given IdentityType.
22+
// Implementations should validate the raw data and return an error on invalid input or decoding failure.
23+
type TypedSignerDeserializer interface {
24+
// DeserializeSigner deserializes the provided raw bytes into a tdriver.Signer
25+
// appropriate for the supplied identity type.
26+
// The context may carry ancillary information required for deserialization.
27+
DeserializeSigner(ctx context.Context, typ IdentityType, raw []byte) (tdriver.Signer, error)
28+
}
29+
30+
// AuditInfo represents the audit-related information for an identity.
31+
// It exposes the enrollment id and the revocation handle necessary for audit
32+
// and revocation operations.
33+
type AuditInfo interface {
34+
// EnrollmentID returns the enrollment identifier associated with this audit info.
35+
EnrollmentID() string
36+
// RevocationHandle returns the revocation handle associated with this audit info.
37+
RevocationHandle() string
38+
}
39+
40+
// AuditInfoDeserializer converts a raw byte representation into an AuditInfo instance.
41+
// Implementations should validate and parse the raw bytes and return an error on failure.
42+
//
43+
//go:generate counterfeiter -o mock/aides.go -fake-name AuditInfoDeserializer . AuditInfoDeserializer
44+
type AuditInfoDeserializer interface {
45+
// DeserializeAuditInfo deserializes the provided raw bytes into an AuditInfo value.
46+
// The context may carry ancillary information required for deserialization.
47+
DeserializeAuditInfo(ctx context.Context, raw []byte) (AuditInfo, error)
48+
}

token/services/identity/driver/driver.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

token/services/identity/driver/identity.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

token/services/identity/driver/mock/nbs.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

token/services/identity/driver/role.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package driver
99
import (
1010
"context"
1111

12-
"github.com/hyperledger-labs/fabric-token-sdk/token/driver"
12+
tdriver "github.com/hyperledger-labs/fabric-token-sdk/token/driver"
1313
)
1414

1515
// IdentityRoleType is the role of an identity
@@ -55,10 +55,12 @@ type IdentityInfo interface {
5555
type (
5656
// WalletLookupID defines the type of identifiers that can be used to retrieve a given wallet.
5757
// It can be a string, as the name of the wallet, or an identity contained in that wallet.
58-
// Ultimately, it is the token driver to decide which types are allowed.
59-
WalletLookupID = driver.WalletLookupID
60-
Identity = driver.Identity
61-
IdentityConfiguration = driver.IdentityConfiguration
58+
// Ultimately, it is the token tdriver to decide which types are allowed.
59+
WalletLookupID = tdriver.WalletLookupID
60+
// Identity represents a generic identity
61+
Identity = tdriver.Identity
62+
// IdentityConfiguration contains configuration-related information of an identity
63+
IdentityConfiguration = tdriver.IdentityConfiguration
6264
)
6365

6466
// Role is a container of long-term identities.

0 commit comments

Comments
 (0)