* Add or change document encryption. * * If the document is already encrypted, requires owner access to change. * If unencrypted, can be called without restrictions. * * @param options - Protection options (passwords, permissions, algorithm) * @throws {PermissionDeniedError} If ins
(options: ProtectionOptions)
| 984 | * ``` |
| 985 | */ |
| 986 | setProtection(options: ProtectionOptions): void { |
| 987 | // If encrypted, need owner access to change |
| 988 | if (this.isEncrypted) { |
| 989 | const handler = this.ctx.info.securityHandler; |
| 990 | |
| 991 | if (handler && !handler.hasOwnerAccess) { |
| 992 | throw new PermissionDeniedError("Cannot change protection: requires owner access"); |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | // Mark that encryption should be applied on save |
| 997 | this._pendingSecurity = { action: "encrypt", options }; |
| 998 | } |
| 999 | |
| 1000 | // ───────────────────────────────────────────────────────────────────────────── |
| 1001 | // Metadata |
no outgoing calls
no test coverage detected