storj/examples/scope/main.go
JT Olio 863e4cacbe
examples/scope: small scope exploder command line tool (#3266)
this provides a small tool that breaks a scope into
its constituent parts

Change-Id: If011dd457a175eeb6e013a17d1aee4f3edfb8b0c
2019-10-16 22:40:41 -06:00

32 lines
585 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"fmt"
"os"
"storj.io/storj/lib/uplink"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("usage:", os.Args[0], "<scope>")
os.Exit(1)
}
scope, err := uplink.ParseScope(os.Args[1])
if err != nil {
fmt.Println("invalid scope:", err.Error())
os.Exit(1)
}
encaccess, err := scope.EncryptionAccess.Serialize()
if err != nil {
panic(err)
}
fmt.Printf("satellite: %s\napi key: %s\nenc access: %s\n",
scope.SatelliteAddr,
scope.APIKey.Serialize(),
encaccess)
}