Retrieving a public key
GetPublicKey.Done done = new GetPublicKey.Done() {
void onGetPublicKeyDone(@NonNull PublicKey publicKey) {
// The object was found, and the public key was parsed
}
void onGetPublicKeyInvalid(@NonNull String reason) {
// The object was not found, or not a valid public key
}
void onGetPublicKeyFailed(@NonNull String error) {
// The store reported an error
}
};
new GetPublicKey(hash, store, keyPair, done);
var done = keyPair.getPublicKey(hash, store);
done.onDone = function(publicKey) {
// The object was found, and the public key was parsed
};
done.onInvalid = function(reason) {
// The object was not found, or not a valid public key
};
done.onFailed = function(error) {
// The store reported an error
};
my ($publicKey, $invalidReason, $storeError) = $keyPair->getPublicKey($hash, $store);
if (defined $storeError) {
# The store reported an error
} elsif (defined $invalidReason) {
# The object was not found, or not a valid public key
} else {
# The object was found, and the public key was parsed
}
Retrieves a public key object from a store, and parses its public key.
If the store reported an error, the operation fails with that error. It may succeed when called again at a later time.
If the object is not found, or does not contain a public key, the operation fails as invalid.