* Remove all encryption from the document. * * After calling this, the document will be saved without encryption. * Requires owner access, or user access with modify permission. * * @throws {PermissionDeniedError} If insufficient permissions to remove protection * * @example
()
| 936 | * ``` |
| 937 | */ |
| 938 | removeProtection(): void { |
| 939 | // For unencrypted documents, this is a no-op |
| 940 | if (!this.isEncrypted) { |
| 941 | return; |
| 942 | } |
| 943 | |
| 944 | const handler = this.ctx.info.securityHandler; |
| 945 | |
| 946 | if (!handler) { |
| 947 | return; |
| 948 | } |
| 949 | |
| 950 | // Check permissions |
| 951 | if (!handler.hasOwnerAccess && !handler.permissions.modify) { |
| 952 | throw new PermissionDeniedError( |
| 953 | "Cannot remove protection: requires owner access or modify permission", |
| 954 | "modify", |
| 955 | ); |
| 956 | } |
| 957 | |
| 958 | // Mark that encryption should be removed on save |
| 959 | this._pendingSecurity = { action: "remove" }; |
| 960 | } |
| 961 | |
| 962 | /** |
| 963 | * Add or change document encryption. |
no outgoing calls
no test coverage detected