From 9e72d43d9a7195ef2d6f20a1d899b5187f784a0d Mon Sep 17 00:00:00 2001 From: Arnaud Brousseau Date: Thu, 8 Feb 2024 15:09:24 -0600 Subject: [PATCH 1/3] make generate to get back to a clean state on main --- pkg/api/client/turnkey_api_client.go | 10 +++++----- .../{email_auth => user_auth}/email_auth_parameters.go | 2 +- .../{email_auth => user_auth}/email_auth_responses.go | 2 +- .../user_auth_client.go} | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) rename pkg/api/client/{email_auth => user_auth}/email_auth_parameters.go (99%) rename pkg/api/client/{email_auth => user_auth}/email_auth_responses.go (99%) rename pkg/api/client/{email_auth/email_auth_client.go => user_auth/user_auth_client.go} (95%) diff --git a/pkg/api/client/turnkey_api_client.go b/pkg/api/client/turnkey_api_client.go index a1ad102..afebf87 100644 --- a/pkg/api/client/turnkey_api_client.go +++ b/pkg/api/client/turnkey_api_client.go @@ -14,7 +14,6 @@ import ( "github.com/tkhq/go-sdk/pkg/api/client/api_keys" "github.com/tkhq/go-sdk/pkg/api/client/authenticators" "github.com/tkhq/go-sdk/pkg/api/client/consensus" - "github.com/tkhq/go-sdk/pkg/api/client/email_auth" "github.com/tkhq/go-sdk/pkg/api/client/features" "github.com/tkhq/go-sdk/pkg/api/client/invitations" "github.com/tkhq/go-sdk/pkg/api/client/organizations" @@ -23,6 +22,7 @@ import ( "github.com/tkhq/go-sdk/pkg/api/client/private_keys" "github.com/tkhq/go-sdk/pkg/api/client/sessions" "github.com/tkhq/go-sdk/pkg/api/client/signers" + "github.com/tkhq/go-sdk/pkg/api/client/user_auth" "github.com/tkhq/go-sdk/pkg/api/client/user_recovery" "github.com/tkhq/go-sdk/pkg/api/client/user_tags" "github.com/tkhq/go-sdk/pkg/api/client/users" @@ -75,7 +75,6 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *TurnkeyAPI cli.APIKeys = api_keys.New(transport, formats) cli.Authenticators = authenticators.New(transport, formats) cli.Consensus = consensus.New(transport, formats) - cli.EmailAuth = email_auth.New(transport, formats) cli.Features = features.New(transport, formats) cli.Invitations = invitations.New(transport, formats) cli.Organizations = organizations.New(transport, formats) @@ -84,6 +83,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *TurnkeyAPI cli.PrivateKeys = private_keys.New(transport, formats) cli.Sessions = sessions.New(transport, formats) cli.Signers = signers.New(transport, formats) + cli.UserAuth = user_auth.New(transport, formats) cli.UserRecovery = user_recovery.New(transport, formats) cli.UserTags = user_tags.New(transport, formats) cli.Users = users.New(transport, formats) @@ -140,8 +140,6 @@ type TurnkeyAPI struct { Consensus consensus.ClientService - EmailAuth email_auth.ClientService - Features features.ClientService Invitations invitations.ClientService @@ -158,6 +156,8 @@ type TurnkeyAPI struct { Signers signers.ClientService + UserAuth user_auth.ClientService + UserRecovery user_recovery.ClientService UserTags user_tags.ClientService @@ -176,7 +176,6 @@ func (c *TurnkeyAPI) SetTransport(transport runtime.ClientTransport) { c.APIKeys.SetTransport(transport) c.Authenticators.SetTransport(transport) c.Consensus.SetTransport(transport) - c.EmailAuth.SetTransport(transport) c.Features.SetTransport(transport) c.Invitations.SetTransport(transport) c.Organizations.SetTransport(transport) @@ -185,6 +184,7 @@ func (c *TurnkeyAPI) SetTransport(transport runtime.ClientTransport) { c.PrivateKeys.SetTransport(transport) c.Sessions.SetTransport(transport) c.Signers.SetTransport(transport) + c.UserAuth.SetTransport(transport) c.UserRecovery.SetTransport(transport) c.UserTags.SetTransport(transport) c.Users.SetTransport(transport) diff --git a/pkg/api/client/email_auth/email_auth_parameters.go b/pkg/api/client/user_auth/email_auth_parameters.go similarity index 99% rename from pkg/api/client/email_auth/email_auth_parameters.go rename to pkg/api/client/user_auth/email_auth_parameters.go index d97c5d9..3c7612f 100644 --- a/pkg/api/client/email_auth/email_auth_parameters.go +++ b/pkg/api/client/user_auth/email_auth_parameters.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package email_auth +package user_auth // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/pkg/api/client/email_auth/email_auth_responses.go b/pkg/api/client/user_auth/email_auth_responses.go similarity index 99% rename from pkg/api/client/email_auth/email_auth_responses.go rename to pkg/api/client/user_auth/email_auth_responses.go index e6dc734..b0124ad 100644 --- a/pkg/api/client/email_auth/email_auth_responses.go +++ b/pkg/api/client/user_auth/email_auth_responses.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package email_auth +package user_auth // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/pkg/api/client/email_auth/email_auth_client.go b/pkg/api/client/user_auth/user_auth_client.go similarity index 95% rename from pkg/api/client/email_auth/email_auth_client.go rename to pkg/api/client/user_auth/user_auth_client.go index 45b7350..02ada63 100644 --- a/pkg/api/client/email_auth/email_auth_client.go +++ b/pkg/api/client/user_auth/user_auth_client.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package email_auth +package user_auth // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command @@ -12,13 +12,13 @@ import ( "github.com/go-openapi/strfmt" ) -// New creates a new email auth API client. +// New creates a new user auth API client. func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } /* -Client for email auth API +Client for user auth API */ type Client struct { transport runtime.ClientTransport @@ -36,7 +36,7 @@ type ClientService interface { } /* -EmailAuth emails auth +EmailAuth performs email auth Authenticate a user via Email */ From 55fb5b420e6da6fc5ec073cd09d932519a8b936a Mon Sep 17 00:00:00 2001 From: Arnaud Brousseau Date: Thu, 8 Feb 2024 15:10:01 -0600 Subject: [PATCH 2/3] Sync swagger spec --- api/public_api.swagger.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/api/public_api.swagger.json b/api/public_api.swagger.json index 14c9c4f..1bb5f7f 100644 --- a/api/public_api.swagger.json +++ b/api/public_api.swagger.json @@ -21,15 +21,15 @@ }, { "name": "Wallets", - "description": "Wallets contain collections of deterministically generated cryptographic public / private key pairs that share a common seed. Turnkey securely holds the common seed, but only you can access it. In most cases, Wallets should be preferred over Private Keys since they can be represented by a mnemonic phrase, used across a variety of cryptographic curves, and can derive many addresses.\n\nDerived addresses can be used to create digital signatures using the corresponding underlying private key. See [Signers](./api#tag/Signers) for more information" + "description": "Wallets contain collections of deterministically generated cryptographic public / private key pairs that share a common seed. Turnkey securely holds the common seed, but only you can access it. In most cases, Wallets should be preferred over Private Keys since they can be represented by a mnemonic phrase, used across a variety of cryptographic curves, and can derive many addresses.\n\nDerived addresses can be used to create digital signatures using the corresponding underlying private key. See [Signing](./api#tag/Signing) for more information" }, { - "name": "Signers", - "description": "Signers allow you to create digitial signatures. Signatures are used to validate the authenticity and integrity of a digital message. Turnkey makes it easy to produce signatures by allowing you to sign with an address. If Turnkey doesn't yet support an address format you need, you can generate and sign with the public key instead by using the address format `ADDRESS_FORMAT_COMPRESSED`." + "name": "Signing", + "description": "Signers allow you to create digital signatures. Signatures are used to validate the authenticity and integrity of a digital message. Turnkey makes it easy to produce signatures by allowing you to sign with an address. If Turnkey doesn't yet support an address format you need, you can generate and sign with the public key instead by using the address format `ADDRESS_FORMAT_COMPRESSED`." }, { "name": "Private Keys", - "description": "Private Keys are cryptographic public / private key pairs that can be used for cryptocurrency needs or more generalized encryption. Turnkey securely holds all private key materials for you, but only you can access them.\n\nThe Private Key ID or any derived address can be used to create digital signatures. See [Signers](./api#tag/Signers) for more information" + "description": "Private Keys are cryptographic public / private key pairs that can be used for cryptocurrency needs or more generalized encryption. Turnkey securely holds all private key materials for you, but only you can access them.\n\nThe Private Key ID or any derived address can be used to create digital signatures. See [Signing](./api#tag/Signing) for more information" }, { "name": "Private Key Tags", @@ -1206,7 +1206,7 @@ } } ], - "tags": ["Signers"] + "tags": ["Signing"] } }, "/public/v1/submit/sign_transaction": { @@ -1232,7 +1232,7 @@ } } ], - "tags": ["Signers"] + "tags": ["Signing"] } }, "/public/v1/submit/update_policy": { @@ -2713,8 +2713,8 @@ "description": "A list of wallet Accounts." }, "mnemonicLength": { - "type": "string", - "format": "uint64", + "type": "integer", + "format": "int32", "description": "Length of mnemonic to generate the Wallet seed. Defaults to 12. Accepted values: 12, 15, 18, 21, 24." } }, @@ -5557,8 +5557,8 @@ "description": "A list of wallet Accounts." }, "mnemonicLength": { - "type": "string", - "format": "uint64", + "type": "integer", + "format": "int32", "description": "Length of mnemonic to generate the Wallet seed. Defaults to 12. Accepted values: 12, 15, 18, 21, 24." } }, @@ -5677,8 +5677,8 @@ "tags": ["Organizations", "Invitations", "Policies", "Features"] }, { - "name": "PRIVATE KEYS", - "tags": ["Wallets", "Signers", "Private Keys", "Private Key Tags"] + "name": "WALLETS AND PRIVATE KEYS", + "tags": ["Wallets", "Signing", "Private Keys", "Private Key Tags"] }, { "name": "USERS", From 3b6ecf5eac09f6a66419378513f00797fe342b02 Mon Sep 17 00:00:00 2001 From: Arnaud Brousseau Date: Thu, 8 Feb 2024 15:11:21 -0600 Subject: [PATCH 3/3] make generate --- examples/{signers => signing}/signTransaction.go | 6 +++--- .../{signers => signing}/sign_raw_payload_parameters.go | 2 +- .../{signers => signing}/sign_raw_payload_responses.go | 2 +- .../{signers => signing}/sign_transaction_parameters.go | 2 +- .../{signers => signing}/sign_transaction_responses.go | 2 +- .../signers_client.go => signing/signing_client.go} | 6 +++--- pkg/api/client/turnkey_api_client.go | 8 ++++---- pkg/api/models/create_wallet_intent.go | 2 +- pkg/api/models/wallet_params.go | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) rename examples/{signers => signing}/signTransaction.go (86%) rename pkg/api/client/{signers => signing}/sign_raw_payload_parameters.go (99%) rename pkg/api/client/{signers => signing}/sign_raw_payload_responses.go (99%) rename pkg/api/client/{signers => signing}/sign_transaction_parameters.go (99%) rename pkg/api/client/{signers => signing}/sign_transaction_responses.go (99%) rename pkg/api/client/{signers/signers_client.go => signing/signing_client.go} (97%) diff --git a/examples/signers/signTransaction.go b/examples/signing/signTransaction.go similarity index 86% rename from examples/signers/signTransaction.go rename to examples/signing/signTransaction.go index c803097..20b0f13 100644 --- a/examples/signers/signTransaction.go +++ b/examples/signing/signTransaction.go @@ -8,7 +8,7 @@ import ( "time" "github.com/tkhq/go-sdk" - "github.com/tkhq/go-sdk/pkg/api/client/signers" + "github.com/tkhq/go-sdk/pkg/api/client/signing" "github.com/tkhq/go-sdk/pkg/api/models" ) @@ -25,7 +25,7 @@ func main() { var privateKeyID string var unsignedTransaction string // no 0x prefix necessary - pkParams := signers.NewSignTransactionParams().WithBody(&models.SignTransactionRequest{ + pkParams := signing.NewSignTransactionParams().WithBody(&models.SignTransactionRequest{ OrganizationID: client.DefaultOrganization(), TimestampMs: ×tampString, Parameters: &models.SignTransactionIntentV2{ @@ -36,7 +36,7 @@ func main() { Type: (*string)(models.ActivityTypeSignTransaction.Pointer()), }) - signResp, err := client.V0().Signers.SignTransaction(pkParams, client.Authenticator) + signResp, err := client.V0().Signing.SignTransaction(pkParams, client.Authenticator) if err != nil { log.Fatal("failed to make PrivateKeys SignTransaction request:", err) } diff --git a/pkg/api/client/signers/sign_raw_payload_parameters.go b/pkg/api/client/signing/sign_raw_payload_parameters.go similarity index 99% rename from pkg/api/client/signers/sign_raw_payload_parameters.go rename to pkg/api/client/signing/sign_raw_payload_parameters.go index e315c48..cdb85a4 100644 --- a/pkg/api/client/signers/sign_raw_payload_parameters.go +++ b/pkg/api/client/signing/sign_raw_payload_parameters.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package signers +package signing // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/pkg/api/client/signers/sign_raw_payload_responses.go b/pkg/api/client/signing/sign_raw_payload_responses.go similarity index 99% rename from pkg/api/client/signers/sign_raw_payload_responses.go rename to pkg/api/client/signing/sign_raw_payload_responses.go index 14180d3..2c13118 100644 --- a/pkg/api/client/signers/sign_raw_payload_responses.go +++ b/pkg/api/client/signing/sign_raw_payload_responses.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package signers +package signing // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/pkg/api/client/signers/sign_transaction_parameters.go b/pkg/api/client/signing/sign_transaction_parameters.go similarity index 99% rename from pkg/api/client/signers/sign_transaction_parameters.go rename to pkg/api/client/signing/sign_transaction_parameters.go index 5ff5728..9b71578 100644 --- a/pkg/api/client/signers/sign_transaction_parameters.go +++ b/pkg/api/client/signing/sign_transaction_parameters.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package signers +package signing // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/pkg/api/client/signers/sign_transaction_responses.go b/pkg/api/client/signing/sign_transaction_responses.go similarity index 99% rename from pkg/api/client/signers/sign_transaction_responses.go rename to pkg/api/client/signing/sign_transaction_responses.go index 83ca1bc..210f545 100644 --- a/pkg/api/client/signers/sign_transaction_responses.go +++ b/pkg/api/client/signing/sign_transaction_responses.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package signers +package signing // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command diff --git a/pkg/api/client/signers/signers_client.go b/pkg/api/client/signing/signing_client.go similarity index 97% rename from pkg/api/client/signers/signers_client.go rename to pkg/api/client/signing/signing_client.go index 4d23891..ce8953c 100644 --- a/pkg/api/client/signers/signers_client.go +++ b/pkg/api/client/signing/signing_client.go @@ -1,6 +1,6 @@ // Code generated by go-swagger; DO NOT EDIT. -package signers +package signing // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command @@ -12,13 +12,13 @@ import ( "github.com/go-openapi/strfmt" ) -// New creates a new signers API client. +// New creates a new signing API client. func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } /* -Client for signers API +Client for signing API */ type Client struct { transport runtime.ClientTransport diff --git a/pkg/api/client/turnkey_api_client.go b/pkg/api/client/turnkey_api_client.go index afebf87..00d1e11 100644 --- a/pkg/api/client/turnkey_api_client.go +++ b/pkg/api/client/turnkey_api_client.go @@ -21,7 +21,7 @@ import ( "github.com/tkhq/go-sdk/pkg/api/client/private_key_tags" "github.com/tkhq/go-sdk/pkg/api/client/private_keys" "github.com/tkhq/go-sdk/pkg/api/client/sessions" - "github.com/tkhq/go-sdk/pkg/api/client/signers" + "github.com/tkhq/go-sdk/pkg/api/client/signing" "github.com/tkhq/go-sdk/pkg/api/client/user_auth" "github.com/tkhq/go-sdk/pkg/api/client/user_recovery" "github.com/tkhq/go-sdk/pkg/api/client/user_tags" @@ -82,7 +82,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *TurnkeyAPI cli.PrivateKeyTags = private_key_tags.New(transport, formats) cli.PrivateKeys = private_keys.New(transport, formats) cli.Sessions = sessions.New(transport, formats) - cli.Signers = signers.New(transport, formats) + cli.Signing = signing.New(transport, formats) cli.UserAuth = user_auth.New(transport, formats) cli.UserRecovery = user_recovery.New(transport, formats) cli.UserTags = user_tags.New(transport, formats) @@ -154,7 +154,7 @@ type TurnkeyAPI struct { Sessions sessions.ClientService - Signers signers.ClientService + Signing signing.ClientService UserAuth user_auth.ClientService @@ -183,7 +183,7 @@ func (c *TurnkeyAPI) SetTransport(transport runtime.ClientTransport) { c.PrivateKeyTags.SetTransport(transport) c.PrivateKeys.SetTransport(transport) c.Sessions.SetTransport(transport) - c.Signers.SetTransport(transport) + c.Signing.SetTransport(transport) c.UserAuth.SetTransport(transport) c.UserRecovery.SetTransport(transport) c.UserTags.SetTransport(transport) diff --git a/pkg/api/models/create_wallet_intent.go b/pkg/api/models/create_wallet_intent.go index ec4fb0b..80286ce 100644 --- a/pkg/api/models/create_wallet_intent.go +++ b/pkg/api/models/create_wallet_intent.go @@ -25,7 +25,7 @@ type CreateWalletIntent struct { Accounts []*WalletAccountParams `json:"accounts"` // Length of mnemonic to generate the Wallet seed. Defaults to 12. Accepted values: 12, 15, 18, 21, 24. - MnemonicLength string `json:"mnemonicLength,omitempty"` + MnemonicLength int32 `json:"mnemonicLength,omitempty"` // Human-readable name for a Wallet. // Required: true diff --git a/pkg/api/models/wallet_params.go b/pkg/api/models/wallet_params.go index e814176..e8a28bf 100644 --- a/pkg/api/models/wallet_params.go +++ b/pkg/api/models/wallet_params.go @@ -25,7 +25,7 @@ type WalletParams struct { Accounts []*WalletAccountParams `json:"accounts"` // Length of mnemonic to generate the Wallet seed. Defaults to 12. Accepted values: 12, 15, 18, 21, 24. - MnemonicLength string `json:"mnemonicLength,omitempty"` + MnemonicLength int32 `json:"mnemonicLength,omitempty"` // Human-readable name for a Wallet. // Required: true