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

fix: update verifier logic #615

Merged
merged 13 commits into from
Aug 15, 2023
Merged

fix: update verifier logic #615

merged 13 commits into from
Aug 15, 2023

Conversation

joyqvq
Copy link
Collaborator

@joyqvq joyqvq commented Jun 29, 2023

reflect all verifier changes based on circuit updates.

@joyqvq joyqvq force-pushed the zklogin-v2-fc branch 2 times, most recently from f6385d6 to db13b9a Compare July 5, 2023 22:35
@joyqvq joyqvq requested review from mskd12 and kchalkias July 5, 2023 22:35
@joyqvq joyqvq changed the title zklogin: verifier updates to new circuit fix: update verifier logic Jul 5, 2023
@joyqvq joyqvq marked this pull request as ready for review July 5, 2023 22:36
@joyqvq joyqvq force-pushed the zklogin-v2-fc branch 3 times, most recently from 726477c to f10c4ac Compare July 24, 2023 17:38
@joyqvq joyqvq force-pushed the zklogin-v2-fc branch 14 times, most recently from f7cd36d to 26eb510 Compare July 27, 2023 16:23

/// Parse OAuthProviderContent from the reader struct.
pub fn from_reader(reader: OAuthProviderContentReader) -> FastCryptoResult<Self> {
if reader.alg != "RS256" || reader.my_use != "sig" || reader.kty != "RSA" {
Copy link
Contributor

@mskd12 mskd12 Jul 27, 2023

Choose a reason for hiding this comment

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

I'd like us to be careful with this check. After George's exploration of JWTs is done, let's see if the JWK headers actually contain all these fields. I remember seeing some headers without alg.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

happy to remove when new providers appear to not have this. for now, the three providers we want to launch with all satisfy this.

@joyqvq joyqvq force-pushed the zklogin-v2-fc branch 2 times, most recently from b4e65c6 to 8f03c04 Compare August 7, 2023 19:15
@joyqvq joyqvq force-pushed the zklogin-v2-fc branch 4 times, most recently from 849cfa5 to 0adf9f5 Compare August 14, 2023 19:28
let mut poseidon = PoseidonWrapper::new();
let addr_seed = to_field(&self.address_seed)?;

let (first_half, second_half) = eph_pubkey_bytes.split_at(17);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an explanation and/or name to the magical constant.

.to_bytes_be()
.1
}
/// Calculate the poseidon hash of the field element inputs.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be in poseidon.rs instead.

let first_bigint = BigInt::from_bytes_be(Sign::Plus, first_half);
let second_bigint = BigInt::from_bytes_be(Sign::Plus, second_half);
let mut poseidon = PoseidonWrapper::new();
let first = Bn254Fr::from_str(&first_bigint.to_string()).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the intermediate strings necessary in these conversions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

turns out there is a conversion from biguint to Fr. revised.

pub fn split_to_two_frs(eph_pk_bytes: &[u8]) -> Result<(Bn254Fr, Bn254Fr), FastCryptoError> {
// Split the bytes deterministically such that the first element contains the first 128
// bits of the hash, and the second element contains the latter ones.
let (first_half, second_half) = eph_pk_bytes.split_at(17);
Copy link
Contributor

@mskd12 mskd12 Aug 14, 2023

Choose a reason for hiding this comment

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

While this works, I recommend aligning with the logic elsewhere (in case we move from 33 to 34 in the future). Could we instead split at (len - 16) so that the first and second chunks are always guaranteed to be eph_pk / 2^128 and eph_pk % 2^128 respectively?

const AUD: &str = "aud";
const NUM_EXTRACTABLE_STRINGS: u8 = 5;
const MAX_EXTRACTABLE_STR_LEN: u16 = 150;
const MAX_EXTRACTABLE_STR_LEN_B64: u16 = 4 * (1 + MAX_EXTRACTABLE_STR_LEN / 3);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add some documentation to these constants.

Environment::Production => &GLOBAL_VERIFYING_KEY,
Environment::Test => &INSECURE_GLOBAL_VERIFYING_KEY,
};
Groth16::<Bn254>::verify_with_processed_vk(pvk, public_inputs, &proof)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can avoid the map_err because the verify function also returns a FastCryptoError.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this returns a arkworks error enum so needs to be mapped

@joyqvq joyqvq force-pushed the zklogin-v2-fc branch 2 times, most recently from dda52dd to 8a7537e Compare August 15, 2023 18:07
@joyqvq joyqvq merged commit 489ee4b into main Aug 15, 2023
@joyqvq joyqvq deleted the zklogin-v2-fc branch August 15, 2023 18:47
joyqvq added a commit to MystenLabs/sui that referenced this pull request Aug 18, 2023
## Description 
this PR contains mainly 3 changes: 
1. update to use the new entrypoint in fastcrypto: verify_zklogin
2. update JWK updater to use fetch_jwks in fastcrypto and store the
(kid, iss) -> jwk mapping, instead of kid -> jwk. so we can support
multiple iss (providers). this also lets fastcrypto manage "supported
providers". few renaming from OAuthProviderContent to JWK.
3. protocol config change: zklogin_supported_providers, use_secure_vk.
zklogin_auth flag still in place this is only enabled for devnet.

(4 for testing) keytool command for e2e testing

based on MystenLabs/fastcrypto#615

## Test Plan 
```
# start a localnet
cargo run --bin sui-test-validator

# in another tab
cargo build --bin sui && target/debug/sui keytool zk-login-sign-and-execute-tx --max-epoch 10 --fixed true

# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
```


https://suiexplorer.com/txblock/9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ?network=local

![image](https://github.com/MystenLabs/sui/assets/108701016/25f15c23-c242-4aa1-9223-4230e208b84e)

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [x] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [x] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
damirka pushed a commit to MystenLabs/sui that referenced this pull request Aug 22, 2023
## Description 
this PR contains mainly 3 changes: 
1. update to use the new entrypoint in fastcrypto: verify_zklogin
2. update JWK updater to use fetch_jwks in fastcrypto and store the
(kid, iss) -> jwk mapping, instead of kid -> jwk. so we can support
multiple iss (providers). this also lets fastcrypto manage "supported
providers". few renaming from OAuthProviderContent to JWK.
3. protocol config change: zklogin_supported_providers, use_secure_vk.
zklogin_auth flag still in place this is only enabled for devnet.

(4 for testing) keytool command for e2e testing

based on MystenLabs/fastcrypto#615

## Test Plan 
```
# start a localnet
cargo run --bin sui-test-validator

# in another tab
cargo build --bin sui && target/debug/sui keytool zk-login-sign-and-execute-tx --max-epoch 10 --fixed true

# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
```


https://suiexplorer.com/txblock/9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ?network=local

![image](https://github.com/MystenLabs/sui/assets/108701016/25f15c23-c242-4aa1-9223-4230e208b84e)

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [x] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [x] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
damirka pushed a commit to MystenLabs/sui that referenced this pull request Aug 23, 2023
## Description 
this PR contains mainly 3 changes: 
1. update to use the new entrypoint in fastcrypto: verify_zklogin
2. update JWK updater to use fetch_jwks in fastcrypto and store the
(kid, iss) -> jwk mapping, instead of kid -> jwk. so we can support
multiple iss (providers). this also lets fastcrypto manage "supported
providers". few renaming from OAuthProviderContent to JWK.
3. protocol config change: zklogin_supported_providers, use_secure_vk.
zklogin_auth flag still in place this is only enabled for devnet.

(4 for testing) keytool command for e2e testing

based on MystenLabs/fastcrypto#615

## Test Plan 
```
# start a localnet
cargo run --bin sui-test-validator

# in another tab
cargo build --bin sui && target/debug/sui keytool zk-login-sign-and-execute-tx --max-epoch 10 --fixed true

# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
```


https://suiexplorer.com/txblock/9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ?network=local

![image](https://github.com/MystenLabs/sui/assets/108701016/25f15c23-c242-4aa1-9223-4230e208b84e)

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [x] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [x] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
randall-Mysten pushed a commit to MystenLabs/sui that referenced this pull request Sep 6, 2023
## Description 
this PR contains mainly 3 changes: 
1. update to use the new entrypoint in fastcrypto: verify_zklogin
2. update JWK updater to use fetch_jwks in fastcrypto and store the
(kid, iss) -> jwk mapping, instead of kid -> jwk. so we can support
multiple iss (providers). this also lets fastcrypto manage "supported
providers". few renaming from OAuthProviderContent to JWK.
3. protocol config change: zklogin_supported_providers, use_secure_vk.
zklogin_auth flag still in place this is only enabled for devnet.

(4 for testing) keytool command for e2e testing

based on MystenLabs/fastcrypto#615

## Test Plan 
```
# start a localnet
cargo run --bin sui-test-validator

# in another tab
cargo build --bin sui && target/debug/sui keytool zk-login-sign-and-execute-tx --max-epoch 10 --fixed true

# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
# use prompt to test 3 providers' url, use fixed if you want the default key and randomness

Ephemeral key identifier: 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f
Ephemeral pubkey (BigInt): 84029355920633174015103288781128426107680789454168570548782290541079926444544
Jwt randomness: 100681567828351849884072155819400689117
Visit URL (Google): https://accounts.google.com/o/oauth2/v2/auth?client_id=575519204237-msop9ep45u2uo98hapqmngv8d84qdc8k.apps.googleusercontent.com&response_type=id_token&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Twitch): https://id.twitch.tv/oauth2/authorize?client_id=rs1bh065i9ya4ydvifixl4kss0uhpt&force_verify=true&lang=en&login_type=login&redirect_uri=https://sui.io/&response_type=id_token&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI
Visit URL (Facebook): https://www.facebook.com/v17.0/dialog/oauth?client_id=233307156352917&redirect_uri=https://sui.io/&scope=openid&nonce=hTPpgF7XAKbW37rEUS6pEVZqmoI&response_type=id_token
Finish login and paste the entire URL here (e.g. https://sui.io/#id_token=...):
https://sui.io/#id_token=$YOUR_TOKEN_HERE&authuser=1&prompt=none
User salt: 37603297217831327253368351620768767386
ZkLogin inputs:
"{\"proof_points\":{\"pi_a\":[\"11919750190958936097341971645310122361427237718339506968604484178434524183763\",\"4066396655503961643966719205021673883457905225199432791695293704762383515464\",\"1\"],\"pi_b\":[[\"4944611897670024879056817717532675736403113855465546218202719469807483285716\",\"16588919619512150925750036824511259013041883375734888504590662076356111031305\"],[\"21216051686412759119183634053470555744351991062479561416927343692238334485548\",\"7497144533451348825947902642248234141372654747858237668577407146943851844730\"],[\"1\",\"0\"]],\"pi_c\":[\"14631487662109801464392056573524864320058039577512853397500854951219322772917\",\"17171172537255313036364669593310031389402112944054741144631323570508702243961\",\"1\"]},\"address_seed\":\"6766845480040838487230155646516397460223616307094485793506729789519059777352\",\"claims\":[{\"name\":\"iss\",\"value_base64\":\"yJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC\",\"index_mod_4\":1},{\"name\":\"aud\",\"value_base64\":\"CJhdWQiOiI1NzU1MTkyMDQyMzctbXNvcDllcDQ1dTJ1bzk4aGFwcW1uZ3Y4ZDg0cWRjOGsuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLC\",\"index_mod_4\":1}],\"header_base64\":\"eyJhbGciOiJSUzI1NiIsImtpZCI6IjdjOWM3OGUzYjAwZTFiYjA5MmQyNDZjODg3YjExMjIwYzg3YjdkMjAiLCJ0eXAiOiJKV1QifQ\"}"
ZkLogin Address: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32
Faucet requested and created test transaction: V1(TransactionDataV1 { kind: ProgrammableTransaction(ProgrammableTransaction { inputs: [Pure([190, 243, 14, 103, 26, 137, 73, 150, 28, 21, 83, 14, 186, 35, 123, 183, 214, 96, 104, 37, 174, 31, 244, 109, 131, 136, 4, 129, 106, 24, 197, 127]), Object(ImmOrOwnedObject((0xd93388f0bcdd1730ee4d5ff3b73a2f5301a2f6e13df3b84d23155698a9b450c6, SequenceNumber(2), o#FFJqkV96f6VtsyGKEn2BqJokAy6oGuW3SUsYtthgrvCk)))], commands: [TransferObjects([Input(1)], Input(0))] }), sender: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, gas_data: GasData { payment: [(0x3f34a90f021abdc7928c335da354553255b96af4f8237a7d896a98febb58ab9e, SequenceNumber(2), o#3q1NmyLmHyskTwSMG7r7rSBDUd1kkiZQULoXmDGYDH8S)], owner: 0x504aade5d02308b1b7e58775adde9e1316f71898e2996c94ddd668fd559cdf32, price: 1000, budget: 5000000 }, expiration: None })
ZkLogin Authenticator Signature Serialized: "BQNNMTE5MTk3NTAxOTA5NTg5MzYwOTczNDE5NzE2NDUzMTAxMjIzNjE0MjcyMzc3MTgzMzk1MDY5Njg2MDQ0ODQxNzg0MzQ1MjQxODM3NjNMNDA2NjM5NjY1NTUwMzk2MTY0Mzk2NjcxOTIwNTAyMTY3Mzg4MzQ1NzkwNTIyNTE5OTQzMjc5MTY5NTI5MzcwNDc2MjM4MzUxNTQ2NAExAwJMNDk0NDYxMTg5NzY3MDAyNDg3OTA1NjgxNzcxNzUzMjY3NTczNjQwMzExMzg1NTQ2NTU0NjIxODIwMjcxOTQ2OTgwNzQ4MzI4NTcxNk0xNjU4ODkxOTYxOTUxMjE1MDkyNTc1MDAzNjgyNDUxMTI1OTAxMzA0MTg4MzM3NTczNDg4ODUwNDU5MDY2MjA3NjM1NjExMTAzMTMwNQJNMjEyMTYwNTE2ODY0MTI3NTkxMTkxODM2MzQwNTM0NzA1NTU3NDQzNTE5OTEwNjI0Nzk1NjE0MTY5MjczNDM2OTIyMzgzMzQ0ODU1NDhMNzQ5NzE0NDUzMzQ1MTM0ODgyNTk0NzkwMjY0MjI0ODIzNDE0MTM3MjY1NDc0Nzg1ODIzNzY2ODU3NzQwNzE0Njk0Mzg1MTg0NDczMAIBMQEwA00xNDYzMTQ4NzY2MjEwOTgwMTQ2NDM5MjA1NjU3MzUyNDg2NDMyMDA1ODAzOTU3NzUxMjg1MzM5NzUwMDg1NDk1MTIxOTMyMjc3MjkxN00xNzE3MTE3MjUzNzI1NTMxMzAzNjM2NDY2OTU5MzMxMDAzMTM4OTQwMjExMjk0NDA1NDc0MTE0NDYzMTMyMzU3MDUwODcwMjI0Mzk2MQExTDY3NjY4NDU0ODAwNDA4Mzg0ODcyMzAxNTU2NDY1MTYzOTc0NjAyMjM2MTYzMDcwOTQ0ODU3OTM1MDY3Mjk3ODk1MTkwNTk3NzczNTICA2lzczF5SnBjM01pT2lKb2RIUndjem92TDJGalkyOTFiblJ6TG1kdmIyZHNaUzVqYjIwaUxDAQNhdWRtQ0poZFdRaU9pSTFOelUxTVRreU1EUXlNemN0YlhOdmNEbGxjRFExZFRKMWJ6azRhR0Z3Y1cxdVozWTRaRGcwY1dSak9Hc3VZWEJ3Y3k1bmIyOW5iR1YxYzJWeVkyOXVkR1Z1ZEM1amIyMGlMQwFmZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqZGpPV00zT0dVellqQXdaVEZpWWpBNU1tUXlORFpqT0RnM1lqRXhNakl3WXpnM1lqZGtNakFpTENKMGVYQWlPaUpLVjFRaWZRCgAAAAAAAABhADkEuv1BTfolleAyzVWVZC/TpCtO0wljxjTRZKfGddxxNhfZ4hRlq438Mo6e/8HnlOZ040OFN4uAzvgrfv4G4gW5xu4WMO8+cRFEpkjbBruyKE9ydM++5T/87lA8waSSAA=="
╭──────────┬────────────────────────────────────────────────╮
│ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
╰──────────┴────────────────────────────────────────────────╯
2023-08-15T20:42:27.650449Z  INFO sui::keytool: ╭──────────┬────────────────────────────────────────────────╮
2023-08-15T20:42:27.650509Z  INFO sui::keytool: │ txDigest │  9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ  │
2023-08-15T20:42:27.650515Z  INFO sui::keytool: ╰──────────┴────────────────────────────────────────────────╯


# the above command should work fine for google and twitch, if the above command does not work for facebook due to pasting issue, use this command instead. all the inputs should be printed from the above command.

target/debug/sui keytool zk-login-enter-token --ephemeral-key-identifier 0xcc2196ee1fa156836daf9bb021d88d648a0023fa387e695d3701667a634a331f --max-epoch 10 --jwt-randomness 100681567828351849884072155819400689117 --kp-bigint 84029355920633174015103288781128426107680789454168570548782290541079926444544 --parsed-token $JWT_TOKEN
```


https://suiexplorer.com/txblock/9V1ie4CkQ3afLtgAGKEmGQApjahkBUu7SAUFw6jRMRjJ?network=local

![image](https://github.com/MystenLabs/sui/assets/108701016/25f15c23-c242-4aa1-9223-4230e208b84e)

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [x] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [x] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
jolestar pushed a commit to rooch-network/fastcrypto that referenced this pull request Apr 12, 2024
* DKG: support weights, faster verification (MystenLabs#619)

* Misc fixes of secp256r1 (MystenLabs#618)

* Sample scalars uniformly

* Ensure canonical byte representation

* Fix call to deserialize

* Add reduced x code path

* Simplify y_odd check

* Refactor

* Remove unused imports

* Check for reduction in Fq -> Fr conversion

* Delete vdf.rs

* Fix zeroize implementation

* Check that cache size is a power of two

* Fix window size = 1

* Prevent overflow

* Fix overflow in division

* Check recovery id

* Reduce z before used to generate nonce

* Clippy

* Remove borrow

* Clearer implementation of byte substring

* Fix recovery id

* Update comment

* Use associated types

* Use underlying cmp impl

* Refactor

* Fmt#

* Avoid unwrap

* Clean up zeroize (MystenLabs#621)

* fix: use forked poseidon (MystenLabs#626)

* chore: update toolchain and bump version for release (MystenLabs#627)

* fix: update verifier logic (MystenLabs#615)

* fix: update verifier logic

* api changes

* rework interface changes

* fix tests

* minor documentation change

* address comments

* add utils to fastcrypto

* fix split

* move poseidon and fix bigin bytes parse

* update crates

* use BigUint to convert to Bn254Fr

* changes from 0814

* lint fix

* fix: downgrade ark-ff (MystenLabs#629)

* Minor clean-ups/suggestions (MystenLabs#630)

* Various clean-ups

* Move cast

* SImplify

* Clippy

* Use iterator

* fix: move supported providers outside fastcrypto (MystenLabs#631)

* fix: move supported providers outside fastcrypto

* be explicit to use a wrong vk for env=prod

* Update verification key (MystenLabs#632)

* Update vkey

* fix tests

---------

Co-authored-by: Joy Wang <108701016+joyqvq@users.noreply.github.com>

* fix: remove openssl dep (MystenLabs#633)

* fix: user JwkId instead of (kid, iss) (MystenLabs#634)

* move get_proof get_salt and style fixes (MystenLabs#635)

* Add Eq to JWK (MystenLabs#636)

* Add VDF (MystenLabs#623)

* Vdf based on classgroup crate and some of class group impl

* Add class group impl

* chiavdf's verify correctly

* Align with previous commit

* Clean up code

* Clean up

* Put class group impl in new file

* Add prover

* Refactor: use non-compressed forms in public interface

* Add constructor like method

* Update tests and simplify docs

* Clean up

* Clippy

* Clean up

* Add experimental flag

* Try to fix workflow

* Try again

* Revert "Try again"

This reverts commit 87436b6.

* Revert changes

* Refactor binaryqf impl

* Make private

* Fix comment

* Remove redundant mul impl

* Clean up

* Refactor parameterized group

* Verify group membership + add vdf from challenge/seed

* Make type for discriminant

* Align interface with Boneh (2018)

* Fix vdf abstraction

* Fix doc

* Add module doc

* Align names

* Fix const names

* Doc

* Refactor

* Clean up imports

* Fix doc

* fmt

* Define difficulty/iterations in the actual vdf construction

* doc

* doc

* doc

* Rename module

* doc

* Align name

* Clean up xgcd impl

* Align notation with paper

* Implement doubling function

* Add quadratic form composition algorithm

* lower case variables

* More tests

* Refactor

* Get rid of class_group dep

* Clippy

* Clean up

* Add test

* Add tests

* Use predicate for group parameter test instead

* Swap inputs

* Add benchmarks and clean up

* Move partial euclidean algorithm into compose method

* Align partial_xgcd impl with paper

* Clippy

* Add reference

* Make multiplication algorithm iterative

* Better naming

* Fix test!

* Use num-bigint

* Avoid abbreviation

* Try to fix Cargo.lock

* Add negative test

* Review comments + todos for optimisation

* DKG nodes - reduce weights given an allowed gap in the threshold (MystenLabs#625)

* Use a single ECIES encryption for all the shares sent to one party. (MystenLabs#637)

Use a single ECIES encryption for all the shares sent to one party.
This saves about 30% communication size (only one DDH element per party), and 50% message creation time for weights > 10 (less exps to compute).

* Upgrade `reqwest` and `rustls-webpki` to patch RUSTSEC-2023-0052 (MystenLabs#639)

* Upgrade rustls-webpki version and ignore webpki warning for now

* Ignore not needed

* Optimise class group impl (MystenLabs#638)

* Add doubling algorithm

* Use euclidean algorithm to compute quotients

* Optimise doubling also

* Optimise and use test from chia blockchain

* Optimise

* Optimise partial xgcd

* Optimise

* Skip first iteration in euclidean algorithm if inputs are out of order

* Uncomment negative test (MystenLabs#640)

* Add Ord to JwkId and JWK (MystenLabs#642)

* DKG - Fix TODOs (MystenLabs#643)

* ZK - Small fixes (MystenLabs#645)

* small changes in Poseidon

* utils

* questions

* some fixes

* clean up circom structs

* more fixes

---------

Co-authored-by: Joy Wang <108701016+joyqvq@users.noreply.github.com>

* tBLS - batch sign and verify (MystenLabs#644)

* Allow larger discriminants and strong fiat-shamir (MystenLabs#641)

* Allow larger discriminants and strong fiat-shamir

* Move check

* Add discriminant bit length function

* Remove pub modifier

* Clean up

* Fix test

* Add 2048 bit benchmark and clean up

* Simplify

* Expand xgcd output

* Align naming

* Add benchmarks and tests

* Clippy

* Add documentation to fiat-shamir hash

* Move VDF to subcrate (MystenLabs#646)

* Move VDF to subcrate

* License

* Clippy

* fmt

* VDF with rug/gmp (MystenLabs#647)

* Clippy

* fmt

* Add vdf with rug/gmp

* Update benchmarks and clean up

* Clean up

* Clean up

* Clippy

* Optimise

* Refactor

* License

* Encapsulate gmp feature usage

* Clean up gmp impl

* Try to fix windows build

* Clean up

* Fix workflow

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Update rust.yml

* Restore workflow

* Update rust.yml

* Add experimental flag

* Set experimental feature for benchmarks

* NI-DKG V0 (MystenLabs#624)

* fix: Update zkLogin logics (MystenLabs#648)

* fix: update all changes for circuits

* Update vkey and maxHeaderLen

* Modify the right vkey

* update prover api

* use vector instead of fixed size array due to bcs constraint

* address comments

---------

Co-authored-by: Deepak Maram <deepak@mystenlabs.com>

* fix: use finalized vk (MystenLabs#651)

* Add verify_zk_login_id function (MystenLabs#650)

* Add verify_zk_login_id function

* Add negative tests

* Return invalid proof instead of false

* zklogin: update prover endpoint for tests (MystenLabs#652)

* chore: update salt server endpoint (MystenLabs#656)

* chore: update salt server endpoint

* use hardcoded google test

* chore: add ToString for OIDCProvider (MystenLabs#654)

* DKG: More benchmarks, faster computation of lagrange coeffs, and msm (MystenLabs#655)

* chore: separate e2e workflow (MystenLabs#662)

* fix: add validations and improve as_arkworks (MystenLabs#663)

* Be able to use BLS keys as ECIES keys (MystenLabs#661)

* Add benchmarks for Poseidon and zklogin verification (MystenLabs#664)

* No parallelisation for zkp verification (MystenLabs#665)

* DKG: use multi-receiver enc with PoK, some refactoring (MystenLabs#660)

* DKG - deduplicate senders in `Party::merge` instead of failing (MystenLabs#666)

* Pull `fastcrypto-tbls` out of `experimental` feature (MystenLabs#667)

Adds `beacon-dkg` flag in `fastcrypto` for dependencies.

* Move modules back to experimental (MystenLabs#669)

* DKG: clean interfaces (MystenLabs#672)

* zklogin: add new provider (MystenLabs#670)

* fix: Apple uri and Slack e2e test (MystenLabs#674)

* fix: oidc url for apple

* fix: slack fetch jwk parsing

* chore: upgrade rust toolchain (MystenLabs#675)

* Groth16 fixes (MystenLabs#673)

* Add length validation

* Align serialize and deserialize functions

* Use From trait for PreparedVerifyingKey in BN254 impl

* Align bls12381 impl with bn254 impl

* Refactor

* Fix build (MystenLabs#679)

* Add debug log output for DKG errors (MystenLabs#678)

* DKG: Add debug logs (MystenLabs#680)

* Add cli tool for VDF (MystenLabs#676)

* Add vdf-cli

* Use seperate cli function to sample discriminant

* Renamve prove -> evaluate

* Revert "Renamve prove -> evaluate"

This reverts commit 452cf6f.

* Try again: Rename Prove -> Evaluate

* Put GMP dependency under feature flag

* Add poseidon/BN254 API (MystenLabs#649)

* zklogin: add a print to e2e (MystenLabs#684)

* Fix bugs in bls12381, and add more logs to DKG (MystenLabs#681)

* Sample class group discriminant faster (MystenLabs#677)

* Renamve prove -> evaluate

* Revert "Renamve prove -> evaluate"

This reverts commit 452cf6f.

* Try again: Rename Prove -> Evaluate

* Sample discriminant with gmp when possible

* fmt

* clippy

* Adding a worklfow to tag local commits for CI (MystenLabs#686)

* removing workflow from repo (MystenLabs#687)

* fix: simplify header parsing (MystenLabs#685)

* BLS 12-381 group ops review (MystenLabs#688)

* Uncompress is safer

* Avoid bias in random sampling

* Review

* More tests

* Docs

* Use neptune implementation of Poseidon (MystenLabs#671)

* Use neptune for poseidon hashing (works)

* Add assertion to test

* Add constants for n=1,..,16

* Move neptune test

* Add comment

* Parameterize test

* Use neptune for poseidon hashing

* Fix comments

* Keep poseidon instances as static

* Clean up

* Use neptune fork

* Works

* Clean up

* Clean up imports

* Get rid of static mutable objects

* More clean ups

* Even more clean ups

* Keep clippy happy

* Try to fix rebase

* Fix tests

* Use actual neptune repo instead of fork

* Clean up after rebase

* Clean up

* Add proptest

* fmt

* Docs

* Clean up proptest

* Move test

* Comment

* More docs

* Fix proptest

* Fix messy imports

* Use new released version of neptune

* Add some clarifying comments

* fmt

* DKG: More tests (nodes, nizk, ro, polynomials, ecies) (MystenLabs#689)

* Safer function (MystenLabs#691)

* Refactor VDF: Move Rug/GMP dependent part to other repo (MystenLabs#690)

* Get rid of rug depenedency

* Clean up

* Refactor discriminant from seed

* Refactor

* Refactor and some docs

* Use ToBytes trait

* Update cli

* Update tests

* fix: accepts alternative iss for Google (MystenLabs#693)

* fix: add alternative iss to Google

* add test

* Use BLS for doctests since Ed25519 aggregate signatures are experimental (MystenLabs#694)

* DKG: many more tests, fix some bugs (MystenLabs#692)

* zklogin: refactor to handle google's alternative iss (MystenLabs#700)

* Revert "fix: accepts alternative iss for Google (MystenLabs#693)" (MystenLabs#701)

This reverts commit 22003f9.

* fix: accepts alternative iss for Google (MystenLabs#693) (MystenLabs#703)

* fix: add alternative iss to Google

* add test

* Change the multi recipient enc to a CCA secure one (MystenLabs#702)

* chore: suppress rsa cve (MystenLabs#704)

* Revert "fix: accepts alternative iss for Google (MystenLabs#693) (MystenLabs#703)" (MystenLabs#705)

This reverts commit 031bef4.

* DKG review (MystenLabs#699)

* Allow more than 32 inputs for Poseidon over BN254 (MystenLabs#698)

* Hash binary inputs with Poseidon

* Reorder

* Ensure uniformity of output

* Clean up

* Remove binary-to-binary hashing from this pr

* Align naming#

* Use slices

Co-authored-by: Joy Wang <108701016+joyqvq@users.noreply.github.com>

* Revert "Use slices"

This reverts commit 503e9a6.

* Better naming and ensure compatability with zklogin

* Use merkle tree for binary api

---------

Co-authored-by: Joy Wang <108701016+joyqvq@users.noreply.github.com>

* Optimze VDF (MystenLabs#706)

* Update reduction

* mutable reduction

* Get rid of closure

* Update numbigint

* Use multi-scalar multiplication for VDF verification

* fmt

* clippy

* Clean up

* Clean up benchmark

* Test

* Optimise fs

* Update tests

* Remove unused function

* constant

* comment

* Clean up

* Trait bounds

* align names

* Review

* cleanup

* Refactor hashprime

* Refactor: get rid of scalar_size constant

* Remove complaint function

* Rename test

* fix bench

* DKG: support zero weights, and handle "impossible" edge cases more gracefully  (MystenLabs#708)

* ThresholdBls: accept Iterator directly where possible (MystenLabs#709)

Instead of requiring a slice that we immediately and only call
`iter()` on, accept the Iterator. This can enable clients to avoid
extra copies.

* add more error logs (MystenLabs#710)

* fastcrypto: impl bech32 encoding (MystenLabs#712)

* fastcrypto: impl bech32 encoding

* add examples

* Various clean ups (MystenLabs#715)

* Use prepare_pvk_bytes in API tests (MystenLabs#716)

* BLS12-381 group elements - make the code safer (MystenLabs#714)

- Safer lifetimes
- guarantee a unique bytes representation of GT elements

* Update h2 (MystenLabs#720)

Updates h2 to 0.3.24 in response to security advisory, using:

```
cargo update -p h2
```

* add a benchmark for blst msm (MystenLabs#719)

* add Debug derives for some DKG types (MystenLabs#718)

* Add a simple tlock CLI (MystenLabs#723)

* Update README.md (MystenLabs#724)

* Add citation.cff (MystenLabs#717)

* chore: fix typos (MystenLabs#722)

* Clean up dependencies (MystenLabs#725)

* Update VDF implementation (MystenLabs#721)

* Add qf hash function

* Clean up

* Licenses and clippy

* Use slices + license

* restrict visibility

* Add e2e test and remove unused compression functions

* Refactor + clippy

* Refactor

* license

* rename

* Fix docs

* Check duplicates bound

* fmt

* Fix CLI and address review comments

* Fix doc

* Use Baillie-PSW primality test + trial divisions (MystenLabs#726)

* Use Baillie-PSW primality test + trial divisions

* revert

* revert II

* new line

* revert III

* public fields (MystenLabs#728)

* Ensure size of hash function image (MystenLabs#727)

* Use Baillie-PSW primality test + trial divisions

* revert

* revert II

* new line

* revert III

* Check k

* clippy

* fix tests

* clippy

* update test

* Add default hash function

* Add default hash function

* fix k bound

* fix e2e test

* docs

* stub

* Faster multiplication during interpolation (MystenLabs#729)

* Degrade num-traits crate (MystenLabs#730)

* Add (near) optimal default parameters (MystenLabs#732)

* Introduce UnindexedValues (MystenLabs#735)

* Add total_weight_lower_bound to Nodes::reduce (MystenLabs#733)

* Add mock dkg (MystenLabs#736)

* Update Rust version + clippy + fix deny error (MystenLabs#739)

* BLS12-381: Remove default from, add tests (MystenLabs#738)

* Add the option to deser group elements without checking if they are in the group (MystenLabs#740)

* Reorganize features and clean up dependencies (MystenLabs#741)

* Reorganize features and clean up dependencies

* Remove blaks3 and reorganize deps

* Various clean ups (MystenLabs#742)

* Check subgroup early

* Check sizes on compile time

* Clean up error handling

* Use div_ceil from core::num

* Remove newline

* Error handling

* Remove debug test

* Revert fixed sized arrays

* Align itertools version with sui

* Add test

* More tests

* Docs

* Clippy

* Fix cargo test (MystenLabs#743)

* Fix cargo test

* Clean up

* Fix flags

* fix: derive serde for ZkLoginEnv (MystenLabs#747)

* DKG: Use u16 everywhere + other small fixes (MystenLabs#744)

* DKG: return pub visibility

* fix: add more derive trait for ZkLoginEnv (MystenLabs#749)

* DKG: more pub (MystenLabs#750)

* Use rand for StdRng import instead of re-export from aes (MystenLabs#753)

* fix: add strong typing to Bn254Point (MystenLabs#751)

* fix: Use strong type during deser

* renames and more test

* fix: use schemars for string (MystenLabs#754)

* clean up error description for verify function (MystenLabs#756)

* feat: add test issuers for jwt (MystenLabs#757)

* feat: add test issuers for jwt

* update code coverage

* use proptest

* try publishing fastcrypto and fastcrypto-zkp (MystenLabs#760)

* try publishing fastcrypto and fastcrypto-zkp

* update rust version

* update ci doc publish (MystenLabs#761)

* DKG: more cleanups (MystenLabs#762)

* 1. fix a possible panic in case a message with larger than MAX_U16 polynomial is sent
2. add more comments
3. change Nodes::reduce to new_reduced so it can only be applied once

* Upgrade to blst 3.11 (MystenLabs#764)

* [schnorr] support schnorr signature in secp256k1.

* [schnorr] add example test support.

* [schnorr] refactor functions.

* [schnorr] add sigs cli.

* [rooch-network/rooch/issues/482] add ripemd-160. (#2)

Co-authored-by: Feliciss <10203-feliciss@users.noreply.0xacab.org>

* [lib] add lib tests for schnorr sig. (#3)

* Add bytes rep for Secp256k1RecoverableSignature.

* [recov] add Authenticator Signer and VerifyingKey

---------

Co-authored-by: benr-ml <112846738+benr-ml@users.noreply.github.com>
Co-authored-by: Jonas Lindstrøm <jonas-lj@users.noreply.github.com>
Co-authored-by: Joy Wang <108701016+joyqvq@users.noreply.github.com>
Co-authored-by: Deepak Maram <deepak@mystenlabs.com>
Co-authored-by: Mark Logan <103447440+mystenmark@users.noreply.github.com>
Co-authored-by: Andrew Schran <aschran@mystenlabs.com>
Co-authored-by: Eugene Boguslavsky <eugene@mystenlabs.com>
Co-authored-by: GoodDaisy <90915921+GoodDaisy@users.noreply.github.com>
Co-authored-by: Feliciss <10203-feliciss@users.noreply.0xacab.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants