@redspher2021/axios-http-signing
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Axios plugin: HTTP signing

This library permit to sign with axios and private rsa key

import authorizeWithDigest from '@redspher/axios-http-signing';
import axios from 'axios';

const client = axios.create();

authorizeWithDigest(client, {
    keyId: 'DEMO.myApp',
    privKey: '{the private key: put the content of a rsa private key in pem format}',
    headers: [
        '(request-target)',
        'date',
        'digest',
    ],
});

// Now when you use the client, it will add the headers to sign to api
client.post('https://fakeurl/api', { toto: 'toto' }, {
        headers: {
            'signing-auth': 'ok',
        },
    })
    .then(console.log)
    .catch(console.error);

/@redspher2021/axios-http-signing/

    Package Sidebar

    Install

    npm i @redspher2021/axios-http-signing

    Weekly Downloads

    4

    Version

    1.0.4

    License

    ISC

    Unpacked Size

    27.9 kB

    Total Files

    13

    Last publish

    Collaborators

    • mrazafindrazaka
    • glickel_redspher
    • gbo-redspher
    • fanshan
    • redpsherit