diff --git a/example/viam_robot_example_app/README.md b/example/viam_robot_example_app/README.md index ab958f0e796..61e9e24508a 100644 --- a/example/viam_robot_example_app/README.md +++ b/example/viam_robot_example_app/README.md @@ -16,14 +16,7 @@ API_KEY_ID= API_KEY= ``` -or using location secrets (deprecated, please prefer using API keys!): - -``` -ROBOT_LOCATION= -LOCATION_SECRET= -``` - -Both these fields can be obtained from your robot's `Code Sample` tab on [app.viam.com](https://app.viam.com). +These fields can be obtained from your robot's `Code Sample` tab on [app.viam.com](https://app.viam.com). ## Run diff --git a/lib/src/robot/client.dart b/lib/src/robot/client.dart index 54d3b4c0513..5a4cd36246c 100644 --- a/lib/src/robot/client.dart +++ b/lib/src/robot/client.dart @@ -49,9 +49,8 @@ class RobotClientOptions { ..credentials = Credentials.apiKey(apiKey) ..authEntity = apiKeyID; - /// Convenience initializer for creating options with a robot location secret - RobotClientOptions.withLocationSecret(String locationSecret) - : dialOptions = DialOptions()..credentials = Credentials.locationSecret(locationSecret); + /// Convenience initializer for creating options with a robot secret + RobotClientOptions.withRobotSecret(String robotSecret) : dialOptions = DialOptions()..credentials = Credentials.robotSecret(robotSecret); } /// {@category Viam SDK} diff --git a/lib/src/rpc/dial.dart b/lib/src/rpc/dial.dart index 408e623ccca..3f24845004d 100644 --- a/lib/src/rpc/dial.dart +++ b/lib/src/rpc/dial.dart @@ -78,7 +78,7 @@ class DialOptions { /// {@category Viam SDK} /// The credentials used for connecting to the robot class Credentials { - /// The type of credential, e.g. 'robot-location-secret', 'api-key' + /// The type of credential, e.g. 'robot-secret', 'api-key' final String type; /// The payload of the credential @@ -86,8 +86,8 @@ class Credentials { const Credentials(this.type, this.payload); - /// Convenience initializer for creating credentials of type 'robot-location-secret' with the provided payload. - const Credentials.locationSecret(this.payload) : type = 'robot-location-secret'; + /// Convenience initializer for creating credentials of type 'robot-secret' with the provided payload. + const Credentials.robotSecret(this.payload) : type = 'robot-secret'; /// Convenience initializer for creating credentials of type 'api-key' with the provided key as payload. const Credentials.apiKey(this.payload) : type = 'api-key'; diff --git a/lib/src/viam_sdk_impl.dart b/lib/src/viam_sdk_impl.dart index f36b9ba9b52..b48cf9d1f1d 100644 --- a/lib/src/viam_sdk_impl.dart +++ b/lib/src/viam_sdk_impl.dart @@ -97,10 +97,8 @@ class ViamImpl implements Viam { @override Future getRobotClient(Robot robot) async { - final location = await appClient.getLocation(robot.location); - final secret = location.auth.secrets.firstWhere((element) => element.state == SharedSecret_State.STATE_ENABLED); final parts = await appClient.listRobotParts(robot.id); final part = parts.firstWhere((element) => element.mainPart); - return RobotClient.atAddress(part.fqdn, RobotClientOptions.withLocationSecret(secret.secret)); + return RobotClient.atAddress(part.fqdn, RobotClientOptions.withRobotSecret(part.secret)); } }