Verifier Service
Verifiers are external verification service providers engaged in the authentication process for social recovery. They offer verification options such as Email, SMS OTP, Google, or Apple verification in a decentralised manner. The introduction of verifers aims to enhance the overall security of social recovery in Portkey and allows users to customise the level of decentralisation for their accounts.
Overview
When users create an account or add a guardian, verifier services are needed to verify the account.
Verifier services are provided by external verification providers during the authentication process for social recovery. These verifiers offer verification options such as Email, SMS OTP, Google, or Apple verification in a decentralised manner. The introduction of verifers aims to enhance the overall security of social recovery in Portkey and allows users to customise the level of decentralisation for their accounts.
Verifier services encompass functions such as recording, sending, and verifying verification codes as well as validating signatures.
Frontend - Proxy Guardian Verifier Service Relationships in Interface Calling
- Users initiate guardian account requests through the frontend to the proxy Guardian Verifier service, such as emails.
- The proxy Guardian Verifier service handles this request:
- If the request is successfully sent, it returns to the frontend with a success confirmation and VerifierSessionId.
- If the request fails, it returns with an error code and error message.
Frontend - Backend Proxy Guardian Verifier Service Relationships in Interface Calling
- Users send the received verification code to the backend proxy Guardian Verifier service through the frontend.
- The backend proxy Guardian Verifier service forwards the verification code:
- If the verification succeeds, it returns the verification file and signature file to the frontend.
- If the verification fails, it returns an error code and error message to the frontend.
Signing up Using Google Account
Obtain automatically assigned verifier service data
Request
// fetch the verifier service to AELF
const verifierInfo: VerifierItem = did.didWallet.getRecommendationVerifier('AELF')
Example response
{
id: 'verifier01',
imageUrl: 'https://x/Gauss.png',
name: 'verifier01',
}
Supplemental Code
interface VerifierItem {
id: string;
name: string;
imageUrl: string;
endPoints: string[];
verifierAddresses: string[];
}
getRecommendationVerifier(chainId: ChainId): Promise<VerifierItem>;
Determine if reCAPTCHA test is needed
Use Google's reCAPTCHA and get verification code.
Assigned verifier and Google account conduct the verification
Request
Prerequisite: the verification code from reCAPTCHA needs to be put in the API request.
reCaptchaToken: 'reCaptchaTokenCode'
Initiate a request
const verifyGoogleToken = await did.services.verifyGoogleToken({
verifierId: 'verifierId',
chainId: 'chainIn',
accessToken, // Token returned when the Google account
operationType: 1, // The type id OperationTypeEnum
});
Example response
{
verificationDoc: 'verificationDoc',
signature: 'signature',
}
Supplemental Code
enum OperationTypeEnum {
unknown = 0,
register = 1,
communityRecovery = 2,
addGuardian = 3,
deleteGuardian = 4,
editGuardian = 5,
removeOtherManager = 6,
setLoginAccount = 7,
managerApprove = 8,
modifyTransferLimit = 9,
transferApprove = 10,
unsetLoginAccount = 11,
}
type VerifyGoogleTokenParams = {
accessToken: string;
verifierId: string;
chainId: ChainId;
operationType: OperationTypeEnum;
};
type VerifyVerificationCodeResult = {
verificationDoc: string;
signature: string;
};
verifyGoogleToken(params: VerifyGoogleTokenParams): Promise<VerifyVerificationCodeResult>;
Sign up
Request
const { verificationDoc, signature } = verifyRes;
const requestId = randomId();
const clientId = 'managerAddress'; // manager address
const params: Omit<RegisterParams, 'manager'> = {
// Modify the value corresponding to the following fields
type: 'Email',
loginGuardianIdentifier: 'loginGuardianIdentifier',
extraData: 'extraData',
chainId: 'chainId',
verifierId: 'verifierId',
verificationDoc,
signature,
context: {
requestId: 'requestId',
clientId: 'clientId',
},
}
did.register(params);
Supplemental Code
enum AccountTypeEnum {
Email,
Google,
Apple,
Telegram,
}
type AccountType = keyof typeof AccountTypeEnum;
interface RegisterParams {
type: AccountType;
loginGuardianIdentifier: string;
manager: string;
extraData: string;
chainId: ChainId;
verifierId: string;
verificationDoc: string;
signature: string;
context: Context;
}
type ChainId = 'AELF' | 'tDVV' | 'tDVW';
interface Context {
clientId: string;
requestId: string;
}
register(params: Omit<RegisterParams, 'manager'>): Promise<RegisterResult>