credential store API docs — add example of get

This commit is contained in:
Vladimir Krivosheev
2018-11-30 17:19:05 +01:00
parent 320bd2c4b8
commit 86693115a8
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -36,4 +36,8 @@ API allows you to get credentials only by service name.
See `CredentialStore`. API has two methods:
* `get`: Pass service name and user name. Or only service name — in this case first matched entry will be returned.
* `set`: Pass credentials attributes and credentials.
* `set`: Pass credentials attributes and credentials.
```kotlin
PasswordSafe.instance.get(CredentialAttributes(generateServiceName("Subsystem", "sub key"), username))
```
@@ -7,6 +7,9 @@ import org.jetbrains.annotations.Contract
const val SERVICE_NAME_PREFIX = "IntelliJ Platform"
/**
* [See documentation](https://github.com/JetBrains/intellij-community/blob/master/platform/credential-store/readme.md#service-name)
*/
fun generateServiceName(subsystem: String, key: String) = "$SERVICE_NAME_PREFIX $subsystem — $key"
/**