Skip to main content

ZkLogin

Struct ZkLogin 

Source
pub struct ZkLogin {
Show 21 fields pub sub: ByteVec, pub aud: ByteVec, pub iss: ByteVec, pub salt: ByteVec, pub zkaddr: [Wire; 4], pub zkaddr_sha256: ByteVec, pub jwt_claims_header: JwtClaims, pub jwt_claims_payload: JwtClaims, pub jwt_signature_verify: Rs256Verify, pub base64_jwt_header: ByteVec, pub base64_jwt_payload: ByteVec, pub base64_jwt_signature: ByteVec, pub jwt_header: ByteVec, pub jwt_payload: ByteVec, pub jwt_signature: ByteVec, pub base64_jwt_payload_nonce: [Wire; 6], pub nonce_sha256: ByteVec, pub nonce: [Wire; 4], pub vk_u: [Wire; 4], pub t_max: ByteVec, pub nonce_r: ByteVec,
}
Expand description

A circuit that implements zk login.

Fields§

§sub: ByteVec

The sub claim value

§aud: ByteVec

The aud claim value

§iss: ByteVec

The iss claim value

§salt: ByteVec

The salt value

§zkaddr: [Wire; 4]

The zkaddr (SHA256 hash of concat(sub, aud, iss, salt))

§zkaddr_sha256: ByteVec

The message ByteVec whose SHA-256 is asserted to equal zkaddr

§jwt_claims_header: JwtClaims

The subcircuit that verifies the JWT header.

§jwt_claims_payload: JwtClaims

The subcircuit that verifies the JWT in the payload.

§jwt_signature_verify: Rs256Verify

The subcircuit that verifies the RS256 signature in the JWT.

§base64_jwt_header: ByteVec

The JWT header

§base64_jwt_payload: ByteVec

The JWT payload

§base64_jwt_signature: ByteVec

The JWT signature

§jwt_header: ByteVec

The decoded JWT header

§jwt_payload: ByteVec

The decoded jwt_payload

§jwt_signature: ByteVec

The decoded jwt_signature (264 bytes for Base64, little-endian packing)

§base64_jwt_payload_nonce: [Wire; 6]

The base64 encoded nonce

§nonce_sha256: ByteVec

The message ByteVec whose SHA-256 is asserted to equal nonce

§nonce: [Wire; 4]

The nonce value (32 bytes SHA256 hash)

§vk_u: [Wire; 4]

The vk_u public key (32 bytes)

§t_max: ByteVec

The t_max value

§nonce_r: ByteVec

The nonce_r value

Implementations§

Source§

impl ZkLogin

Source

pub fn new(b: &mut CircuitBuilder, config: &Config) -> Self

Source

pub fn populate_sub(&self, w: &mut WitnessFiller<'_>, sub_bytes: &[u8])

Source

pub fn populate_aud(&self, w: &mut WitnessFiller<'_>, aud_bytes: &[u8])

Source

pub fn populate_iss(&self, w: &mut WitnessFiller<'_>, iss_bytes: &[u8])

Source

pub fn populate_salt(&self, w: &mut WitnessFiller<'_>, salt_bytes: &[u8])

Source

pub fn populate_zkaddr(&self, w: &mut WitnessFiller<'_>, zkaddr_hash: &[u8; 32])

Source

pub fn populate_zkaddr_preimage( &self, w: &mut WitnessFiller<'_>, zkaddr_preimage: &[u8], )

Source

pub fn populate_jwt_header( &self, w: &mut WitnessFiller<'_>, header_bytes: &[u8], )

Source

pub fn populate_jwt_payload( &self, w: &mut WitnessFiller<'_>, payload_bytes: &[u8], )

Source

pub fn populate_jwt_signature( &self, w: &mut WitnessFiller<'_>, signature_bytes: &[u8], )

Source

pub fn populate_base64_jwt_header( &self, w: &mut WitnessFiller<'_>, bytes: &[u8], )

Source

pub fn populate_base64_jwt_payload( &self, w: &mut WitnessFiller<'_>, bytes: &[u8], )

Source

pub fn populate_base64_jwt_signature( &self, w: &mut WitnessFiller<'_>, bytes: &[u8], )

Source

pub fn populate_rsa_modulus( &self, w: &mut WitnessFiller<'_>, modulus_bytes: &[u8], )

Source

pub fn populate_jwt_header_attributes(&self, w: &mut WitnessFiller<'_>)

Source

pub fn populate_nonce(&self, w: &mut WitnessFiller<'_>, nonce_hash: &[u8; 32])

Source

pub fn populate_nonce_preimage( &self, w: &mut WitnessFiller<'_>, nonce_preimage: &[u8], )

Source

pub fn populate_vk_u(&self, w: &mut WitnessFiller<'_>, vk_u_bytes: &[u8; 32])

Source

pub fn populate_t_max(&self, w: &mut WitnessFiller<'_>, t_max_bytes: &[u8])

Source

pub fn populate_nonce_r(&self, w: &mut WitnessFiller<'_>, nonce_r_bytes: &[u8])

Source

pub fn populate_base64_jwt_payload_nonce( &self, w: &mut WitnessFiller<'_>, base64_nonce: &[u8], )

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more