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

Rename id_alias-VC-related fields #2391

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demos/vc_issuer/tests/issue_credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ fn should_issue_credential_e2e() -> Result<(), CallError> {
identity_number,
relying_party,
issuer,
rp_id_alias_jwt: prepared_id_alias.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias.issuer_id_alias_signing_input,
};
let id_alias_credentials = ii_api::get_id_alias(&env, ii_id, principal_1(), get_id_alias_req)?
.expect("get id_alias failed");
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/generated/internet_identity_idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ export const idlFactory = ({ IDL }) => {
'signed_delegation' : SignedDelegation,
});
const GetIdAliasRequest = IDL.Record({
'rp_id_alias_jwt' : IDL.Text,
'issuer' : FrontendHostname,
'issuer_id_alias_jwt' : IDL.Text,
'issuer_id_alias_signing_input' : IDL.Text,
'rp_id_alias_signing_input' : IDL.Text,
'relying_party' : FrontendHostname,
'identity_number' : IdentityNumber,
});
Expand Down Expand Up @@ -287,9 +287,9 @@ export const idlFactory = ({ IDL }) => {
'identity_number' : IdentityNumber,
});
const PreparedIdAlias = IDL.Record({
'rp_id_alias_jwt' : IDL.Text,
'issuer_id_alias_jwt' : IDL.Text,
'issuer_id_alias_signing_input' : IDL.Text,
'canister_sig_pk_der' : PublicKey,
'rp_id_alias_signing_input' : IDL.Text,
});
const PrepareIdAliasError = IDL.Variant({
'InternalCanisterError' : IDL.Text,
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/generated/internet_identity_types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ export type GetIdAliasError = { 'InternalCanisterError' : string } |
{ 'Unauthorized' : Principal } |
{ 'NoSuchCredentials' : string };
export interface GetIdAliasRequest {
'rp_id_alias_jwt' : string,
'issuer' : FrontendHostname,
'issuer_id_alias_jwt' : string,
'issuer_id_alias_signing_input' : string,
'rp_id_alias_signing_input' : string,
'relying_party' : FrontendHostname,
'identity_number' : IdentityNumber,
}
Expand Down Expand Up @@ -222,9 +222,9 @@ export interface PrepareIdAliasRequest {
'identity_number' : IdentityNumber,
}
export interface PreparedIdAlias {
'rp_id_alias_jwt' : string,
'issuer_id_alias_jwt' : string,
'issuer_id_alias_signing_input' : string,
'canister_sig_pk_der' : PublicKey,
'rp_id_alias_signing_input' : string,
}
export type PublicKey = Uint8Array | number[];
export interface PublicKeyAuthn { 'pubkey' : PublicKey }
Expand Down
8 changes: 4 additions & 4 deletions src/internet_identity/internet_identity.did
Original file line number Diff line number Diff line change
Expand Up @@ -471,19 +471,19 @@ type PrepareIdAliasError = variant {
/// The prepared id alias contains two (still unsigned) credentials in JWT format,
/// certifying the id alias for the issuer resp. the relying party.
type PreparedIdAlias = record {
rp_id_alias_jwt : text;
issuer_id_alias_jwt : text;
rp_id_alias_signing_input : text;
issuer_id_alias_signing_input : text;
canister_sig_pk_der : PublicKey;
};

/// The request to retrieve the actual signed id alias credentials.
/// The field values should be equal to the values of corresponding
/// fields from the preceding `PrepareIdAliasRequest` and `PrepareIdAliasResponse`.
type GetIdAliasRequest = record {
rp_id_alias_jwt : text;
issuer : FrontendHostname;
issuer_id_alias_jwt : text;
relying_party : FrontendHostname;
rp_id_alias_signing_input : text;
issuer_id_alias_signing_input : text;
identity_number : IdentityNumber;
};

Expand Down
4 changes: 2 additions & 2 deletions src/internet_identity/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,8 @@ mod attribute_sharing_mvp {
relying_party: req.relying_party,
issuer: req.issuer,
},
&req.rp_id_alias_jwt,
&req.issuer_id_alias_jwt,
&req.rp_id_alias_signing_input,
&req.issuer_id_alias_signing_input,
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/internet_identity/src/vc_mvp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ pub async fn prepare_id_alias(
update_root_hash();
PreparedIdAlias {
canister_sig_pk_der: ByteBuf::from(canister_sig_pk.to_der()),
rp_id_alias_jwt: String::from_utf8(rp_signing_input).unwrap(),
issuer_id_alias_jwt: String::from_utf8(issuer_signing_input).unwrap(),
rp_id_alias_signing_input: String::from_utf8(rp_signing_input).unwrap(),
issuer_id_alias_signing_input: String::from_utf8(issuer_signing_input).unwrap(),
}
}

Expand Down
52 changes: 26 additions & 26 deletions src/internet_identity/tests/integration/vc_mvp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ fn should_get_valid_id_alias() -> Result<(), CallError> {
identity_number,
relying_party,
issuer,
rp_id_alias_jwt: prepared_id_alias.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias.issuer_id_alias_signing_input,
};
let id_alias_credentials =
api::vc_mvp::get_id_alias(&env, canister_id, principal_1(), get_id_alias_req)?
Expand Down Expand Up @@ -142,8 +142,8 @@ fn should_get_different_id_alias_for_different_users() -> Result<(), CallError>
identity_number: identity_number_1,
relying_party: relying_party.clone(),
issuer: issuer.clone(),
rp_id_alias_jwt: prepared_id_alias_1.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_1.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_1.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_1.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_1.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand All @@ -163,8 +163,8 @@ fn should_get_different_id_alias_for_different_users() -> Result<(), CallError>
identity_number: identity_number_2,
relying_party,
issuer,
rp_id_alias_jwt: prepared_id_alias_2.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_2.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_2.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_2.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_2.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand Down Expand Up @@ -265,8 +265,8 @@ fn should_get_different_id_alias_for_different_relying_parties() -> Result<(), C
identity_number,
relying_party: relying_party_1,
issuer: issuer.clone(),
rp_id_alias_jwt: prepared_id_alias_1.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_1.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_1.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_1.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_1.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand All @@ -286,8 +286,8 @@ fn should_get_different_id_alias_for_different_relying_parties() -> Result<(), C
identity_number,
relying_party: relying_party_2,
issuer,
rp_id_alias_jwt: prepared_id_alias_2.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_2.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_2.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_2.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_2.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand Down Expand Up @@ -392,8 +392,8 @@ fn should_get_different_id_alias_for_different_issuers() -> Result<(), CallError
identity_number,
relying_party: relying_party.clone(),
issuer: issuer_1,
rp_id_alias_jwt: prepared_id_alias_1.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_1.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_1.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_1.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_1.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand All @@ -413,8 +413,8 @@ fn should_get_different_id_alias_for_different_issuers() -> Result<(), CallError
identity_number,
relying_party,
issuer: issuer_2,
rp_id_alias_jwt: prepared_id_alias_2.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_2.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_2.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_2.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_2.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand Down Expand Up @@ -513,8 +513,8 @@ fn should_get_different_id_alias_for_different_flows() -> Result<(), CallError>
identity_number,
relying_party: relying_party.clone(),
issuer: issuer.clone(),
rp_id_alias_jwt: prepared_id_alias_1.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_1.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_1.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_1.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_1.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand All @@ -530,8 +530,8 @@ fn should_get_different_id_alias_for_different_flows() -> Result<(), CallError>
identity_number,
relying_party,
issuer,
rp_id_alias_jwt: prepared_id_alias_2.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias_2.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias_2.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias_2.issuer_id_alias_signing_input,
},
CanisterSigPublicKey::try_from(prepared_id_alias_2.canister_sig_pk_der.as_ref())
.expect("failed parsing canister sig pk"),
Expand Down Expand Up @@ -654,8 +654,8 @@ fn should_not_get_id_alias_for_different_user() -> Result<(), CallError> {
identity_number, // belongs to principal_1
relying_party,
issuer,
rp_id_alias_jwt: "dummy_jwt".to_string(),
issuer_id_alias_jwt: "another_dummy_jwt".to_string(),
rp_id_alias_signing_input: "dummy_jwt".to_string(),
issuer_id_alias_signing_input: "another_dummy_jwt".to_string(),
},
)?;

Expand All @@ -680,8 +680,8 @@ fn should_not_get_id_alias_if_not_prepared() -> Result<(), CallError> {
identity_number,
relying_party,
issuer,
rp_id_alias_jwt: "dummy jwt".to_string(),
issuer_id_alias_jwt: "another dummy jwt".to_string(),
rp_id_alias_signing_input: "dummy signing input".to_string(),
issuer_id_alias_signing_input: "another dummy signing input".to_string(),
},
)?;

