跳到主要内容

Data Structures

Request Params

interface RequestParams {
chainId: string;
domain: string;
nonce: string;
aud: string;
type?: string;
nbf?: string;
exp?: string;
statement?: string;
requestId?: string;
resources?: string[];
}

Respond Params

type RespondParams = ResultResponse | ErrorResponse;

Payload Params (partial Cacao)

Used for requester to authenticate wallet

interface PayloadParams {
type: string; // same as Cacao Header type (t)
chainId: string;
domain: string;
aud: string;
version: string;
nonce: string;
iat: string;
nbf?: string;
exp?: string;
statement?: string;
requestId?: string;
resources?: string[];
}

Response

type Response = Cacao | ErrorResponse;

Pending Request

interface PendingRequest {
id: number;
payloadParams: PayloadParams;
message: string;
}

Cacao Header (CAIP-70)

interface CacaoHeader {
t: string;
}

Cacao Payload (CAIP-70)

interface CacaoPayload {
iss: string;
domain: string;
aud: string;
version: string;
nonce: string;
iat: string;
nbf?: string;
exp?: string;
statement?: string;
requestId?: string;
resources?: string[];
}

Cacao Signature (CAIP-70)

interface CacaoSignature {
t: string;
s: string;
m?: string;
}

Cacao (CAIP-70)

interface Cacao {
h: CacaoHeader;
p: CacaoPayload;
s: CacaoSignature;
}

Result Response

interface ResultResponse {
id: number;
signature: CacaoSignature;
}

Error Response

interface ErrorResponse {
id: number;
error: {
code: number;
message: string;
};
}