Skip to content

Commit

Permalink
Rename user_principals to auth_principals (#6206)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Aug 6, 2024
1 parent af7488b commit 7e395de
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions backend/canisters/identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Add `AlreadyLinkedToPrincipal` to `initiate_identity_link` response ([#6204](https://github.com/open-chat-labs/open-chat/pull/6204))
- Rename `user_principals` to `auth_principals` ([#6206](https://github.com/open-chat-labs/open-chat/pull/6206))

## [[2.0.1251](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1251-identity)] - 2024-07-25

Expand Down
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 7e395de

Please sign in to comment.