Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 72 additions & 8 deletions packages/guard/src/guard.gen.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/* eslint-disable */
// sequence-guard v0.4.0 776b307c2145ac7a994eec63240acae042c96067
// sequence-guard v0.5.0 29ecf507c86c5d53ab537783a32c1e8edf15d37f
// --
// Code generated by [email protected] with typescript generator. DO NOT EDIT.
//
// webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts

export const WebrpcHeader = 'Webrpc'

export const WebrpcHeaderValue = '[email protected];[email protected];sequence-guard@v0.4.0'
export const WebrpcHeaderValue = '[email protected];[email protected];sequence-guard@v0.5.0'

// WebRPC description and code-gen version
export const WebRPCVersion = 'v1'

// Schema version of your RIDL schema
export const WebRPCSchemaVersion = 'v0.4.0'
export const WebRPCSchemaVersion = 'v0.5.0'

// Schema hash generated from your RIDL schema
export const WebRPCSchemaHash = '776b307c2145ac7a994eec63240acae042c96067'
export const WebRPCSchemaHash = '29ecf507c86c5d53ab537783a32c1e8edf15d37f'

type WebrpcGenVersions = {
webrpcGenVersion: string
Expand Down Expand Up @@ -70,6 +70,20 @@ function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
// Types
//

export enum PayloadType {
Calls = 'Calls',
Message = 'Message',
ConfigUpdate = 'ConfigUpdate',
SessionImplicitAuthorize = 'SessionImplicitAuthorize'
}

export enum SignatureType {
Hash = 'Hash',
Sapient = 'Sapient',
EthSign = 'EthSign',
Erc1271 = 'Erc1271'
}

export interface Version {
webrpcVersion: string
schemaVersion: string
Expand Down Expand Up @@ -99,14 +113,19 @@ export interface WalletSigner {
export interface SignRequest {
chainId: number
msg: string
auxData: string
auxData?: string
wallet?: string
payloadType?: PayloadType
payloadData?: string
signatures?: Array<Signature>
}

export interface OwnershipProof {
wallet: string
timestamp: number
signer: string
signature: string
chainId: number
}

export interface AuthToken {
Expand All @@ -119,6 +138,13 @@ export interface RecoveryCode {
used: boolean
}

export interface Signature {
address: string
type: SignatureType
imageHash?: string
data: string
}

export interface Guard {
ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>
version(headers?: object, signal?: AbortSignal): Promise<VersionReturn>
Expand Down Expand Up @@ -242,18 +268,21 @@ export interface SetPINArgs {
pin: string
timestamp: number
signature: string
chainId: number
}

export interface SetPINReturn {}
export interface ResetPINArgs {
timestamp: number
signature: string
chainId: number
}

export interface ResetPINReturn {}
export interface CreateTOTPArgs {
timestamp: number
signature: string
chainId: number
}

export interface CreateTOTPReturn {
Expand All @@ -269,6 +298,7 @@ export interface CommitTOTPReturn {
export interface ResetTOTPArgs {
timestamp: number
signature: string
chainId: number
}

export interface ResetTOTPReturn {}
Expand All @@ -281,6 +311,7 @@ export interface Reset2FAReturn {}
export interface RecoveryCodesArgs {
timestamp: number
signature: string
chainId: number
}

export interface RecoveryCodesReturn {
Expand All @@ -289,6 +320,7 @@ export interface RecoveryCodesReturn {
export interface ResetRecoveryCodesArgs {
timestamp: number
signature: string
chainId: number
}

export interface ResetRecoveryCodesReturn {
Expand Down Expand Up @@ -931,6 +963,32 @@ export class NotFoundError extends WebrpcError {
}
}

export class RequiresTOTPError extends WebrpcError {
constructor(
name: string = 'RequiresTOTP',
code: number = 6600,
message: string = `TOTP is required`,
status: number = 0,
cause?: string
) {
super(name, code, message, status, cause)
Object.setPrototypeOf(this, RequiresTOTPError.prototype)
}
}

export class RequiresPINError extends WebrpcError {
constructor(
name: string = 'RequiresPIN',
code: number = 6601,
message: string = `PIN is required`,
status: number = 0,
cause?: string
) {
super(name, code, message, status, cause)
Object.setPrototypeOf(this, RequiresPINError.prototype)
}
}

export enum errors {
WebrpcEndpoint = 'WebrpcEndpoint',
WebrpcRequestFailed = 'WebrpcRequestFailed',
Expand All @@ -955,7 +1013,9 @@ export enum errors {
Unavailable = 'Unavailable',
QueryFailed = 'QueryFailed',
ValidationFailed = 'ValidationFailed',
NotFound = 'NotFound'
NotFound = 'NotFound',
RequiresTOTP = 'RequiresTOTP',
RequiresPIN = 'RequiresPIN'
}

export enum WebrpcErrorCodes {
Expand All @@ -982,7 +1042,9 @@ export enum WebrpcErrorCodes {
Unavailable = 2002,
QueryFailed = 2003,
ValidationFailed = 2004,
NotFound = 3000
NotFound = 3000,
RequiresTOTP = 6600,
RequiresPIN = 6601
}

export const webrpcErrorByCode: { [code: number]: any } = {
Expand All @@ -1009,7 +1071,9 @@ export const webrpcErrorByCode: { [code: number]: any } = {
[2002]: UnavailableError,
[2003]: QueryFailedError,
[2004]: ValidationFailedError,
[3000]: NotFoundError
[3000]: NotFoundError,
[6600]: RequiresTOTPError,
[6601]: RequiresPINError
}

export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
Loading