Skip to content

Commit

Permalink
Rename user_principals to auth_principals
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles committed Aug 6, 2024
1 parent af7488b commit cba6fba
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions backend/canisters/identity/api/can.did
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion backend/canisters/identity/api/src/main.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion backend/canisters/identity/api/src/queries/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod auth_principals;
pub mod check_auth_principal;
pub mod get_delegation;
pub mod user_principals;
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion backend/canisters/identity/impl/src/queries/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod auth_principals;
mod check_auth_principal;
mod get_delegation;
mod http_request;
mod user_principals;

0 comments on commit cba6fba

Please sign in to comment.