Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDK Proto #177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
273 changes: 9 additions & 264 deletions proto/services/connect/v1/connect.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,160 +10,14 @@ import "services/common/v1/common.proto";
import "services/universal-wallet/v1/universal-wallet.proto";

import "services/google/api/annotations.proto";
import "services/options/field-options.proto";

// The type of verification to perform
enum VerificationType {
// Government-issued ID (driver's license, passport, etc)
GOVERNMENT_ID = 0;
}

// The states a VerificationSession can be in
enum IDVSessionState {
// Session has been created, but not yet shown to user
IDV_CREATED = 0;

// Session has been shown to user (iframe / popup opened), but
// user has not yet logged in.
IDV_INITIATED = 1;

// User has entered their phone number, but not yet authenticated with the code sent via SMS
IDV_AUTHENTICATING = 2;

// User has been authenticated and is performing identity verification
IDV_IN_PROGRESS = 3;

// Session was completed successfully and IDV data is available to RP
IDV_SUCCESS = 4;

// The session failed; reason is present in `fail_code`.
IDV_FAILED = 5;
}

// The states an individual Verification can be in
enum VerificationState {
// This verification has not yet been performed in the flow
VERIFICATION_PENDING = 0;
// This verification has been started by the user, and can be reused from a previous verification, but the user
// has not yet decided whether to reuse it.
VERIFICATION_PENDING_REUSE = 1;
// This verification has been started by the user, but not yet completed
VERIFICATION_STARTED = 2;
// This verification has been successfully completed
VERIFICATION_SUCCESS = 3;
// This verification has failed
VERIFICATION_FAILED = 4;
}

// The specific reason an IDVSession is in the `Failed` state
enum SessionFailCode {
// The Session is not in a failure state.
SESSION_FAIL_NONE = 0;

// An internal Trinsic error caused this session to fail
SESSION_FAIL_INTERNAL = 1;

// The session failed because one or more of the verifications failed.
// The reason for the failure is present in the `fail_reason` field of the relevant `Verification` object(s).
SESSION_FAIL_VERIFICATION_FAILED = 2;

// The session failed because the user failed to authenticate with their phone number too many times.
SESSION_FAIL_AUTHENTICATION = 3;

// The session expired
SESSION_FAIL_EXPIRED = 4;

// The user canceled / rejected the session
SESSION_FAIL_USER_CANCELED = 5;

// The RP canceled the session
SESSION_FAIL_RP_CANCELED = 6;
}

// The specific reason a Verification is in the `Failed` state
enum VerificationFailCode {
// The verification is not in a failure state
VERIFICATION_FAIL_NONE = 0;

// An internal Trinsic error caused this verification to fail
VERIFICATION_FAIL_INTERNAL = 1;

// The image(s) provided for this verification were either too low-quality, not of the correct type, or otherwise
// unable to be processed.
// This failure reason is non-terminal; the user is able to retry the verification.
VERIFICATION_FAIL_INVALID_IMAGE = 2;

// The identity data/images provided are suspected to be inauthentic, fraudulent, or forged.
VERIFICATION_FAIL_INAUTHENTIC = 3;

// The document provided is either of an unsupported type, or from an unsupported country.
VERIFICATION_FAIL_UNSUPPORTED_DOCUMENT = 4;
}

// An Identity Verification Session
message IDVSession {
// The ID of the IDVSession.
string id = 1;

// The Client Token for this IDVSession. This should be passed to your frontend to initiate
// the IDV flow using Trinsic's Web SDK.
string client_token = 2;

// State of the IDVSession
IDVSessionState state = 3;

// The actual Verifications to perform in this IDV flow
map<string, Verification> verifications = 4;

// The reason for the IDVSession's failure.
// Only set if `state` is `IDV_FAILED`.
optional SessionFailCode fail_code = 5;

// The resultant signed VP combining the results of all verifications
optional string result_vp = 6;

// The unix timestamp, in seconds, that this IDVSession was created
fixed64 created = 7;

// The unix timestamp, in seconds, that this IDVSession's `state` was last updated
fixed64 updated = 8;
}

