-
Notifications
You must be signed in to change notification settings - Fork 3
/
ic_siwe_provider.did
83 lines (71 loc) · 1.83 KB
/
ic_siwe_provider.did
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
type Address = text;
type CanisterPublicKey = PublicKey;
type Principal = blob;
type PublicKey = blob;
type SessionKey = PublicKey;
type SiweMessage = text;
type SiweSignature = text;
type Timestamp = nat64;
type Nonce = text;
type RuntimeFeature = variant {
IncludeUriInSeed;
DisableEthToPrincipalMapping;
DisablePrincipalToEthMapping
};
type SettingsInput = record {
domain : text;
uri : text;
salt : text;
chain_id : opt nat;
scheme : opt text;
statement : opt text;
sign_in_expires_in : opt nat64;
session_expires_in : opt nat64;
targets : opt vec text;
runtime_features: opt vec RuntimeFeature;
};
type GetAddressResponse = variant {
Ok : Address;
Err : text;
};
type GetDelegationResponse = variant {
Ok : SignedDelegation;
Err : text;
};
type SignedDelegation = record {
delegation : Delegation;
signature : blob;
};
type Delegation = record {
pubkey : PublicKey;
expiration : Timestamp;
targets : opt vec principal;
};
type GetPrincipalResponse = variant {
Ok : Principal;
Err : text;
};
type LoginResponse = variant {
Ok : LoginDetails;
Err : text;
};
type LoginDetails = record {
expiration : Timestamp;
user_canister_pubkey : CanisterPublicKey;
};
type PrepareLoginOkResponse = record {
siwe_message: SiweMessage;
nonce : text;
};
type PrepareLoginResponse = variant {
Ok : PrepareLoginOkResponse;
Err : text;
};
service : (settings_input : SettingsInput) -> {
"get_address" : (Principal) -> (GetAddressResponse) query;
"get_caller_address" : () -> (GetAddressResponse) query;
"get_principal" : (Address) -> (GetPrincipalResponse) query;
"siwe_prepare_login" : (Address) -> (PrepareLoginResponse);
"siwe_login" : (SiweSignature, Address, SessionKey, Nonce) -> (LoginResponse);
"siwe_get_delegation" : (Address, SessionKey, Timestamp) -> (GetDelegationResponse) query;
};