ungoogle (0.1.0)
Installation
registry=npm install ungoogle@0.1.0"ungoogle": "0.1.0"About this package
ungoogle
decodes google's /goto?url= redirector links as far as the math allows
the format
payload := base64url( protobuf {
1: varint format version, currently 1, ignored by the server
2: bytes tink aead box
})
box := 0x01 | keyId[4] | nonce[12] | aes-gcm(plaintext) | tag[16]
the plaintext is a small protobuf holding the target url plus a constant 23-byte tail (click id and timestamp), sealed with a key that never leaves google's keyset
aaand across the sample links the key id 0xEB3B3015 is shared and the nonces are
unique, so there is no nonce-reuse shortcut either
usage
import { decodePacket, findGotoLinks, formatPacket } from 'ungoogle'
const packet = decodePacket('https://www.google.com/goto?url=CAESVAHrOzAV...')
packet.version // 1
packet.keyId // 0xEB3B3015
packet.nonce // Uint8Array(12)
packet.ciphertext // Uint8Array(51)
packet.tag // Uint8Array(16)
packet.targetLength // 28, derived from the ciphertext size
packet.payload // the bare base64url blob
console.log(formatPacket(packet))
findGotoLinks(something) // every /goto link in a blob of text
dev
pnpm i
pnpm build
pnpm lint
pnpm test
Dependencies
Development dependencies
| ID | Version |
|---|---|
| @antfu/eslint-config | ^9.5.1 |
| @swc/core | ^1.16.2 |
| @swc/jest | ^0.2.39 |
| @types/node | ^24.13.4 |
| eslint | ^10.10.0 |
| jest | ^30.5.1 |
| typescript | ^5.7.0 |