mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
mic & mac part 2, VBB salt
Many thanks to @alexander-albers!
This commit is contained in:
parent
6f958e14be
commit
5ac8d5f89e
3 changed files with 10 additions and 2 deletions
|
@ -41,7 +41,8 @@ const request = (profile, data) => {
|
|||
const mic = md5(Buffer.from(req.body, 'utf8'))
|
||||
req.query.mic = mic.toString('hex')
|
||||
|
||||
const mac = md5(Buffer.concat([mic, profile.salt]))
|
||||
const micAsHex = Buffer.from(mic.toString('hex'), 'utf8')
|
||||
const mac = md5(Buffer.concat([micAsHex, profile.salt]))
|
||||
req.query.mac = mac.toString('hex')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ const formatBitmask = createFormatBitmask(modes)
|
|||
const transformReqBody = (body) => {
|
||||
body.client = {type: 'IPA', id: 'VBB', name: 'vbbPROD', v: '4010300'}
|
||||
body.ext = 'VBB.1'
|
||||
body.ver = '1.11' // todo: 1.16 with `mic` and `mac` query params
|
||||
body.ver = '1.16'
|
||||
body.auth = {type: 'AID', aid: 'hafas-vbb-apps'}
|
||||
|
||||
return body
|
||||
|
@ -168,6 +168,12 @@ const vbbProfile = {
|
|||
locale: 'de-DE',
|
||||
timezone: 'Europe/Berlin',
|
||||
endpoint: 'https://fahrinfo.vbb.de/bin/mgate.exe',
|
||||
|
||||
// https://gist.github.com/derhuerst/a8d94a433358abc015ff77df4481070c#file-haf_config_base-properties-L39
|
||||
// https://runkit.com/derhuerst/hafas-decrypt-encrypted-mac-salt
|
||||
salt: Buffer.from('5243544a4d3266467846667878516649', 'hex'),
|
||||
addMicMac: true,
|
||||
|
||||
transformReqBody,
|
||||
|
||||
products: modes.allProducts,
|
||||
|
|
|
@ -174,6 +174,7 @@ The returned [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript
|
|||
- [`vbb-hafas`](https://github.com/derhuerst/vbb-hafas#vbb-hafas) – JavaScript client for Berlin & Brandenburg public transport HAFAS API.
|
||||
- [`hafas-departures-in-direction`](https://github.com/derhuerst/hafas-departures-in-direction#hafas-departures-in-direction) – Pass in a HAFAS client, get departures in a certain direction.
|
||||
- [`hafas-collect-departures-at`](https://github.com/derhuerst/hafas-collect-departures-at#hafas-collect-departures-at) – Utility to collect departures, using any HAFAS client.
|
||||
- [`hafas-discover-stations`](https://github.com/derhuerst/hafas-discover-stations#hafas-discover-stations) – Pass in a HAFAS client, discover stations by querying departures.
|
||||
- [`hafas-rest-api`](https://github.com/derhuerst/hafas-rest-api#hafas-rest-api) – Expose a HAFAS client via an HTTP REST API.
|
||||
- [List of european long-distance transport operators, available API endpoints, GTFS feeds and client modules.](https://github.com/public-transport/european-transport-operators)
|
||||
- [Collection of european transport JavaScript modules.](https://github.com/public-transport/european-transport-modules)
|
||||
|
|
Loading…
Add table
Reference in a new issue