Skip to content

Commit

Permalink
fix: fix crate publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Jan 9, 2025
1 parent bea14d4 commit c76ffc5
Show file tree
Hide file tree
Showing 18 changed files with 445 additions and 126 deletions.
49 changes: 26 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ strip = true
opt-level = 's'

[workspace.package]
version = "0.2.1"
version = "0.2.2"
edition = "2021"
repository = "https://github.com/ldclabs/ic-tee"
keywords = ["tee", "canister", "icp", "nitro"]
Expand Down
31 changes: 31 additions & 0 deletions src/declarations/ic_tee_identity/ic_tee_identity.did
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;
}
47 changes: 47 additions & 0 deletions src/declarations/ic_tee_identity/ic_tee_identity.did.d.ts
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[];
55 changes: 55 additions & 0 deletions src/declarations/ic_tee_identity/ic_tee_identity.did.js
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)];
};
50 changes: 50 additions & 0 deletions src/declarations/ic_tee_identity/index.d.ts
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>;
Loading

0 comments on commit c76ffc5

Please sign in to comment.