Nearsighted Penguin March

    ngx-aws4

    1.0.0 • Public • Published

    ngx-aws4

    An utility to sign http(s) request options using Amazon's AWS Signature Version 4.

    Installation

    With npm do:

    npm install ngx-aws4
    

    Example

    import * as aws4 from "ngx-aws4";
     
    ...
     
    public static getAWS4Signature(url, path) {
        let requestOptions: any = {
            host: `${AWSCredentials.AWS_STS.BUCKET_NAME}.s3.${AWSCredentials.AWS_STS.REGION}.amazonaws.com`,
            path: path
        }
     
        console.log(aws4);
     
        aws4.sign(requestOptions, {
            secretAccessKey: AWSCredentials.AWS_STS.SECRET_KEY,
            accessKeyId: AWSCredentials.AWS_STS.ACCESS_KEY,
            sessionToken: AWSCredentials.AWS_STS.SESSION_TOKEN
        })
        console.log(requestOptions);
     
        return requestOptions;
    }
     
    ...
     

    More options

    // you can also pass AWS credentials in explicitly (otherwise taken from process.env)
    aws4.sign(opts, {accessKeyId: '', secretAccessKey: ''})
     
    // can also add the signature to query strings
    aws4.sign({service: 's3', path: '/my-bucket?X-Amz-Expires=12345', signQuery: true})

    Thanks

    Thanks to @mhart

    Thanks to @jed

    Also thanks to the official node.js AWS SDK

    Install

    npm i ngx-aws4

    DownloadsWeekly Downloads

    140

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    18.5 kB

    Total Files

    6

    Last publish

    Collaborators

    • bhanuhiteshi