From cba6fba668dbb6cd9c60b132c423a8cdcc615601 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Tue, 6 Aug 2024 10:40:49 +0100 Subject: [PATCH] Rename `user_principals` to `auth_principals` --- backend/canisters/identity/api/can.did | 18 +++++++++--------- backend/canisters/identity/api/src/main.rs | 2 +- .../{user_principals.rs => auth_principals.rs} | 0 .../canisters/identity/api/src/queries/mod.rs | 2 +- .../{user_principals.rs => auth_principals.rs} | 8 ++++---- .../canisters/identity/impl/src/queries/mod.rs | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) rename backend/canisters/identity/api/src/queries/{user_principals.rs => auth_principals.rs} (100%) rename backend/canisters/identity/impl/src/queries/{user_principals.rs => auth_principals.rs} (77%) diff --git a/backend/canisters/identity/api/can.did b/backend/canisters/identity/api/can.did index 6f957f23be..df05df84fb 100644 --- a/backend/canisters/identity/api/can.did +++ b/backend/canisters/identity/api/can.did @@ -2,6 +2,14 @@ type Nanoseconds = nat64; type PublicKey = blob; type TimestampNanoseconds = nat64; +type AuthPrincipalsResponse = variant { + Success : vec record { + "principal" : principal; + originating_canister : principal; + }; + NotFound; +}; + type CheckAuthPrincipalResponse = variant { Success; NotFound; @@ -25,14 +33,6 @@ type SignedDelegation = record { signature : blob; }; -type UserPrincipalsResponse = variant { - Success : vec record { - "principal" : principal; - originating_canister : principal; - }; - NotFound; -}; - type GenerateChallengeResponse = variant { Success : record { key : nat32; @@ -105,9 +105,9 @@ type PrepareDelegationSuccess = record { }; service : { + auth_principals : (record {}) -> (AuthPrincipalsResponse) query; check_auth_principal : (record {}) -> (CheckAuthPrincipalResponse) query; get_delegation : (GetDelegationArgs) -> (GetDelegationResponse) query; - user_principals : (record {}) -> (UserPrincipalsResponse) query; approve_identity_link : (ApproveIdentityLinkArgs) -> (ApproveIdentityLinkResponse); create_identity : (CreateIdentityArgs) -> (CreateIdentityResponse); generate_challenge : (record {}) -> (GenerateChallengeResponse); diff --git a/backend/canisters/identity/api/src/main.rs b/backend/canisters/identity/api/src/main.rs index 7b421d1894..7ec11f94bf 100644 --- a/backend/canisters/identity/api/src/main.rs +++ b/backend/canisters/identity/api/src/main.rs @@ -1,9 +1,9 @@ use candid_gen::generate_candid_method; fn main() { + generate_candid_method!(identity, auth_principals, query); generate_candid_method!(identity, check_auth_principal, query); generate_candid_method!(identity, get_delegation, query); - generate_candid_method!(identity, user_principals, query); generate_candid_method!(identity, approve_identity_link, update); generate_candid_method!(identity, create_identity, update); diff --git a/backend/canisters/identity/api/src/queries/user_principals.rs b/backend/canisters/identity/api/src/queries/auth_principals.rs similarity index 100% rename from backend/canisters/identity/api/src/queries/user_principals.rs rename to backend/canisters/identity/api/src/queries/auth_principals.rs diff --git a/backend/canisters/identity/api/src/queries/mod.rs b/backend/canisters/identity/api/src/queries/mod.rs index a8fe21d835..4db64e9c95 100644 --- a/backend/canisters/identity/api/src/queries/mod.rs +++ b/backend/canisters/identity/api/src/queries/mod.rs @@ -1,3 +1,3 @@ +pub mod auth_principals; pub mod check_auth_principal; pub mod get_delegation; -pub mod user_principals; diff --git a/backend/canisters/identity/impl/src/queries/user_principals.rs b/backend/canisters/identity/impl/src/queries/auth_principals.rs similarity index 77% rename from backend/canisters/identity/impl/src/queries/user_principals.rs rename to backend/canisters/identity/impl/src/queries/auth_principals.rs index 46b41ca295..d8886e74eb 100644 --- a/backend/canisters/identity/impl/src/queries/user_principals.rs +++ b/backend/canisters/identity/impl/src/queries/auth_principals.rs @@ -1,13 +1,13 @@ use crate::{read_state, RuntimeState}; use ic_cdk::query; -use identity_canister::user_principals::{Response::*, *}; +use identity_canister::auth_principals::{Response::*, *}; #[query] -fn user_principals() -> Response { - read_state(user_principals_impl) +fn auth_principals() -> Response { + read_state(auth_principals_impl) } -fn user_principals_impl(state: &RuntimeState) -> Response { +fn auth_principals_impl(state: &RuntimeState) -> Response { let caller = state.env.caller(); if let Some(user_principal) = state.data.user_principals.get_by_auth_principal(&caller) { diff --git a/backend/canisters/identity/impl/src/queries/mod.rs b/backend/canisters/identity/impl/src/queries/mod.rs index 7fb9bd9b07..a7a0cbc375 100644 --- a/backend/canisters/identity/impl/src/queries/mod.rs +++ b/backend/canisters/identity/impl/src/queries/mod.rs @@ -1,4 +1,4 @@ +mod auth_principals; mod check_auth_principal; mod get_delegation; mod http_request; -mod user_principals;