0.1.2 • Published 2 months ago

gme-signature v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
2 months ago

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='
0.1.2

2 months ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago