Search…
Managing Password Vaults
A Vault is a reference to vault data held internally by the Password Manager. To access the contents of a vault, the vault is passed to the Password Manager.

Creating a Vault

To effectively manage a user's contents, a vault needs to be created. All vaults that will be created must have an association with a Sudo. A Sudo can be created and retrieved using the Sudo Profiles SDK. After either creating or retrieving a Sudo, the Sudo's id will be passed to the createVault function to asynchronously create a vault. If the Password Manager is successful a vault will be returned.
TypeScript
Swift
Kotlin
1
try {
2
const sudoId = ""
3
const vaultId = await client.createVault(sudoId)
4
} catch (error) {
5
// handle errors or throw the error
6
throw error
7
}
Copied!
1
var client: PasswordManagerClient!
2
3
client.createVault(sudoId: "") { (result) in
4
switch result {
5
case .success(let vault):
6
break
7
case .failure(let error):
8
break
9
}
10
}
Copied!
1
// val client: SudoPasswordManagerClient
2
// val sudoId: String
3
4
launch {
5
try {
6
val vault = withContext(Dispatchers.IO) {
7
client.createVault(sudoId)
8
}
9
} catch (e: SudoPasswordManagerException) {
10
// Handle/notify user of exception
11
}
12
}
Copied!
When creating vaults under a Sudo, be aware of Password Entitlement limits.

Getting Vaults

Use listVaults to retrieve a list of all the vaults owned by the user. Use the list to filter for vaults owned by a Sudo or access the contents of the vault by using the id of one of the vaults returned from the function.
TypeScript
Swift
Kotlin
1
const vaults = await client.listVaults()
2
// each vault in the array of vaults has an `id`
3
// which can be used to access its items.
Copied!
1
var client: PasswordManagerClient!
2
3
client.listVaults { (result) in
4
switch result {
5
case .success(let vaults):
6
break
7
case .failure(let error):
8
break
9
}
10
}
11
12
client.getVault(withId: "1") { (result) in
13
switch result {
14
case .success(let vault):
15
break
16
case .failure(let error):
17
break
18
}
19
}
Copied!
1
// val client: SudoPasswordManagerClient
2
3
launch {
4
try {
5
val vaults = withContext(Dispatchers.IO) {
6
client.listVaults()
7
client.getVault("1")
8
}
9
} catch (e: SudoPasswordManagerException) {
10
// Handle any errors related to fetching vaults
11
}
12
}
Copied!

Deleting a Vault

To delete a vault, call the deleteVault function and pass in the id of the vault you wish to delete.
TypeScript
Swift
Kotlin
1
const vaultId = "1"
2
await client.deleteVault(vaultId)
Copied!
1
var client: PasswordManagerClient!
2
3
client.deleteVault(withId: "1") { (result) in
4
switch result {
5
case .success:
6
break
7
case .failure(let error):
8
break
9
}
10
}
Copied!
1
// val client: SudoPasswordManagerClient
2
3
launch {
4
try {
5
withContext(Dispatchers.IO) {
6
client.deleteVault("1")
7
}
8
} catch (e: SudoPasswordManagerException) {
9
// Handle any errors related to vault deletion
10
}
11
}
Copied!
To learn more about key concepts surrounding Sudos, see Sudo digital identities.
Last modified 8mo ago