From 2f46a49b37f33d23250731cacc964931c3a01956 Mon Sep 17 00:00:00 2001 From: Patryk Kalinowski Date: Wed, 22 May 2024 19:10:15 +0200 Subject: [PATCH] intents: support for the proposed auth changes --- intents/intent.gen.go | 51 ++++++++++++++++++++++++++++++++------- intents/intent.gen.ts | 50 ++++++++++++++++++++++++++++++++------- intents/intent.ridl | 55 +++++++++++++++++++++++++++++++++++++------ 3 files changed, 131 insertions(+), 25 deletions(-) diff --git a/intents/intent.gen.go b/intents/intent.gen.go index bd40aef..a898fbe 100644 --- a/intents/intent.gen.go +++ b/intents/intent.gen.go @@ -1,6 +1,6 @@ -// sequence-waas-intents v0.1.0 7ab7a9ad425b7f572331c5b85eda53436264c646 +// sequence-waas-intents v0.1.0 abad0ae15a75bd1b90311a0358745e4e4e311cdd // -- -// Code generated by webrpc-gen@v0.18.6 with golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.18.7 with golang generator. DO NOT EDIT. // // webrpc-gen -schema=intent.ridl -target=golang -pkg=intents -client -out=./intent.gen.go package intents @@ -25,7 +25,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "7ab7a9ad425b7f572331c5b85eda53436264c646" + return "abad0ae15a75bd1b90311a0358745e4e4e311cdd" } // @@ -35,6 +35,7 @@ func WebRPCSchemaHash() string { type IntentName string const ( + IntentName_initiateAuth IntentName = "initiateAuth" IntentName_openSession IntentName = "openSession" IntentName_closeSession IntentName = "closeSession" IntentName_validateSession IntentName = "validateSession" @@ -49,6 +50,7 @@ const ( IntentName_federateAccount IntentName = "federateAccount" IntentName_removeAccount IntentName = "removeAccount" IntentName_listAccounts IntentName = "listAccounts" + IntentName_getIdToken IntentName = "getIdToken" ) func (x IntentName) MarshalText() ([]byte, error) { @@ -106,6 +108,7 @@ func (x *TransactionType) Is(values ...TransactionType) bool { type IntentResponseCode string const ( + IntentResponseCode_authInitiated IntentResponseCode = "authInitiated" IntentResponseCode_sessionOpened IntentResponseCode = "sessionOpened" IntentResponseCode_sessionClosed IntentResponseCode = "sessionClosed" IntentResponseCode_sessionList IntentResponseCode = "sessionList" @@ -121,6 +124,7 @@ const ( IntentResponseCode_accountList IntentResponseCode = "accountList" IntentResponseCode_accountFederated IntentResponseCode = "accountFederated" IntentResponseCode_accountRemoved IntentResponseCode = "accountRemoved" + IntentResponseCode_idToken IntentResponseCode = "idToken" ) func (x IntentResponseCode) MarshalText() ([]byte, error) { @@ -195,6 +199,7 @@ const ( IdentityType_None IdentityType = "None" IdentityType_Guest IdentityType = "Guest" IdentityType_OIDC IdentityType = "OIDC" + IdentityType_Email IdentityType = "Email" ) func (x IdentityType) MarshalText() ([]byte, error) { @@ -232,11 +237,20 @@ type Signature struct { Signature string `json:"signature"` } +type IntentDataInitiateAuth struct { + SessionID string `json:"sessionId"` + IdentityType IdentityType `json:"identityType"` + Verifier string `json:"verifier"` +} + type IntentDataOpenSession struct { - SessionID string `json:"sessionId"` - Email *string `json:"email,omitempty"` - IdToken *string `json:"idToken,omitempty"` - ForceCreateAccount bool `json:"forceCreateAccount,omitempty"` + SessionID string `json:"sessionId"` + Verifier string `json:"verifier,omitempty"` + Challenge string `json:"challenge,omitempty"` + ForceCreateAccount bool `json:"forceCreateAccount,omitempty"` + // Deprecated + Email *string `json:"email,omitempty"` + IdToken *string `json:"idToken,omitempty"` } type IntentDataCloseSession struct { @@ -303,7 +317,8 @@ type IntentDataGetTransactionReceipt struct { type IntentDataFederateAccount struct { SessionID string `json:"sessionId"` Wallet string `json:"wallet"` - IdToken string `json:"idToken,omitempty"` + Email string `json:"email,omitempty"` + Challenge string `json:"challenge,omitempty"` } type IntentDataListAccounts struct { @@ -315,6 +330,12 @@ type IntentDataRemoveAccount struct { AccountID string `json:"accountId"` } +type IntentDataGetIdToken struct { + SessionID string `json:"sessionId"` + Wallet string `json:"wallet"` + Nonce string `json:"nonce"` +} + type TransactionRaw struct { Type string `json:"type"` To string `json:"to"` @@ -363,6 +384,13 @@ type IntentResponse struct { Data interface{} `json:"data"` } +type IntentResponseAuthInitiated struct { + SessionID string `json:"sessionId"` + IdentityType IdentityType `json:"identityType"` + ExpiresIn int `json:"expiresIn"` + Challenge *string `json:"challenge"` +} + type IntentResponseSessionOpened struct { SessionID string `json:"sessionId"` Wallet string `json:"wallet"` @@ -459,10 +487,15 @@ type IntentResponseAccountFederated struct { type IntentResponseAccountRemoved struct { } +type IntentResponseIdToken struct { + IdToken string `json:"idToken"` + ExpiresIn int `json:"expiresIn"` +} + type Account struct { ID string `json:"id"` Type IdentityType `json:"type"` - Issuer string `json:"issuer"` + Issuer *string `json:"issuer,omitempty"` Email *string `json:"email,omitempty"` } diff --git a/intents/intent.gen.ts b/intents/intent.gen.ts index 21304c4..8a0a16e 100644 --- a/intents/intent.gen.ts +++ b/intents/intent.gen.ts @@ -1,7 +1,7 @@ /* eslint-disable */ -// sequence-waas-intents v0.1.0 7ab7a9ad425b7f572331c5b85eda53436264c646 +// sequence-waas-intents v0.1.0 abad0ae15a75bd1b90311a0358745e4e4e311cdd // -- -// Code generated by webrpc-gen@v0.18.6 with typescript generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.18.7 with typescript generator. DO NOT EDIT. // // webrpc-gen -schema=intent.ridl -target=typescript -client -out=./intent.gen.ts @@ -12,7 +12,7 @@ export const WebRPCVersion = "v1" export const WebRPCSchemaVersion = "v0.1.0" // Schema hash generated from your RIDL schema -export const WebRPCSchemaHash = "7ab7a9ad425b7f572331c5b85eda53436264c646" +export const WebRPCSchemaHash = "abad0ae15a75bd1b90311a0358745e4e4e311cdd" // // Types @@ -20,6 +20,7 @@ export const WebRPCSchemaHash = "7ab7a9ad425b7f572331c5b85eda53436264c646" export enum IntentName { + initiateAuth = 'initiateAuth', openSession = 'openSession', closeSession = 'closeSession', validateSession = 'validateSession', @@ -33,7 +34,8 @@ export enum IntentName { getTransactionReceipt = 'getTransactionReceipt', federateAccount = 'federateAccount', removeAccount = 'removeAccount', - listAccounts = 'listAccounts' + listAccounts = 'listAccounts', + getIdToken = 'getIdToken' } export enum TransactionType { @@ -45,6 +47,7 @@ export enum TransactionType { } export enum IntentResponseCode { + authInitiated = 'authInitiated', sessionOpened = 'sessionOpened', sessionClosed = 'sessionClosed', sessionList = 'sessionList', @@ -59,7 +62,8 @@ export enum IntentResponseCode { getSessionResponse = 'getSessionResponse', accountList = 'accountList', accountFederated = 'accountFederated', - accountRemoved = 'accountRemoved' + accountRemoved = 'accountRemoved', + idToken = 'idToken' } export enum FeeTokenType { @@ -71,7 +75,8 @@ export enum FeeTokenType { export enum IdentityType { None = 'None', Guest = 'Guest', - OIDC = 'OIDC' + OIDC = 'OIDC', + Email = 'Email' } export interface Intent { @@ -88,11 +93,19 @@ export interface Signature { signature: string } +export interface IntentDataInitiateAuth { + sessionId: string + identityType: IdentityType + verifier: string +} + export interface IntentDataOpenSession { sessionId: string + verifier?: string + challenge?: string + forceCreateAccount?: boolean email?: string idToken?: string - forceCreateAccount?: boolean } export interface IntentDataCloseSession { @@ -157,7 +170,8 @@ export interface IntentDataGetTransactionReceipt { export interface IntentDataFederateAccount { sessionId: string wallet: string - idToken: string + email?: string + challenge?: string } export interface IntentDataListAccounts { @@ -169,6 +183,12 @@ export interface IntentDataRemoveAccount { accountId: string } +export interface IntentDataGetIdToken { + sessionId: string + wallet: string + nonce?: string +} + export interface TransactionRaw { type: string to: string @@ -217,6 +237,13 @@ export interface IntentResponse { data: any } +export interface IntentResponseAuthInitiated { + sessionId: string + identityType: IdentityType + expiresIn: number + challenge?: string +} + export interface IntentResponseSessionOpened { sessionId: string wallet: string @@ -312,10 +339,15 @@ export interface IntentResponseAccountFederated { export interface IntentResponseAccountRemoved { } +export interface IntentResponseIdToken { + idToken: string + expiresIn: number +} + export interface Account { id: string type: IdentityType - issuer: string + issuer?: string email?: string } diff --git a/intents/intent.ridl b/intents/intent.ridl index 52dcb91..9e05bc6 100644 --- a/intents/intent.ridl +++ b/intents/intent.ridl @@ -17,7 +17,8 @@ struct Signature + go.field.name = SessionID - signature: string - enum IntentName: string +enum IntentName: string + - initiateAuth - openSession - closeSession - validateSession @@ -32,17 +33,31 @@ struct Signature - federateAccount - removeAccount - listAccounts + - getIdToken + +struct IntentDataInitiateAuth + - sessionId: string + + go.field.name = SessionID + - identityType: IdentityType + - verifier: string struct IntentDataOpenSession - sessionId: string + go.field.name = SessionID + - verifier?: string + + go.field.type = string + + go.tag.json = verifier,omitempty + - challenge?: string + + go.field.type = string + + go.tag.json = challenge,omitempty + - forceCreateAccount?: bool + + go.field.type = bool + + go.tag.json = forceCreateAccount,omitempty + # Deprecated - email?: string + go.tag.json = email,omitempty - idToken?: string + go.tag.json = idToken,omitempty - - forceCreateAccount?: bool - + go.field.type = bool - + go.tag.json = forceCreateAccount,omitempty struct IntentDataCloseSession - sessionId: string @@ -104,8 +119,12 @@ struct IntentDataFederateAccount - sessionId: string + go.field.name = SessionID - wallet: string - - idToken: string - + go.tag.json = idToken,omitempty + - email?: string + + go.field.type = string + + go.tag.json = email,omitempty + - challenge?: string + + go.field.type = string + + go.tag.json = challenge,omitempty struct IntentDataListAccounts - wallet: string @@ -115,6 +134,13 @@ struct IntentDataRemoveAccount - accountId: string + go.field.name = AccountID +struct IntentDataGetIdToken + - sessionId: string + + go.field.name = SessionID + - wallet: string + - nonce?: string + + go.field.type = string + struct TransactionRaw - type: string - to: string @@ -166,6 +192,7 @@ struct IntentResponse - data: any enum IntentResponseCode: string + - authInitiated - sessionOpened - sessionClosed - sessionList @@ -181,6 +208,14 @@ enum IntentResponseCode: string - accountList - accountFederated - accountRemoved + - idToken + +struct IntentResponseAuthInitiated + - sessionId: string + + go.field.name = SessionID + - identityType: IdentityType + - expiresIn: int + - challenge?: string struct IntentResponseSessionOpened - sessionId: string @@ -270,16 +305,22 @@ struct IntentResponseAccountFederated struct IntentResponseAccountRemoved +struct IntentResponseIdToken + - idToken: string + - expiresIn: int + enum IdentityType: string - None - Guest - OIDC + - Email struct Account - id: string + go.field.name = ID - type: IdentityType + go.field.type = IdentityType - - issuer: string + - issuer?: string + + go.tag.json = issuer,omitempty - email?: string + go.tag.json = email,omitempty