Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Melody by Me and File Privacy Management

Melody by Me and File Privacy Management

LINE Developers Thailand

October 16, 2021
Tweet

More Decks by LINE Developers Thailand

Other Decks in Technology

Transcript

  1. • LINE MELODY and Melody by Me • Files management

    overview • File privacy with presigned url • Want to make it more secure? AGENDA
  2. import { S3 } from ‘aws-sdk’; const s3Con fi g

    = { endpoint: ‘HOST’, accessKeyId: ‘ACCESS_KEY’, secretAccessKey: ‘SECRET_KEY’, }; const client = new S3(s3Con fi g); const params = { Bucket: ‘melody’, Key: ‘private/folder_name/ fi le_name.m4a’, }; const previewUrl = client.getSignedUrl(‘getObject’, params); Presigned URL Implementation
  3. const params = { Bucket: ‘melody’, Key: ‘private/folder_name/ fi le_name.m4a’,

    Expires: 60, // seconds }; const previewUrl = client.getSignedUrl(‘getObject’, params); Set Expires
  4. import { S3 } from ‘aws-sdk’; const s3Con fi g

    = { endpoint: ‘HOST’, accessKeyId: env.S3_ACCESS_KEY, secretAccessKey: env.S3_SECRET_KEY, }; const client = new S3(s3Con fi g); Rotate Keys