| 48 | // const surrogateType = 'SOME_INFO_TYPE_DEID'; |
| 49 | |
| 50 | async function reidentifyWithFpe() { |
| 51 | // Construct deidentification request |
| 52 | const item = {value: string}; |
| 53 | const request = { |
| 54 | parent: `projects/${projectId}/locations/global`, |
| 55 | reidentifyConfig: { |
| 56 | infoTypeTransformations: { |
| 57 | transformations: [ |
| 58 | { |
| 59 | primitiveTransformation: { |
| 60 | cryptoReplaceFfxFpeConfig: { |
| 61 | cryptoKey: { |
| 62 | kmsWrapped: { |
| 63 | wrappedKey: wrappedKey, |
| 64 | cryptoKeyName: keyName, |
| 65 | }, |
| 66 | }, |
| 67 | commonAlphabet: alphabet, |
| 68 | surrogateInfoType: { |
| 69 | name: surrogateType, |
| 70 | }, |
| 71 | }, |
| 72 | }, |
| 73 | }, |
| 74 | ], |
| 75 | }, |
| 76 | }, |
| 77 | inspectConfig: { |
| 78 | customInfoTypes: [ |
| 79 | { |
| 80 | infoType: { |
| 81 | name: surrogateType, |
| 82 | }, |
| 83 | surrogateType: {}, |
| 84 | }, |
| 85 | ], |
| 86 | }, |
| 87 | item: item, |
| 88 | }; |
| 89 | |
| 90 | // Run reidentification request |
| 91 | const [response] = await dlp.reidentifyContent(request); |
| 92 | const reidentifiedItem = response.item; |
| 93 | console.log(reidentifiedItem.value); |
| 94 | } |
| 95 | reidentifyWithFpe(); |
| 96 | // [END dlp_reidentify_fpe] |
| 97 | } |