Skip to content

Commit

Permalink
intents: add support for child wallet adoption and intent confirmation (
Browse files Browse the repository at this point in the history
#176)

* intents: add support for child wallet adoption & intent confirmation

* generated files

* correct JSON "Id" casing
  • Loading branch information
patrislav authored Nov 21, 2024
1 parent 6287e6d commit 36a596e
Show file tree
Hide file tree
Showing 6 changed files with 377 additions and 602 deletions.
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -402,6 +403,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
Expand Down
115 changes: 96 additions & 19 deletions intents/intent.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion intents/intent.ridl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ enum IntentName: string
- removeAccount
- listAccounts
- getIdToken
- adoptChildWallet
- getAdopter
- confirmIntent
- getConfirmationStatus

struct IntentDataInitiateAuth
- sessionId: string
Expand Down Expand Up @@ -141,13 +145,37 @@ struct IntentDataRemoveAccount
- accountId: string
+ go.field.name = AccountID

struct IntentDataAdoptChildWallet
- network: string
- wallet: string
- adopter: string
- adopterProof: AdopterProof

struct AdopterProof
- message: string
- signature: string

struct IntentDataGetIdToken
- sessionId: string
+ go.field.name = SessionID
- wallet: string
- nonce?: string
+ go.field.type = string

struct IntentDataGetAdopter
- wallet: string

struct IntentDataConfirmIntent
- wallet: string
- confirmationID: string
+ go.field.name = ConfirmationID
- challengeAnswer: string

struct IntentDataGetConfirmationStatus
- wallet: string
- confirmationID: string
+ go.field.name = ConfirmationID

struct TransactionRaw
- type: string
- to: string
Expand All @@ -159,7 +187,7 @@ struct AbiData
- abi: string
- func?: string
- args: []any

enum TransactionType: string
- transaction
- erc20send
Expand Down Expand Up @@ -232,6 +260,9 @@ enum IntentResponseCode: string
- accountFederated
- accountRemoved
- idToken
- adopter
- childWalletAdopted
- confirmationRequired

struct IntentResponseAuthInitiated
- sessionId: string
Expand Down Expand Up @@ -334,6 +365,20 @@ struct IntentResponseIdToken
- idToken: string
- expiresIn: int

struct IntentResponseChildWalletAdopted
- adopterAddress: string

struct IntentResponseAdopter
- adopterAddress: string

struct IntentResponseConfirmationRequired
- confirmationId: string
+ go.field.name = ConfirmationID
- salt: string
- challengeType: ChallengeType
- challengeDestination?: string
- expiresIn: int

enum IdentityType: string
- None
- Guest
Expand All @@ -351,3 +396,6 @@ struct Account
+ go.tag.json = issuer,omitempty
- email?: string
+ go.tag.json = email,omitempty

enum ChallengeType: string
- EmailOTP
6 changes: 6 additions & 0 deletions intents/intent_response_typed.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ func IntentResponseTypeToCode[T any](t *T) IntentResponseCode {
return IntentResponseCode_accountFederated
case *IntentResponseAccountRemoved:
return IntentResponseCode_accountRemoved
case *IntentResponseChildWalletAdopted:
return IntentResponseCode_childWalletAdopted
case *IntentResponseAdopter:
return IntentResponseCode_adopter
case *IntentResponseConfirmationRequired:
return IntentResponseCode_confirmationRequired
case *IntentResponseIdToken:
return IntentResponseCode_idToken
default:
Expand Down
8 changes: 8 additions & 0 deletions intents/intent_typed.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ func IntentDataTypeToName[T any](t *T) IntentName {
return IntentName_federateAccount
case *IntentDataRemoveAccount:
return IntentName_removeAccount
case *IntentDataAdoptChildWallet:
return IntentName_adoptChildWallet
case *IntentDataGetAdopter:
return IntentName_getAdopter
case *IntentDataConfirmIntent:
return IntentName_confirmIntent
case *IntentDataGetConfirmationStatus:
return IntentName_getConfirmationStatus
case *IntentDataGetIdToken:
return IntentName_getIdToken
default:
Expand Down
Loading

0 comments on commit 36a596e

Please sign in to comment.