Skip to content

Proposed changes to SDK #460

@tmarkovski

Description

@tmarkovski

Objective

With the changes to AccountProfile and it's use in server configurations, we have an opportunity to consolidate the service options and lessen the complexity of service construction.

Proposal

Here are some changes I propose we do.

Changes to Account Profile

  • Update the SignIn and CreateAccount endpoints to return a string that's a base64url encoded string of the serialized byte array of the token.
  • Change the reference of AccountProfile or Profile to AuthToken or AuthenticationToken. This makes it clearer as to what this profile represents and how it relates to commonly used API tokens, access tokens, etc.
  • When SignIn or CreateAccount is called, if the response sends an unprotected profile, set the token for the current service instance as active. This won't happen if the user is using an email to sign in, which should be most of the cases, so they will need to set it again. I really don't like this experience, and hope we can find something that resembles a more common developer flow.
  • Ensure that when passing an auth token that is protected, the SDK throws an error with a message indicating how this can be unprotected, with a documentation link explaining why this protection is in place

Changes to Service Options

  • Add AuthToken to ServiceOptions (proto) so that tokens can be added in code configurations in server scenarios.
  • Move ServerConfig to ServiceOptions (sdk proto). This really just flattens the ServiceOptions instead it having a complex structure. Example:
message ServiceOptions {
  string server_address = 1; // default = "prod.trinsic.cloud"
  int32 server_port = 2; // default = 443
  bool server_use_tls = 3; // default = true
  string auth_token = 4; // default = <empty>
  string default_ecosystem = 5; // default = "default"
  // etc
}
  • gRPC Channel reuse. I know there's a separate discussion on this, we can leave this feature intact, but I do want to point out that this can be filled with side effects and for the most part it's really unnecessary that we expose the actual gRPC channel in the services. It introduces complexity in object and service construction, there's the option that users can simply toggle options on it that would make the channel incompatible with the backend (turn of compression). It's also a big surface for security related bugs.

Changes to accommodate ecosystem updates

  • Add DefaultEcosystem to the ServiceOptions so clients can configure their SDKs to point to a specific ecosystem instance
  • Update default trinsic ecosystem name. Currently this is set to "default". This name appears in schema URLs such as https://schemas.trinsic.cloud/<default>/<credential type>/ etc. We can change this something else, maybe trinsic, or global, or .
  • Remove the need to specify ecosystem when signing in, and read this from the service options. Clients would not need to work across different ecosystems, so having one place where this is configured is good.

Changes to Credential Service

  • Update documentation to reflect reveal document in proof creation should be empty, unless the users knows how to construct a valid frame
  • Ensure methods expose the proto object directly

Metadata

Metadata

Labels

discussionIssue is a discussion

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions