* Authenticate with a password. * * Tries both user and owner password validation. * Call with empty Uint8Array for documents with no password. * * @param password - UTF-8 encoded password bytes * @returns Authentication result
(password: Uint8Array)
| 128 | * @returns Authentication result |
| 129 | */ |
| 130 | authenticate(password: Uint8Array): AuthResult { |
| 131 | // Try user password first (most common) |
| 132 | const userResult = this.tryUserPassword(password); |
| 133 | if (userResult.authenticated) { |
| 134 | return userResult; |
| 135 | } |
| 136 | |
| 137 | // Try owner password |
| 138 | const ownerResult = this.tryOwnerPassword(password); |
| 139 | if (ownerResult.authenticated) { |
| 140 | return ownerResult; |
| 141 | } |
| 142 | |
| 143 | // Authentication failed |
| 144 | return { |
| 145 | authenticated: false, |
| 146 | permissions: this.encryptDict.permissions, |
| 147 | isOwner: false, |
| 148 | }; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Authenticate with a string password (convenience method). |
no test coverage detected