Retrieves all the credentials stored in the Virtual Authenticator List of credentials If a Virtual Authenticator has not been added yet.
()
| 1137 | /// <returns> List of credentials </returns> |
| 1138 | /// <exception cref="InvalidOperationException">If a Virtual Authenticator has not been added yet.</exception> |
| 1139 | public List<Credential> GetCredentials() |
| 1140 | { |
| 1141 | string authenticatorId = this.AuthenticatorId ?? throw new InvalidOperationException("Virtual Authenticator needs to be added before it can perform operations"); |
| 1142 | |
| 1143 | Dictionary<string, object?> parameters = new Dictionary<string, object?>(); |
| 1144 | parameters.Add("authenticatorId", authenticatorId); |
| 1145 | |
| 1146 | Response getCredentialsResponse = this.Execute(driverCommandToExecute: DriverCommand.GetCredentials, parameters); |
| 1147 | |
| 1148 | getCredentialsResponse.EnsureValueIsNotNull(); |
| 1149 | if (getCredentialsResponse.Value is not object?[] credentialsList) |
| 1150 | { |
| 1151 | throw new WebDriverException($"Get credentials call succeeded, but the response was not a list of credentials: {getCredentialsResponse.Value}"); |
| 1152 | } |
| 1153 | |
| 1154 | List<Credential> credentials = new List<Credential>(credentialsList.Length); |
| 1155 | foreach (object? dictionary in credentialsList) |
| 1156 | { |
| 1157 | Credential credential = Credential.FromDictionary((Dictionary<string, object>)dictionary!); |
| 1158 | credentials.Add(credential); |
| 1159 | } |
| 1160 | |
| 1161 | return credentials; |
| 1162 | } |
| 1163 | |
| 1164 | /// <summary> |
| 1165 | /// Removes the credential identified by the credentialId from the Virtual Authenticator. |