-
Notifications
You must be signed in to change notification settings - Fork 136
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
Change registration on API v2 to flow with 3 steps #2629
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
diff --git a/src/internet_identity/internet_identity.did b/src/internet_identity/internet_identity.did | ||
index 500ef4d6..eb75b075 100644 | ||
--- a/src/internet_identity/internet_identity.did | ||
+++ b/src/internet_identity/internet_identity.did | ||
@@ -435,6 +435,17 @@ type IdentityInfoError = variant { | ||
InternalCanisterError: text; | ||
}; | ||
|
||
+ | ||
+ | ||
+type IdentityRegisterError = variant { | ||
+ // No more registrations are possible in this instance of the II service canister. | ||
+ CanisterFull; | ||
+ // The captcha check was not successful. | ||
+ BadCaptcha; | ||
+ // The metadata of the provided authentication method contains invalid entries. | ||
+ InvalidMetadata: text; | ||
+}; | ||
+ | ||
type AuthnMethodAddError = variant { | ||
InvalidMetadata: text; | ||
}; | ||
@@ -521,72 +532,6 @@ type SignedIdAlias = record { | ||
id_dapp : principal; | ||
}; | ||
|
||
-type IdRegNextStepResult = record { | ||
- // The next step in the registration flow | ||
- next_step: RegistrationFlowNextStep; | ||
-}; | ||
- | ||
-type IdRegStartError = variant { | ||
- // The method was called anonymously, which is not supported. | ||
- InvalidCaller; | ||
- // Too many registrations. Please try again later. | ||
- RateLimitExceeded; | ||
- // A registration flow is already in progress. | ||
- AlreadyInProgress; | ||
-}; | ||
- | ||
-// The next step in the registration flow: | ||
-// - CheckCaptcha: supply the solution to the captcha using `check_captcha` | ||
-// - Finish: finish the registration using `identity_registration_finish` | ||
-type RegistrationFlowNextStep = variant { | ||
- // Supply the captcha solution using check_captcha | ||
- CheckCaptcha: record { | ||
- captcha_png_base64: text; | ||
- }; | ||
- // Finish the registration using identity_registration_finish | ||
- Finish; | ||
-}; | ||
- | ||
-type CheckCaptchaArg = record { | ||
- solution : text; | ||
-}; | ||
- | ||
-type CheckCaptchaError = variant { | ||
- // The supplied solution was wrong. Try again with the new captcha. | ||
- WrongSolution: record { | ||
- new_captcha_png_base64: text; | ||
- }; | ||
- // This call is unexpected, see next_step. | ||
- UnexpectedCall: record { | ||
- next_step: RegistrationFlowNextStep; | ||
- }; | ||
- // No registration flow ongoing for the caller. | ||
- NoRegistrationFlow; | ||
-}; | ||
- | ||
-type IdRegFinishArg = record { | ||
- authn_method: AuthnMethodData; | ||
-}; | ||
- | ||
-type IdRegFinishResult = record { | ||
- identity_number: nat64; | ||
-}; | ||
- | ||
-type IdRegFinishError = variant { | ||
- // The configured maximum number of identities has been reached. | ||
- IdentityLimitReached; | ||
- // This call is unexpected, see next_step. | ||
- UnexpectedCall: record { | ||
- next_step: RegistrationFlowNextStep; | ||
- }; | ||
- // No registration flow ongoing for the caller. | ||
- NoRegistrationFlow; | ||
- // The supplied authn_method is not valid. | ||
- InvalidAuthnMethod: text; | ||
- // Error while persisting the new identity. | ||
- StorageError: text; | ||
-}; | ||
- | ||
service : (opt InternetIdentityInit) -> { | ||
// Legacy identity management API | ||
// ============================== | ||
@@ -613,17 +558,16 @@ service : (opt InternetIdentityInit) -> { | ||
|
||
// V2 Identity Management API | ||
// ========================== | ||
- // WARNING: The following methods are experimental and may ch 0ange in the future. | ||
- | ||
- // Starts the identity registration flow to create a new identity. | ||
- identity_registration_start: () -> (variant {Ok: IdRegNextStepResult; Err: IdRegStartError;}); | ||
+ // WARNING: The following methods are experimental and may change in the future. | ||
|
||
- // Check the captcha challenge | ||
- // If successful, the registration can be finished with `identity_registration_finish`. | ||
- check_captcha: (CheckCaptchaArg) -> (variant {Ok: IdRegNextStepResult; Err: CheckCaptchaError;}); | ||
+ // Creates a new captcha. The solution needs to be submitted using the | ||
+ // `identity_register` call. | ||
+ captcha_create: () -> (variant {Ok: Challenge; Err;}); | ||
|
||
- // Starts the identity registration flow to create a new identity. | ||
- identity_registration_finish: (IdRegFinishArg) -> (variant {Ok: IdRegFinishResult; Err: IdRegFinishError;}); | ||
+ // Registers a new identity with the given authn_method. | ||
+ // A valid captcha solution to a previously generated captcha (using create_captcha) must be provided. | ||
+ // The sender needs to match the supplied authn_method. | ||
+ identity_register: (AuthnMethodData, CaptchaResult, opt principal) -> (variant {Ok: IdentityNumber; Err: IdentityRegisterError;}); | ||
|
||
// Returns information about the authentication methods of the identity with the given number. | ||
// Only returns the minimal information required for authentication without exposing any metadata such as aliases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this needs to be done every time we introduce a breaking change?
Do you have a script or how do you remember how to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually pull it out again from git history whenever I need it. My hope was that it would not be worth it improving the infrastructure to do that, as we would eventually stop making breaking changes (as APIv2 would be finished)...