-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
445 additions
and
126 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
type ChainArgs = variant { Upgrade : UpgradeArgs; Init : InitArgs }; | ||
type Delegation = record { | ||
pubkey : blob; | ||
targets : opt vec principal; | ||
expiration : nat64; | ||
}; | ||
type InitArgs = record { session_expires_in_ms : nat64; name : text }; | ||
type Result = variant { Ok : SignedDelegation; Err : text }; | ||
type Result_1 = variant { Ok : State; Err : text }; | ||
type Result_2 = variant { Ok : SignInResponse; Err : text }; | ||
type SignInResponse = record { | ||
user_key : blob; | ||
seed : blob; | ||
expiration : nat64; | ||
}; | ||
type SignedDelegation = record { signature : blob; delegation : Delegation }; | ||
type State = record { | ||
session_expires_in_ms : nat64; | ||
name : text; | ||
sign_in_count : nat64; | ||
}; | ||
type UpgradeArgs = record { | ||
session_expires_in_ms : opt nat64; | ||
name : opt text; | ||
}; | ||
service : (opt ChainArgs) -> { | ||
get_delegation : (blob, blob, nat64) -> (Result) query; | ||
get_state : () -> (Result_1) query; | ||
sign_in : (text, blob) -> (Result_2); | ||
whoami : () -> (principal) query; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { Principal } from '@dfinity/principal'; | ||
import type { ActorMethod } from '@dfinity/agent'; | ||
import type { IDL } from '@dfinity/candid'; | ||
|
||
export type ChainArgs = { 'Upgrade' : UpgradeArgs } | | ||
{ 'Init' : InitArgs }; | ||
export interface Delegation { | ||
'pubkey' : Uint8Array | number[], | ||
'targets' : [] | [Array<Principal>], | ||
'expiration' : bigint, | ||
} | ||
export interface InitArgs { 'session_expires_in_ms' : bigint, 'name' : string } | ||
export type Result = { 'Ok' : SignedDelegation } | | ||
{ 'Err' : string }; | ||
export type Result_1 = { 'Ok' : State } | | ||
{ 'Err' : string }; | ||
export type Result_2 = { 'Ok' : SignInResponse } | | ||
{ 'Err' : string }; | ||
export interface SignInResponse { | ||
'user_key' : Uint8Array | number[], | ||
'seed' : Uint8Array | number[], | ||
'expiration' : bigint, | ||
} | ||
export interface SignedDelegation { | ||
'signature' : Uint8Array | number[], | ||
'delegation' : Delegation, | ||
} | ||
export interface State { | ||
'session_expires_in_ms' : bigint, | ||
'name' : string, | ||
'sign_in_count' : bigint, | ||
} | ||
export interface UpgradeArgs { | ||
'session_expires_in_ms' : [] | [bigint], | ||
'name' : [] | [string], | ||
} | ||
export interface _SERVICE { | ||
'get_delegation' : ActorMethod< | ||
[Uint8Array | number[], Uint8Array | number[], bigint], | ||
Result | ||
>, | ||
'get_state' : ActorMethod<[], Result_1>, | ||
'sign_in' : ActorMethod<[string, Uint8Array | number[]], Result_2>, | ||
'whoami' : ActorMethod<[], Principal>, | ||
} | ||
export declare const idlFactory: IDL.InterfaceFactory; | ||
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
export const idlFactory = ({ IDL }) => { | ||
const UpgradeArgs = IDL.Record({ | ||
'session_expires_in_ms' : IDL.Opt(IDL.Nat64), | ||
'name' : IDL.Opt(IDL.Text), | ||
}); | ||
const InitArgs = IDL.Record({ | ||
'session_expires_in_ms' : IDL.Nat64, | ||
'name' : IDL.Text, | ||
}); | ||
const ChainArgs = IDL.Variant({ 'Upgrade' : UpgradeArgs, 'Init' : InitArgs }); | ||
const Delegation = IDL.Record({ | ||
'pubkey' : IDL.Vec(IDL.Nat8), | ||
'targets' : IDL.Opt(IDL.Vec(IDL.Principal)), | ||
'expiration' : IDL.Nat64, | ||
}); | ||
const SignedDelegation = IDL.Record({ | ||
'signature' : IDL.Vec(IDL.Nat8), | ||
'delegation' : Delegation, | ||
}); | ||
const Result = IDL.Variant({ 'Ok' : SignedDelegation, 'Err' : IDL.Text }); | ||
const State = IDL.Record({ | ||
'session_expires_in_ms' : IDL.Nat64, | ||
'name' : IDL.Text, | ||
'sign_in_count' : IDL.Nat64, | ||
}); | ||
const Result_1 = IDL.Variant({ 'Ok' : State, 'Err' : IDL.Text }); | ||
const SignInResponse = IDL.Record({ | ||
'user_key' : IDL.Vec(IDL.Nat8), | ||
'seed' : IDL.Vec(IDL.Nat8), | ||
'expiration' : IDL.Nat64, | ||
}); | ||
const Result_2 = IDL.Variant({ 'Ok' : SignInResponse, 'Err' : IDL.Text }); | ||
return IDL.Service({ | ||
'get_delegation' : IDL.Func( | ||
[IDL.Vec(IDL.Nat8), IDL.Vec(IDL.Nat8), IDL.Nat64], | ||
[Result], | ||
['query'], | ||
), | ||
'get_state' : IDL.Func([], [Result_1], ['query']), | ||
'sign_in' : IDL.Func([IDL.Text, IDL.Vec(IDL.Nat8)], [Result_2], []), | ||
'whoami' : IDL.Func([], [IDL.Principal], ['query']), | ||
}); | ||
}; | ||
export const init = ({ IDL }) => { | ||
const UpgradeArgs = IDL.Record({ | ||
'session_expires_in_ms' : IDL.Opt(IDL.Nat64), | ||
'name' : IDL.Opt(IDL.Text), | ||
}); | ||
const InitArgs = IDL.Record({ | ||
'session_expires_in_ms' : IDL.Nat64, | ||
'name' : IDL.Text, | ||
}); | ||
const ChainArgs = IDL.Variant({ 'Upgrade' : UpgradeArgs, 'Init' : InitArgs }); | ||
return [IDL.Opt(ChainArgs)]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { | ||
ActorSubclass, | ||
HttpAgentOptions, | ||
ActorConfig, | ||
Agent, | ||
} from "@dfinity/agent"; | ||
import type { Principal } from "@dfinity/principal"; | ||
import type { IDL } from "@dfinity/candid"; | ||
|
||
import { _SERVICE } from './ic_tee_identity.did'; | ||
|
||
export declare const idlFactory: IDL.InterfaceFactory; | ||
export declare const canisterId: string; | ||
|
||
export declare interface CreateActorOptions { | ||
/** | ||
* @see {@link Agent} | ||
*/ | ||
agent?: Agent; | ||
/** | ||
* @see {@link HttpAgentOptions} | ||
*/ | ||
agentOptions?: HttpAgentOptions; | ||
/** | ||
* @see {@link ActorConfig} | ||
*/ | ||
actorOptions?: ActorConfig; | ||
} | ||
|
||
/** | ||
* Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister. | ||
* @constructs {@link ActorSubClass} | ||
* @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to | ||
* @param {CreateActorOptions} options - see {@link CreateActorOptions} | ||
* @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions | ||
* @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent | ||
* @see {@link HttpAgentOptions} | ||
* @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor | ||
* @see {@link ActorConfig} | ||
*/ | ||
export declare const createActor: ( | ||
canisterId: string | Principal, | ||
options?: CreateActorOptions | ||
) => ActorSubclass<_SERVICE>; | ||
|
||
/** | ||
* Intialized Actor using default settings, ready to talk to a canister using its candid interface | ||
* @constructs {@link ActorSubClass} | ||
*/ | ||
export declare const ic_tee_identity: ActorSubclass<_SERVICE>; |
Oops, something went wrong.