generate_creds.go 851 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package main
  2. import (
  3. "fmt"
  4. sqscreds "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/sqscreds/lib"
  5. )
  6. // This script can be run to generate the encoded SQS credentials to pass as a CLI param or SOCKS option to the client
  7. func main() {
  8. var accessKey, secretKey string
  9. fmt.Print("Enter Access Key: ")
  10. _, err := fmt.Scanln(&accessKey)
  11. if err != nil {
  12. fmt.Println("Error reading access key:", err)
  13. return
  14. }
  15. fmt.Print("Enter Secret Key: ")
  16. _, err = fmt.Scanln(&secretKey)
  17. if err != nil {
  18. fmt.Println("Error reading access key:", err)
  19. return
  20. }
  21. awsCreds := sqscreds.AwsCreds{AwsAccessKeyId: accessKey, AwsSecretKey: secretKey}
  22. println()
  23. println("Encoded Credentials:")
  24. res, err := awsCreds.Base64()
  25. if err != nil {
  26. fmt.Println("Error encoding credentials:", err)
  27. return
  28. }
  29. println(res)
  30. }