Skip to main content

smartAccountAuth

Function

Smart Account, app-side EverID login method, passes app-side logo to jump to https://beta.everpay.io/auth page, returns user information when user registers/logs into everPay.

danger

This method only works in the browser environment

Parameter

everpay.smartAccountAuth(logo: string): Promise<SmartAccountAuthResult>
parametersrequireddescription
logoYESapp-side logo
emailNOThe application can choose to pass the user's mailbox, which is an empty string by default
emailEditableNOThe application can choose whether the passed user's mailbox is editable or not, the default is editable, the mailbox is not editable if and only if false is passed in this parameter

Return

export interface SmartAccountAuthResult {
account: string
publicId: string
public: string
type: 'sign' | 'register'
message: string
sig: string
}

Example

const authResult = await new Everpay().smartAccountAuth('https://app-dev.permaswap.network/permalogo.svg')
console.log('authResult', authResult)

/* example return
{
// Account Email
account: "[email protected]",
// signature message
message: "0x69c96d89610d732a126a5652118e49d853705d2fc17642cdcea705e2a44e2f4b",
// Public key corresponding to the webauthn ID used by this mailbox to log in to everPay
public: "eyJpZCI6IjMxMXFZREhCZTE4U0hLVStIUjFYUHJoUGZ2bjE5Q3I1RVYwU1FZbi9scVk9IiwicHVibGljS2V5IjoicFFFQ0F5WWdBU0ZZSUZldWlsY0ZVdGowZGl5SUFRcnZGdFJRVjRRbndSem1SUldmRGNtY1ZYd0JJbGdnOW5hdjVUeVdiL2Y1RWgxWkQ4c2k3aFRROXlVY2wybVRuQi9iOUF3Z1I4MD0iLCJhdHRlc3RhdGlvblR5cGUiOiJwYWNrZWQiLCJ0cmFuc3BvcnQiOlsiaW50ZXJuYWwiXSwiZmxhZ3MiOnsidXNlclByZXNlbnQiOnRydWUsInVzZXJWZXJpZmllZCI6dHJ1ZSwiYmFja3VwRWxpZ2libGUiOmZhbHNlLCJiYWNrdXBTdGF0ZSI6ZmFsc2V9LCJhdXRoZW50aWNhdG9yIjp7IkFBR1VJRCI6InJjNEFBalc4eGdwa2l3c2w4ZkJWQXc9PSIsInNpZ25Db3VudCI6MCwiY2xvbmVXYXJuaW5nIjpmYWxzZSwiYXR0YWNobWVudCI6InBsYXRmb3JtIn19",
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