Skip to content
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

feat(BOUN-1236): add skeleton service methods and wrap with authorization #2428

Open
wants to merge 1 commit into
base: or-salt-log-2
Choose a base branch
from

Conversation

rikonor
Copy link
Contributor

@rikonor rikonor commented Nov 4, 2024

This change adds initial empty implementations for the canister methods and also adds authorization to the canister endpoints. A follow-up will add the relevant logic to the canister method implementations.

@rikonor rikonor self-assigned this Nov 4, 2024
@rikonor rikonor requested a review from a team as a code owner November 4, 2024 20:09
@github-actions github-actions bot added the feat label Nov 4, 2024
Copy link
Contributor

@nikolay-komarevskiy nikolay-komarevskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job! Left some suggestions.

}

pub trait Authorize {
fn authorize(&self, p: &Principal) -> Result<(), AuthorizeError>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: use is_authorized(). Authorize could also mean that You grant authorization.

fn register(_pubkey: Vec<u8>) -> RegisterResponse {
unimplemented!()
fn register(pubkey: Vec<u8>) -> RegisterResponse {
match REGISTRATOR.with(|v| v.borrow().register(&pubkey)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving these matching statements into the register() function. This would make the canister method thinner and easier. Plus the unit test will cover all the logic, including error handling. Also consider implementing conversion of errors into each other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants