Skip to content

Commit

Permalink
Ask for registration token when running imessagego
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 19, 2023
1 parent 22a6ac1 commit 4c3bd62
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bridgeconfig/imessagego.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ bridge:
{{ .BeeperDomain }}: "as_token:{{ .ASToken }}"

# A URL to fetch validation data from. Use this option or the nac_plist option
nac_validation_data_url: https://api.{{ .BeeperDomain }}/bridgebox/{{ .Username }}/bridge/{{ .BridgeName }}/validation_data
nac_validation_data_url: {{ .Params.nac_url }}
# Optional auth token to use when fetching validation data. If null, defaults to passing the as_token.
nac_validation_data_token:
nac_validation_data_token: {{ .Params.nac_token }}
nac_validation_is_relay: true

# Backfill settings
backfill:
Expand Down
27 changes: 27 additions & 0 deletions cmd/bbctl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,33 @@ func simpleDescriptions(descs map[string]string) func(string, int) string {
}

var askParams = map[string]func(map[string]string) (bool, error){
"imessagego": func(extraParams map[string]string) (bool, error) {
nacURL := extraParams["nac_url"]
nacToken := extraParams["nac_token"]
var didAddParams bool
if nacURL == "" {
err := survey.AskOne(&survey.Input{
Message: "Enter registration relay address",
Default: "https://registration-relay.beeper.com",
}, &nacURL)
if err != nil {
return didAddParams, err
}
extraParams["nac_url"] = nacURL
didAddParams = true
}
if nacToken == "" {
err := survey.AskOne(&survey.Input{
Message: "Enter iMessage registration token",
}, &nacToken)
if err != nil {
return didAddParams, err
}
extraParams["nac_token"] = nacToken
didAddParams = true
}
return didAddParams, nil
},
"imessage": func(extraParams map[string]string) (bool, error) {
platform := extraParams["imessage_platform"]
barcelonaPath := extraParams["barcelona_path"]
Expand Down

0 comments on commit 4c3bd62

Please sign in to comment.