File: generate_creds.go

package info (click to toggle)
snowflake 2.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,104 kB
  • sloc: makefile: 5
file content (36 lines) | stat: -rw-r--r-- 851 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"fmt"

	sqscreds "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/sqscreds/lib"
)

// This script can be run to generate the encoded SQS credentials to pass as a CLI param or SOCKS option to the client
func main() {
	var accessKey, secretKey string

	fmt.Print("Enter Access Key: ")
	_, err := fmt.Scanln(&accessKey)
	if err != nil {
		fmt.Println("Error reading access key:", err)
		return
	}

	fmt.Print("Enter Secret Key: ")
	_, err = fmt.Scanln(&secretKey)
	if err != nil {
		fmt.Println("Error reading access key:", err)
		return
	}

	awsCreds := sqscreds.AwsCreds{AwsAccessKeyId: accessKey, AwsSecretKey: secretKey}
	println()
	println("Encoded Credentials:")
	res, err := awsCreds.Base64()
	if err != nil {
		fmt.Println("Error encoding credentials:", err)
		return
	}
	println(res)
}