(info: {
name?: string | null
email?: string | null
image?: string | null
})
| 108 | } |
| 109 | |
| 110 | export async function setZooCodeUserInfo(info: { |
| 111 | name?: string | null |
| 112 | email?: string | null |
| 113 | image?: string | null |
| 114 | }): Promise<void> { |
| 115 | if (!secretStorage) return |
| 116 | |
| 117 | if (info.name) { |
| 118 | await secretStorage.store(ZOO_CODE_USER_NAME_KEY, info.name) |
| 119 | _cachedUserName = info.name |
| 120 | } else if (info.name === null) { |
| 121 | await secretStorage.delete(ZOO_CODE_USER_NAME_KEY) |
| 122 | _cachedUserName = undefined |
| 123 | } |
| 124 | |
| 125 | if (info.email) { |
| 126 | await secretStorage.store(ZOO_CODE_USER_EMAIL_KEY, info.email) |
| 127 | _cachedUserEmail = info.email |
| 128 | } else if (info.email === null) { |
| 129 | await secretStorage.delete(ZOO_CODE_USER_EMAIL_KEY) |
| 130 | _cachedUserEmail = undefined |
| 131 | } |
| 132 | |
| 133 | if (info.image) { |
| 134 | await secretStorage.store(ZOO_CODE_USER_IMAGE_KEY, info.image) |
| 135 | _cachedUserImage = info.image |
| 136 | } else if (info.image === null) { |
| 137 | await secretStorage.delete(ZOO_CODE_USER_IMAGE_KEY) |
| 138 | _cachedUserImage = undefined |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | export async function clearZooCodeUserInfo(): Promise<void> { |
| 143 | if (!secretStorage) return |
no test coverage detected