-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathservice.interface.ts
54 lines (38 loc) · 1.32 KB
/
service.interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import type { ActorMethod } from "@dfinity/agent";
import type { Principal } from "@dfinity/principal";
export type Address = string;
export type CanisterPublicKey = PublicKey;
export interface Delegation {
pubkey: PublicKey;
targets: [] | [Array<Principal>];
expiration: Timestamp;
}
export type GetDelegationResponse = { Ok: SignedDelegation } | { Err: string };
export interface LoginOkResponse {
user_canister_pubkey: CanisterPublicKey;
expiration: Timestamp;
}
export type LoginResponse = { Ok: LoginOkResponse } | { Err: string };
export interface PrepareLoginOkResponse {
nonce : string,
siwe_message : SiweMessage,
}
export type PrepareLoginResponse = { Ok: PrepareLoginOkResponse } | { Err: string };
export type PublicKey = Uint8Array | number[];
export type SessionKey = PublicKey;
export interface SignedDelegation {
signature: Uint8Array | number[];
delegation: Delegation;
}
export type SiweMessage = string;
export type SiweSignature = string;
export type Timestamp = bigint;
export type Nonce = string;
export interface SIWE_IDENTITY_SERVICE {
siwe_prepare_login: ActorMethod<[Address], PrepareLoginResponse>;
siwe_login: ActorMethod<[SiweSignature, Address, SessionKey, Nonce], LoginResponse>;
siwe_get_delegation: ActorMethod<
[Address, SessionKey, Timestamp],
GetDelegationResponse
>;
}