Noosphere Possibilities Maximized
    Wondering what’s next for npm?Check out our public roadmap! »

    gme-signature

    0.1.1 • Public • Published

    REF: https://developers.google.com/maps/documentation/directions/get-api-key#digital-signature-premium

    Usage

    /** Sign url with clientId in url */
    const sign = require('gme-signature')
    const privateKey = 'vNIXE0xscrmjlyV-12Nj_BvUPaw=' // Example from the link
    const url = 'https://maps.googleapis.com/maps/api/geocode/json?address=New+York&client=clientID'
    const signed = sign(url, privateKey)
    console.log(signed) // 'https://maps.googleapis.com/maps/api/geocode/json?address=New+York&client=clientID&signature=chaRF2hTJKOScPr-RQCEhZbSzIE='
     
    /** Sign url without clientId in url */
    const sign = require('gme-signature')
    const privateKey = 'vNIXE0xscrmjlyV-12Nj_BvUPaw=' // Example from the link
    const clientId = 'clientID'
    const url = 'https://maps.googleapis.com/maps/api/geocode/json?address=New+York'
    const signed= sign(url, privateKey, clientId)
    console.log(signed) // 'https://maps.googleapis.com/maps/api/geocode/json?address=New+York&client=clientID&signature=chaRF2hTJKOScPr-RQCEhZbSzIE='
     
    /** Example with directions api */
    const sign = require('gme-signature')
    const privateKey = 'vNIXE0xscrmjlyV-12Nj_BvUPaw=' // Example from the link
    const url = 'https://maps.googleapis.com/maps/api/directions/json?origin=25.0626333,121.515451&destination=25.064742,121.516717&client=clientID'
    const signed = sign(url, privateKey)
    console.log(signed) // 'https://maps.googleapis.com/maps/api/directions/json?origin=25.0626333,121.515451&destination=25.064742,121.516717&client=clientID&signature=MR1Qc7fTFlRGF5KqKmZV05i95rg='

    Install

    npm i gme-signature

    DownloadsWeekly Downloads

    2

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    4.76 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar