Skip to content

Commit

Permalink
Update useragent
Browse files Browse the repository at this point in the history
  • Loading branch information
Spawnrad committed Mar 13, 2023
1 parent 8240fe3 commit 8862926
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "signtok",
"version": "1.2.1",
"version": "1.3.0",
"description": "Sign your TikTok requests easily",
"repository": "https://github.com/pablouser1/SignTok",
"author": "Pablo Ferreiro",
Expand Down
7 changes: 2 additions & 5 deletions src/Signer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const fs = require("fs");
const Utils = require("./Utils");
const { JSDOM, ResourceLoader } = require("jsdom");
const { createCipheriv } = require("crypto");

class Signer {
static DEFAULT_USERAGENT =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36";
"Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-G973U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/14.2 Chrome/87.0.4280.141 Mobile Safari/537.36";
static PASSWORD = "webapp1.0+202106";
/**
* @type Window
Expand Down Expand Up @@ -55,6 +54,7 @@ class Signer {
}

xttparams(params) {
params += "&verifyFp=undefined";
params += "&is_encryption=1";
// Encrypt query string using aes-128-cbc
const cipher = createCipheriv("aes-128-cbc", Signer.PASSWORD, Signer.PASSWORD);
Expand All @@ -63,16 +63,13 @@ class Signer {

sign(url_str) {
const url = new URL(url_str);
const verifyFp = Utils.verify_fp();
url.searchParams.append('verifyFp', verifyFp);
const signature = this.signature(url.toString());
url.searchParams.append('_signature', signature);
const bogus = this.bogus(url.searchParams.toString());
url.searchParams.append('X-Bogus', bogus);
const xttparams = this.xttparams(url.searchParams.toString());
return {
signature: signature,
verify_fp: verifyFp,
signed_url: url.toString(),
"x-tt-params": xttparams,
"X-Bogus": bogus
Expand Down
5 changes: 0 additions & 5 deletions src/Utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
class Utils {
static verify_fp() {
// TODO, add proper verify fp method
return "verify_l9crwi93_kIOkZI3S_l9I2_4ARw_8GFp_IvNf0zaXa6DI";
}

static makePayload(data, navigator) {
return JSON.stringify({
status: "ok",
Expand Down

1 comment on commit 8862926

@vercel
Copy link

@vercel vercel bot commented on 8862926 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dvz-signtok – ./

dvz-signtok-spawnrad.vercel.app
dvz-signtok-git-master-spawnrad.vercel.app
dvz-signtok.vercel.app

Please sign in to comment.