diff --git a/platform/credential-store/readme.md b/platform/credential-store/readme.md index 7eacd0224374..369d06642f2e 100644 --- a/platform/credential-store/readme.md +++ b/platform/credential-store/readme.md @@ -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. \ No newline at end of file +* `set`: Pass credentials attributes and credentials. + +```kotlin +PasswordSafe.instance.get(CredentialAttributes(generateServiceName("Subsystem", "sub key"), username)) +``` \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt b/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt index 59fcda0ecbec..d7174e2e3917 100644 --- a/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt +++ b/platform/platform-api/src/com/intellij/credentialStore/CredentialAttributes.kt @@ -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" /**