Package org.hyperledger.fabric.gateway
Interface Wallet
-
public interface Wallet
Wallet defines the interface for storing and managing users' identities in a Fabric network.- See Also:
- Developing Fabric Applications - Wallet
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Wallet.Identity
Represents a user's identity that is required to connect to a Fabric network.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Wallet
createFileSystemWallet(java.nio.file.Path basePath)
Creates a wallet instance that is backed by files on the local filesystem.static Wallet
createInMemoryWallet()
Creates a wallet instance that is held in the client application heap.boolean
exists(java.lang.String label)
Query the existence of an identity in the wallet.Wallet.Identity
get(java.lang.String label)
Extracts an identity from the wallet.java.util.Set<java.lang.String>
getAllLabels()
Lists the labels of all identities in the wallet.void
put(java.lang.String label, Wallet.Identity identity)
Inserts an identity into the wallet.void
remove(java.lang.String label)
Removes an identity from the wallet.
-
-
-
Method Detail
-
createFileSystemWallet
static Wallet createFileSystemWallet(java.nio.file.Path basePath) throws java.io.IOException
Creates a wallet instance that is backed by files on the local filesystem. If the directory specified by basePath does not exist, then it is created and an empty wallet is returned. If a wallet already exists at the directory specified by basePath then a wallet is returned that contains the identities that were stored on the filesystem.- Parameters:
basePath
- A directory path.- Returns:
- A wallet backed by the file store.
- Throws:
java.io.IOException
- if an I/O error occurs accessing wallet state.
-
createInMemoryWallet
static Wallet createInMemoryWallet()
Creates a wallet instance that is held in the client application heap. Note that this not persistent and is provided for test purposes.- Returns:
- A newly created empty wallet
-
put
void put(java.lang.String label, Wallet.Identity identity) throws java.io.IOException
Inserts an identity into the wallet.- Parameters:
label
- The label associated with the identity in the wallet.identity
- The identity to put in the wallet.- Throws:
java.io.IOException
- if an I/O error occurs accessing wallet state.
-
get
Wallet.Identity get(java.lang.String label) throws java.io.IOException
Extracts an identity from the wallet.- Parameters:
label
- The label associated with the identity in the wallet.- Returns:
- The identity.
- Throws:
java.io.IOException
- if an I/O error occurs accessing wallet state.
-
getAllLabels
java.util.Set<java.lang.String> getAllLabels() throws java.io.IOException
Lists the labels of all identities in the wallet.- Returns:
- The set of identity labels.
- Throws:
java.io.IOException
- if an I/O error occurs accessing wallet state.
-
remove
void remove(java.lang.String label) throws java.io.IOException
Removes an identity from the wallet.- Parameters:
label
- The label associated with the identity in the wallet.- Throws:
java.io.IOException
- if an I/O error occurs accessing wallet state.
-
exists
boolean exists(java.lang.String label) throws java.io.IOException
Query the existence of an identity in the wallet.- Parameters:
label
- The label associated with the identity in the wallet.- Returns:
- true if the label exists, false otherwise.
- Throws:
java.io.IOException
- if an I/O error occurs accessing wallet state.
-
-