// A Verification that is part of an IDVSession
message Verification {
// The ID of the verification
string id = 1;

// The type of verification (driver's license, passport, proof of address, etc)
VerificationType type = 2;

// The state of the verification
VerificationState state = 3;

// The reason for the Verification's failure.
// Only set if `state` is `VERIFICATION_FAILED`.
optional VerificationFailCode fail_code = 4;

// Whether this was a reused (true) or fresh (false) verification.
// If `state` is not `VERIFICATION_SUCCESS`, this field is `false` and does not convey useful information.
bool reused = 5;

// The unix timestamp, in seconds, when this verification was begun
// by the user -- or `0` if not yet begun.
fixed64 begun = 6;

// The unix timestamp, in seconds, when this verification last changed state -- or `0` if it has not yet
// begun.
fixed64 updated = 7;

// The Government ID options for this Verification.
// Only set if this Verification is of type `GOVERNMENT_ID`.
optional GovernmentIDOptions government_id_options = 8;

// Normalized output for manual parsing and usage for this verification
// Only set if this Verification is of type `GOVERNMENT_ID` and has succeeded.
optional NormalizedGovernmentIdData normalized_government_id_data = 9;
}

message NormalizedGovernmentIdData {
// The ID number of the underlying identity document
optional string id_number = 1 [json_name = "idNumber"];
Expand Down Expand Up @@ -251,84 +105,18 @@ message GovernmentIDFields {

// Expiration date date of the document
bool expiration_date = 8;
}

// Response to `CreateIDVSessionRequest`
message CreateSessionResponse {
// The created IDVSession
IDVSession session = 1;
}
// The image of the front of the document
bool document_front = 9;

// The image of the back of the document
bool document_back = 10;

// Request to cancel an Identity Verification Session
message CancelSessionRequest {
// The ID of the IDVSession to cancel
string idv_session_id = 1;
}

// Response to `CancelIDVSessionRequest`
message CancelSessionResponse {
// The IDVSession in its current state after cancellation
IDVSession session = 1;
}
// The image of the holder portrait contained in the document
bool document_portrait = 11;

// Request to get an IDVSession
message GetSessionRequest {
// The ID of the IDVSession to get
string idv_session_id = 1;
}

// Response to `GetIDVSessionRequest`
message GetSessionResponse {
// The IDVSession
IDVSession session = 1;
}

// Request to list all IDVSessions you've created
message ListSessionsRequest {
// The field by which sessions should be sorted. Defaults to `CREATED`.
SessionOrdering order_by = 1;

// The order in which sessions should be sorted. Defaults to `ASCENDING`.
common.v1.OrderDirection order_direction = 2;

// The number of results to return per page.
// Must be between `1` and `10`, inclusive.
// Defaults to `10`.
optional int32 page_size = 3;

// The page index of results to return.
// Starts at `1`.
// Defaults to `1`.
optional int32 page = 4;
}

// Response to `ListIDVSessionsRequest`
message ListSessionsResponse {
// The sessions you've created
repeated IDVSession sessions = 1;

// The total number of sessions you've created
int32 total = 2;

// If `true`, this is not the last page of results.
// If `false`, this is the last page of results.
bool more = 3;
}

// Request to preemptively check if an identity has a valid reusable credential
message HasValidCredentialRequest {
// The identity used to find a credential
universalwallet.v1.CreateWalletRequest.ExternalIdentity identity = 1;

// The criteria used to find a valid credential
CredentialRequestData credential_request_data = 2;
}

// Response to `HasValidCredentialRequest`
message HasValidCredentialResponse {
// Whether the identity has a valid credential
bool has_valid_credential = 1;
// The image of the face match selfie
bool selfie = 12;
}

message CredentialRequestData {
Expand All @@ -348,46 +136,3 @@ enum SessionOrdering {
// Order sessions according to their numerical state
STATE = 2;
}

// The Connect service provides access to Trinsic Connect, a reusable identity verification service.
service Connect {
// Create an IDVSession
rpc CreateSession(CreateSessionRequest) returns (CreateSessionResponse) {
option (google.api.http) = {
post: "/v1/connect/createsession"
body: "*"
};
}

// Cancel an IDVSession
rpc CancelSession(CancelSessionRequest) returns (CancelSessionResponse) {
option (google.api.http) = {
post: "/v1/connect/cancelsession"
body: "*"
};
}

// Get an IDVSession
rpc GetSession(GetSessionRequest) returns (GetSessionResponse) {
option (google.api.http) = {
post: "/v1/connect/getsession"
body: "*"
};
}

// List IDVSessions created by the calling wallet
rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) {
option (google.api.http) = {
post: "/v1/connect/listsessions"
body: "*"
};
}

// Checks if the identity provided in the request has a wallet containing a valid reusable credential
rpc HasValidCredential(HasValidCredentialRequest) returns (HasValidCredentialResponse) {
option (google.api.http) = {
post: "/v1/connect/hasvalidcredential"
body: "*"
};
}
}
Loading