This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // From the polyfill of UInt8Array().toHex(), for some reason, you cannot .map a Uint8Array with the same result | |
| // https://github.com/tc39/proposal-arraybuffer-base64/blob/main/playground/polyfill-core.mjs | |
| function uint8ArrayToHex(arr: Uint8Array) { | |
| let out = ''; | |
| for (let i = 0; i < arr.length; i += 1) { | |
| out += arr[i]!.toString(16).padStart(2, '0'); | |
| } | |
| return out; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { DecryptCommand, EncryptCommand, KMSClient } from '@aws-sdk/client-kms'; | |
| const client = new KMSClient({}); | |
| const keyId = 'alias/some-kms-key-id'; | |
| const encoder = new TextEncoder(); | |
| const decoder = new TextDecoder('utf-8', { | |
| fatal: true, | |
| }); |