Solana
Only supports SDK version 0.2.0 and above.
How to generate the proof with Solana?
Copy
const generate = async (schemaId: string, appid: string) => {
try {
//check if you install the Phatom wallet
if (!("phantom" in window)) {
return alert("Please install Phantom wallet")
}
const provider = window.phantom?.solana
const resp = await provider?.connect() //connect wallet
const account = resp.publicKey.toString()
//The appid of the project created in dev center
const appid = "39a00e9e-7e6d-461e-9b9d-d520b355d1c0"
//The schemaId of the project
const schemaId = "c7eab8b7d7e44b05b41b613fe548edf5"
const connector = new TransgateConnect(appid)
const isAvailable = await connector.isTransgateAvailable()
if (!isAvailable) {
return alert("Please install zkPass TransGate")
}
const res = (await connector.launchWithSolana(schemaId, account)) as Result
} catch (err) {
alert(JSON.stringify(err))
console.log("error", err)
}
}The result includes two signatures: the allocator signature and the validator signature. Developers should verify both signatures based on the other returned fields.
Verify Allocator Signature
Encode the allocator message struct
Copy
Recover the allocator address
Copy
Check if the signed allocator address is registered. The current allocator address is fixed.
Copy
Verify Validator Signature
Generate the validator message
Copy
Recover the validator address
Copy
Verify if the signed validator address matches the address assigned by the allocator
Copy
Last updated