Encrypt
Source:
src/Fly/Encrypt.ts
Encrypt with a Fly SecretKey (nacl_box, nacl_secretbox,
xaes256gcm, …). The App and key name are fixed by Encrypt(key).
Encrypt a payload
Section titled “Encrypt a payload”Provide EncryptHttp on the Action or Service Effect. Fly
crypto ops need a KMS token. Org API tokens are typed Forbidden.
const encrypt = yield* Fly.Encrypt(Box);const { ciphertext } = yield* encrypt({ plaintext: new TextEncoder().encode("attack at dawn"),});Associated data
Section titled “Associated data”associatedData is optional AEAD associated data. Decrypt
must pass the same bytes.
const { ciphertext } = yield* encrypt({ plaintext: bytes, associatedData: nonce,});