Skip to content

Commit

Permalink
refactor ⚙: Edited from Option<String> to String because we want that…
Browse files Browse the repository at this point in the history
… the canister manage only stringified certificate. So if the certificate is empty the result is ""
  • Loading branch information
lorenzoronzani committed May 21, 2024
1 parent 51919b0 commit d8c3a70
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
19 changes: 11 additions & 8 deletions deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ type InternetIdentityStats = record {
};
archive_info: ArchiveInfo;
canister_creation_cycles_cost: nat64;
max_num_latest_delegation_origins: nat64;
latest_delegation_origins: vec FrontendHostname
// Map from event aggregation to a sorted list of top 100 sub-keys to their weights.
// Example: {"prepare_delegation_count 24h ic0.app": [{"https://dapp.com", 100}, {"https://dapp2.com", 50}]}
event_aggregations: vec record {text; vec record {text; nat64}};
};

// Configuration parameters related to the archive.
Expand Down Expand Up @@ -227,9 +228,6 @@ type InternetIdentityInit = record {
canister_creation_cycles_cost : opt nat64;
// Rate limit for the `register` call.
register_rate_limit : opt RateLimitConfig;
// Maximum number of latest delegation origins to track.
// Default: 1000
max_num_latest_delegation_origins : opt nat64;
// Maximum number of inflight captchas.
// Default: 500
max_inflight_captchas: opt nat64;
Expand Down Expand Up @@ -538,12 +536,17 @@ service : (opt InternetIdentityInit) -> {
http_request_update: (request: HttpRequest) -> (HttpResponse);

deploy_archive: (wasm: blob) -> (DeployArchiveResult);
/// Returns a batch of entries _sorted by sequence number_ to be archived.
/// This is an update call because the archive information _must_ be certified.
/// Only callable by this IIs archive canister.
// Returns a batch of entries _sorted by sequence number_ to be archived.
// This is an update call because the archive information _must_ be certified.
// Only callable by this IIs archive canister.
fetch_entries: () -> (vec BufferedArchiveEntry);
acknowledge_entries: (sequence_number: nat64) -> ();

// Calls used for event stats housekeeping.
// Only callable by the canister itself.
prune_events_if_necessary: () -> ();
inject_prune_event: (timestamp: Timestamp) -> ();

// V2 API
// WARNING: The following methods are experimental and may change in the future.

Expand Down
3 changes: 2 additions & 1 deletion deps/pulled.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"canisters": {
"rdmx6-jaaaa-aaaaa-aaadq-cai": {
"name": "internet_identity",
"wasm_hash": "764cff569a98a3c4d54cba6750fda63f554fc53e7d42a6365d9bdec3280d63c3",
"wasm_hash": "2357d822cd451f25c0edab3e45db52ab140a2ac8c4b0170201c78acc5bc11779",
"wasm_hash_download": "2357d822cd451f25c0edab3e45db52ab140a2ac8c4b0170201c78acc5bc11779",
"init_guide": "Use '(null)' for sensible defaults. See the candid interface for more details.",
"init_arg": null,
"candid_args": "(opt InternetIdentityInit)",
Expand Down
1 change: 1 addition & 0 deletions frontend/declarations/backend.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export type TransferFeeArg = {};
export type TransferResult = { 'Ok' : BlockIndex } |
{ 'Err' : TransferError };
export interface User {
'mutual_tls_certificate' : string,
'akt_balance' : number,
'payments' : BigUint64Array | bigint[],
'role' : UserRole,
Expand Down
1 change: 1 addition & 0 deletions frontend/declarations/backend.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const idlFactory = ({ IDL }) => {
});
const UserRole = IDL.Variant({ 'Admin' : IDL.Null, 'Deployer' : IDL.Null });
const User = IDL.Record({
'mutual_tls_certificate' : IDL.Text,
'akt_balance' : IDL.Float64,
'payments' : IDL.Vec(IDL.Nat64),
'role' : UserRole,
Expand Down
1 change: 1 addition & 0 deletions src/backend/backend.did
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type User = record {
created_at : TimestampNs;
payments : vec nat64;
akt_balance : float64;
mutual_tls_certificate : text;
};

type GetUserResult = variant {
Expand Down
6 changes: 3 additions & 3 deletions src/backend/src/api/types/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub struct User {
created_at: TimestampNs,
payments: Vec<u64>,
akt_balance: f64,
mutual_tls_certificate: Option<String>,
mutual_tls_certificate: String,
}

impl User {
Expand All @@ -84,7 +84,7 @@ impl User {
created_at: get_time_nanos(),
payments: vec![],
akt_balance: 0.0,
mutual_tls_certificate: None,
mutual_tls_certificate: "".to_string(),
}
}

Expand Down Expand Up @@ -119,7 +119,7 @@ impl User {
}

pub fn set_mutual_tls_certificate(&mut self, certificate: String) {
self.mutual_tls_certificate = Some(certificate);
self.mutual_tls_certificate = certificate;
}
}

Expand Down

0 comments on commit d8c3a70

Please sign in to comment.