Skip to content

Commit

Permalink
Use optional field
Browse files Browse the repository at this point in the history
  • Loading branch information
lmuntaner committed Nov 15, 2024
1 parent 17cab7c commit f158174
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions scripts/deploy.backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if [ -n "${ENV+1}" ]; then
ecdsa_key_name = \"$ECDSA_KEY_NAME\";
allowed_callers = vec {};
cfs_canister_id = opt principal \"$SIGNER_CANISTER_ID\";
derivation_origin = \"$DERIVATION_ORIGIN\";
derivation_origin = opt \"$DERIVATION_ORIGIN\";
supported_credentials = opt vec {
record {
credential_type = variant { ProofOfUniqueness };
Expand All @@ -73,7 +73,7 @@ else
ecdsa_key_name = \"$ECDSA_KEY_NAME\";
allowed_callers = vec {};
cfs_canister_id = opt principal \"$SIGNER_CANISTER_ID\";
derivation_origin = \"$DERIVATION_ORIGIN\";
derivation_origin = opt \"$DERIVATION_ORIGIN\";
supported_credentials = opt vec {
record {
credential_type = variant { ProofOfUniqueness };
Expand Down
4 changes: 2 additions & 2 deletions src/backend/backend.did
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type CanisterStatusResultV2 = record {
type CanisterStatusType = variant { stopped; stopping; running };
type Config = record {
api : opt Guards;
derivation_origin : text;
derivation_origin : opt text;
ecdsa_key_name : text;
cfs_canister_id : opt principal;
allowed_callers : vec principal;
Expand Down Expand Up @@ -100,7 +100,7 @@ type HttpResponse = record {
type IcrcToken = record { ledger_id : principal; index_id : opt principal };
type InitArg = record {
api : opt Guards;
derivation_origin : text;
derivation_origin : opt text;
ecdsa_key_name : text;
cfs_canister_id : opt principal;
allowed_callers : vec principal;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/tests/it/utils/pocketic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ pub(crate) fn init_arg() -> Arg {
cfs_canister_id: Some(
Principal::from_text(SIGNER_CANISTER_ID.to_string()).expect("wrong cfs canister id"),
),
derivation_origin: "https://l7rua-raaaa-aaaap-ahh6a-cai.ic0.app".to_string(),
derivation_origin: Some("https://l7rua-raaaa-aaaap-ahh6a-cai.ic0.app".to_string()),
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/declarations/backend/backend.did
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type CanisterStatusResultV2 = record {
type CanisterStatusType = variant { stopped; stopping; running };
type Config = record {
api : opt Guards;
derivation_origin : text;
derivation_origin : opt text;
ecdsa_key_name : text;
cfs_canister_id : opt principal;
allowed_callers : vec principal;
Expand Down Expand Up @@ -100,7 +100,7 @@ type HttpResponse = record {
type IcrcToken = record { ledger_id : principal; index_id : opt principal };
type InitArg = record {
api : opt Guards;
derivation_origin : text;
derivation_origin : opt text;
ecdsa_key_name : text;
cfs_canister_id : opt principal;
allowed_callers : vec principal;
Expand Down
4 changes: 2 additions & 2 deletions src/declarations/backend/backend.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface CanisterStatusResultV2 {
export type CanisterStatusType = { stopped: null } | { stopping: null } | { running: null };
export interface Config {
api: [] | [Guards];
derivation_origin: string;
derivation_origin: [] | [string];
ecdsa_key_name: string;
cfs_canister_id: [] | [Principal];
allowed_callers: Array<Principal>;
Expand Down Expand Up @@ -109,7 +109,7 @@ export interface IcrcToken {
}
export interface InitArg {
api: [] | [Guards];
derivation_origin: string;
derivation_origin: [] | [string];
ecdsa_key_name: string;
cfs_canister_id: [] | [Principal];
allowed_callers: Array<Principal>;
Expand Down
6 changes: 3 additions & 3 deletions src/declarations/backend/backend.factory.certified.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const idlFactory = ({ IDL }) => {
});
const InitArg = IDL.Record({
api: IDL.Opt(Guards),
derivation_origin: IDL.Text,
derivation_origin: IDL.Opt(IDL.Text),
ecdsa_key_name: IDL.Text,
cfs_canister_id: IDL.Opt(IDL.Principal),
allowed_callers: IDL.Vec(IDL.Principal),
Expand Down Expand Up @@ -129,7 +129,7 @@ export const idlFactory = ({ IDL }) => {
});
const Config = IDL.Record({
api: IDL.Opt(Guards),
derivation_origin: IDL.Text,
derivation_origin: IDL.Opt(IDL.Text),
ecdsa_key_name: IDL.Text,
cfs_canister_id: IDL.Opt(IDL.Principal),
allowed_callers: IDL.Vec(IDL.Principal),
Expand Down Expand Up @@ -333,7 +333,7 @@ export const init = ({ IDL }) => {
});
const InitArg = IDL.Record({
api: IDL.Opt(Guards),
derivation_origin: IDL.Text,
derivation_origin: IDL.Opt(IDL.Text),
ecdsa_key_name: IDL.Text,
cfs_canister_id: IDL.Opt(IDL.Principal),
allowed_callers: IDL.Vec(IDL.Principal),
Expand Down
6 changes: 3 additions & 3 deletions src/declarations/backend/backend.factory.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const idlFactory = ({ IDL }) => {
});
const InitArg = IDL.Record({
api: IDL.Opt(Guards),
derivation_origin: IDL.Text,
derivation_origin: IDL.Opt(IDL.Text),
ecdsa_key_name: IDL.Text,
cfs_canister_id: IDL.Opt(IDL.Principal),
allowed_callers: IDL.Vec(IDL.Principal),
Expand Down Expand Up @@ -129,7 +129,7 @@ export const idlFactory = ({ IDL }) => {
});
const Config = IDL.Record({
api: IDL.Opt(Guards),
derivation_origin: IDL.Text,
derivation_origin: IDL.Opt(IDL.Text),
ecdsa_key_name: IDL.Text,
cfs_canister_id: IDL.Opt(IDL.Principal),
allowed_callers: IDL.Vec(IDL.Principal),
Expand Down Expand Up @@ -333,7 +333,7 @@ export const init = ({ IDL }) => {
});
const InitArg = IDL.Record({
api: IDL.Opt(Guards),
derivation_origin: IDL.Text,
derivation_origin: IDL.Opt(IDL.Text),
ecdsa_key_name: IDL.Text,
cfs_canister_id: IDL.Opt(IDL.Principal),
allowed_callers: IDL.Vec(IDL.Principal),
Expand Down
4 changes: 2 additions & 2 deletions src/shared/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct InitArg {
pub cfs_canister_id: Option<Principal>,
/// Derivation origins when logging in the dapp with Internet Identity.
/// Used to validate the id alias credential which includes the derivation origin of the id alias.
pub derivation_origin: String,
pub derivation_origin: Option<String>,
}

#[derive(CandidType, Deserialize, Eq, PartialEq, Debug, Copy, Clone)]
Expand Down Expand Up @@ -79,7 +79,7 @@ pub struct Config {
pub cfs_canister_id: Option<Principal>,
/// Derivation origins when logging in the dapp with Internet Identity.
/// Used to validate the id alias credential which includes the derivation origin of the id alias.
pub derivation_origin: String,
pub derivation_origin: Option<String>,
}

pub mod transaction {
Expand Down

0 comments on commit f158174

Please sign in to comment.