(
input_: (typeof moveProcedureStep1)['_def']['_output_out'],
)
| 185 | } |
| 186 | |
| 187 | async function step2( |
| 188 | input_: (typeof moveProcedureStep1)['_def']['_output_out'], |
| 189 | ): Promise<(typeof moveProcedureStep2)['_def']['_input_in']> { |
| 190 | const sourceGroupId = await internals.realtime.hget( |
| 191 | 'page', |
| 192 | input.pageId, |
| 193 | 'group-id', |
| 194 | ); |
| 195 | |
| 196 | const oldPageKeyring = await pageKeyrings()( |
| 197 | `${sourceGroupId}:${input.pageId}`, |
| 198 | ).getAsync(); |
| 199 | |
| 200 | if (oldPageKeyring?.topLayer !== DataLayer.Raw) { |
| 201 | throw new Error('Invalid page keyring'); |
| 202 | } |
| 203 | |
| 204 | const newPageKeyring = createSymmetricKeyring(); |
| 205 | |
| 206 | const pageEncryptedSymmetricKeyring = newPageKeyring.wrapSymmetric( |
| 207 | destGroupContentKeyring!, |
| 208 | { |
| 209 | associatedData: { |
| 210 | context: 'PageKeyring', |
| 211 | pageId: input.pageId, |
| 212 | }, |
| 213 | }, |
| 214 | ).wrappedValue; |
| 215 | |
| 216 | const pageEncryptedRelativeTitle = newPageKeyring.encrypt( |
| 217 | oldPageKeyring.decrypt(input_.pageEncryptedRelativeTitle, { |
| 218 | padding: true, |
| 219 | associatedData: { |
| 220 | context: 'PageRelativeTitle', |
| 221 | pageId: input.pageId, |
| 222 | }, |
| 223 | }), |
| 224 | { |
| 225 | padding: true, |
| 226 | associatedData: { |
| 227 | context: 'PageRelativeTitle', |
| 228 | pageId: input.pageId, |
| 229 | }, |
| 230 | }, |
| 231 | ); |
| 232 | |
| 233 | const pageEncryptedAbsoluteTitle = newPageKeyring.encrypt( |
| 234 | oldPageKeyring.decrypt(input_.pageEncryptedAbsoluteTitle, { |
| 235 | padding: true, |
| 236 | associatedData: { |
| 237 | context: 'PageAbsoluteTitle', |
| 238 | pageId: input.pageId, |
| 239 | }, |
| 240 | }), |
| 241 | { |
| 242 | padding: true, |
| 243 | associatedData: { |
| 244 | context: 'PageAbsoluteTitle', |
nothing calls this directly
no test coverage detected