Expand Down Expand Up @@ -722,8 +722,8 @@ fn should_not_get_prepared_id_alias_after_ii_upgrade() -> Result<(), CallError>
identity_number,
relying_party,
issuer,
rp_id_alias_jwt: prepared_id_alias.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias.issuer_id_alias_signing_input,
};
let response = api::vc_mvp::get_id_alias(&env, canister_id, principal_1(), get_id_alias_req)?;
assert!(matches!(
Expand Down Expand Up @@ -760,8 +760,8 @@ fn should_not_validate_id_alias_with_wrong_canister_key() {
identity_number,
relying_party,
issuer,
rp_id_alias_jwt: prepared_id_alias.rp_id_alias_jwt,
issuer_id_alias_jwt: prepared_id_alias.issuer_id_alias_jwt,
rp_id_alias_signing_input: prepared_id_alias.rp_id_alias_signing_input,
issuer_id_alias_signing_input: prepared_id_alias.issuer_id_alias_signing_input,
};

let id_alias_credentials =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,16 @@ pub struct SignedIdAlias {

#[derive(Clone, Debug, CandidType, Deserialize, Eq, PartialEq)]
pub struct PrepareIdAliasRequest {
#[serde(rename = "identity_number")]
pub identity_number: IdentityNumber,
#[serde(rename = "relying_party")]
pub relying_party: FrontendHostname,
#[serde(rename = "issuer")]
pub issuer: FrontendHostname,
}

#[derive(Clone, Debug, CandidType, Deserialize, Eq, PartialEq)]
pub struct PreparedIdAlias {
#[serde(rename = "canister_sig_pk_der")]
pub canister_sig_pk_der: CanisterSigPublicKeyDer,
#[serde(rename = "rp_id_alias_jwt")]
pub rp_id_alias_jwt: String,
#[serde(rename = "issuer_id_alias_jwt")]
pub issuer_id_alias_jwt: String,
pub rp_id_alias_signing_input: String,
pub issuer_id_alias_signing_input: String,
}

#[derive(Clone, Debug, CandidType, Deserialize, Eq, PartialEq)]
Expand All @@ -44,16 +38,11 @@ pub struct IdAliasCredentials {

#[derive(Clone, Debug, CandidType, Deserialize, Eq, PartialEq)]
pub struct GetIdAliasRequest {
#[serde(rename = "identity_number")]
pub identity_number: IdentityNumber,
#[serde(rename = "relying_party")]
pub relying_party: FrontendHostname,
#[serde(rename = "issuer")]
pub issuer: FrontendHostname,
#[serde(rename = "rp_id_alias_jwt")]
pub rp_id_alias_jwt: String,
#[serde(rename = "issuer_id_alias_jwt")]
pub issuer_id_alias_jwt: String,
pub rp_id_alias_signing_input: String,
pub issuer_id_alias_signing_input: String,
}

#[derive(Clone, Debug, CandidType, Deserialize, Eq, PartialEq)]
Expand Down
Loading