Remove the purpose argument from all GetKey() variants.
The type is relevant and required as it determines the type of the handed in key. The purpose however isn't actually needed and rather inconvenient to get by depending on the situation.
This commit is contained in:
committed by
Ryan Leavengood
parent
90013c82e8
commit
51ab46a83c
@@ -16,27 +16,23 @@ public:
|
||||
|
||||
// TODO: -> GetNextPassword() - there can always be more than one key
|
||||
// with the same identifier/secondaryIdentifier (ie. different username)
|
||||
status_t GetKey(BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier, BKey& key);
|
||||
status_t GetKey(BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier,
|
||||
status_t GetKey(BKeyType type, const char* identifier,
|
||||
BKey& key);
|
||||
status_t GetKey(BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier, BKey& key);
|
||||
status_t GetKey(BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier,
|
||||
status_t GetKey(BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier,
|
||||
bool secondaryIdentifierOptional,
|
||||
BKey& key);
|
||||
|
||||
status_t GetKey(const char* keyring,
|
||||
BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier, BKey& key);
|
||||
BKeyType type, const char* identifier,
|
||||
BKey& key);
|
||||
status_t GetKey(const char* keyring,
|
||||
BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier,
|
||||
BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier, BKey& key);
|
||||
status_t GetKey(const char* keyring,
|
||||
BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier,
|
||||
BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier,
|
||||
bool secondaryIdentifierOptional,
|
||||
BKey& key);
|
||||
|
||||
@@ -37,8 +37,8 @@ remove_password(const char* keyring, const char* identifier,
|
||||
BKeyStore keyStore;
|
||||
BPasswordKey password;
|
||||
|
||||
status_t result = keyStore.GetKey(keyring, B_KEY_TYPE_PASSWORD,
|
||||
B_KEY_PURPOSE_ANY, identifier, secondaryIdentifier, false, password);
|
||||
status_t result = keyStore.GetKey(keyring, B_KEY_TYPE_PASSWORD, identifier,
|
||||
secondaryIdentifier, false, password);
|
||||
if (result != B_OK) {
|
||||
printf("failed to get password \"%s\": %s\n", identifier,
|
||||
strerror(result));
|
||||
|
||||
+15
-19
@@ -28,58 +28,54 @@ BKeyStore::~BKeyStore()
|
||||
|
||||
|
||||
status_t
|
||||
BKeyStore::GetKey(BKeyType type, BKeyPurpose purpose, const char* identifier,
|
||||
BKey& key)
|
||||
BKeyStore::GetKey(BKeyType type, const char* identifier, BKey& key)
|
||||
{
|
||||
return GetKey(NULL, type, purpose, identifier, NULL, true, key);
|
||||
return GetKey(NULL, type, identifier, NULL, true, key);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BKeyStore::GetKey(BKeyType type, BKeyPurpose purpose, const char* identifier,
|
||||
BKeyStore::GetKey(BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier, BKey& key)
|
||||
{
|
||||
return GetKey(NULL, type, purpose, identifier, secondaryIdentifier, true,
|
||||
key);
|
||||
return GetKey(NULL, type, identifier, secondaryIdentifier, true, key);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BKeyStore::GetKey(BKeyType type, BKeyPurpose purpose, const char* identifier,
|
||||
BKeyStore::GetKey(BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier, bool secondaryIdentifierOptional,
|
||||
BKey& key)
|
||||
{
|
||||
return GetKey(NULL, type, purpose, identifier, secondaryIdentifier,
|
||||
return GetKey(NULL, type, identifier, secondaryIdentifier,
|
||||
secondaryIdentifierOptional, key);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BKeyStore::GetKey(const char* keyring, BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier, BKey& key)
|
||||
BKeyStore::GetKey(const char* keyring, BKeyType type, const char* identifier,
|
||||
BKey& key)
|
||||
{
|
||||
return GetKey(keyring, type, purpose, identifier, NULL, true, key);
|
||||
return GetKey(keyring, type, identifier, NULL, true, key);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BKeyStore::GetKey(const char* keyring, BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier, const char* secondaryIdentifier, BKey& key)
|
||||
BKeyStore::GetKey(const char* keyring, BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier, BKey& key)
|
||||
{
|
||||
return GetKey(keyring, type, purpose, identifier, secondaryIdentifier, true,
|
||||
key);
|
||||
return GetKey(keyring, type, identifier, secondaryIdentifier, true, key);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BKeyStore::GetKey(const char* keyring, BKeyType type, BKeyPurpose purpose,
|
||||
const char* identifier, const char* secondaryIdentifier,
|
||||
bool secondaryIdentifierOptional, BKey& key)
|
||||
BKeyStore::GetKey(const char* keyring, BKeyType type, const char* identifier,
|
||||
const char* secondaryIdentifier, bool secondaryIdentifierOptional,
|
||||
BKey& key)
|
||||
{
|
||||
BMessage message(KEY_STORE_GET_KEY);
|
||||
message.AddString("keyring", keyring);
|
||||
message.AddUInt32("type", type);
|
||||
message.AddUInt32("purpose", purpose);
|
||||
message.AddString("identifier", identifier);
|
||||
message.AddString("secondaryIdentifier", secondaryIdentifier);
|
||||
message.AddBool("secondaryIdentifierOptional", secondaryIdentifierOptional);
|
||||
|
||||
Reference in New Issue
Block a user