diff --git a/.dfx/local/canisters/assets/assets.wasm.gz b/.dfx/local/canisters/assets/assets.wasm.gz index db405979..2796c34f 100644 Binary files a/.dfx/local/canisters/assets/assets.wasm.gz and b/.dfx/local/canisters/assets/assets.wasm.gz differ diff --git a/.dfx/local/canisters/assets/assetstorage.did b/.dfx/local/canisters/assets/assetstorage.did index c4f659eb..51bb1a23 100644 --- a/.dfx/local/canisters/assets/assetstorage.did +++ b/.dfx/local/canisters/assets/assetstorage.did @@ -139,7 +139,25 @@ type ListPermitted = record { permission: Permission }; type ValidationResult = variant { Ok : text; Err : text }; -service: { +type AssetCanisterArgs = variant { + Init: InitArgs; + Upgrade: UpgradeArgs; +}; + +type InitArgs = record {}; + +type UpgradeArgs = record { + set_permissions: opt SetPermissions; +}; + +/// Sets the list of principals granted each permission. +type SetPermissions = record { + prepare: vec principal; + commit: vec principal; + manage_permissions: vec principal; +}; + +service: (asset_canister_args: opt AssetCanisterArgs) -> { api_version: () -> (nat16) query; get: (record { @@ -220,10 +238,10 @@ service: { authorize: (principal) -> (); deauthorize: (principal) -> (); - list_authorized: () -> (vec principal) query; + list_authorized: () -> (vec principal); grant_permission: (GrantPermission) -> (); revoke_permission: (RevokePermission) -> (); - list_permitted: (ListPermitted) -> (vec principal) query; + list_permitted: (ListPermitted) -> (vec principal); take_ownership: () -> (); get_asset_properties : (key: Key) -> (record { diff --git a/.dfx/local/canisters/assets/assetstorage.wasm.gz b/.dfx/local/canisters/assets/assetstorage.wasm.gz index db405979..2796c34f 100644 Binary files a/.dfx/local/canisters/assets/assetstorage.wasm.gz and b/.dfx/local/canisters/assets/assetstorage.wasm.gz differ diff --git a/.dfx/local/canisters/assets/constructor.did b/.dfx/local/canisters/assets/constructor.did index c4f659eb..51bb1a23 100644 --- a/.dfx/local/canisters/assets/constructor.did +++ b/.dfx/local/canisters/assets/constructor.did @@ -139,7 +139,25 @@ type ListPermitted = record { permission: Permission }; type ValidationResult = variant { Ok : text; Err : text }; -service: { +type AssetCanisterArgs = variant { + Init: InitArgs; + Upgrade: UpgradeArgs; +}; + +type InitArgs = record {}; + +type UpgradeArgs = record { + set_permissions: opt SetPermissions; +}; + +/// Sets the list of principals granted each permission. +type SetPermissions = record { + prepare: vec principal; + commit: vec principal; + manage_permissions: vec principal; +}; + +service: (asset_canister_args: opt AssetCanisterArgs) -> { api_version: () -> (nat16) query; get: (record { @@ -220,10 +238,10 @@ service: { authorize: (principal) -> (); deauthorize: (principal) -> (); - list_authorized: () -> (vec principal) query; + list_authorized: () -> (vec principal); grant_permission: (GrantPermission) -> (); revoke_permission: (RevokePermission) -> (); - list_permitted: (ListPermitted) -> (vec principal) query; + list_permitted: (ListPermitted) -> (vec principal); take_ownership: () -> (); get_asset_properties : (key: Key) -> (record { diff --git a/.dfx/local/canisters/assets/init_args.txt b/.dfx/local/canisters/assets/init_args.txt index dd626a0f..660e31f7 100644 --- a/.dfx/local/canisters/assets/init_args.txt +++ b/.dfx/local/canisters/assets/init_args.txt @@ -1 +1 @@ -() \ No newline at end of file +(opt AssetCanisterArgs) \ No newline at end of file diff --git a/.dfx/local/canisters/assets/service.did b/.dfx/local/canisters/assets/service.did index c4f659eb..4d9ea8be 100644 --- a/.dfx/local/canisters/assets/service.did +++ b/.dfx/local/canisters/assets/service.did @@ -1,244 +1,197 @@ +type AssetCanisterArgs = variant { Upgrade : UpgradeArgs; Init : InitArgs }; type BatchId = nat; +type BatchOperationKind = variant { + SetAssetProperties : SetAssetPropertiesArguments; + CreateAsset : CreateAssetArguments; + UnsetAssetContent : UnsetAssetContentArguments; + DeleteAsset : DeleteAssetArguments; + SetAssetContent : SetAssetContentArguments; + Clear : ClearArguments; +}; type ChunkId = nat; -type Key = text; -type Time = int; - -type CreateAssetArguments = record { - key: Key; - content_type: text; - max_age: opt nat64; - headers: opt vec HeaderField; - enable_aliasing: opt bool; - allow_raw_access: opt bool; -}; - -// Add or change content for an asset, by content encoding -type SetAssetContentArguments = record { - key: Key; - content_encoding: text; - chunk_ids: vec ChunkId; - sha256: opt blob; -}; - -// Remove content for an asset, by content encoding -type UnsetAssetContentArguments = record { - key: Key; - content_encoding: text; -}; - -// Delete an asset -type DeleteAssetArguments = record { - key: Key; -}; - -// Reset everything type ClearArguments = record {}; - -type BatchOperationKind = variant { - CreateAsset: CreateAssetArguments; - SetAssetContent: SetAssetContentArguments; - - SetAssetProperties: SetAssetPropertiesArguments; - - UnsetAssetContent: UnsetAssetContentArguments; - DeleteAsset: DeleteAssetArguments; - - Clear: ClearArguments; -}; - type CommitBatchArguments = record { - batch_id: BatchId; - operations: vec BatchOperationKind + batch_id : BatchId; + operations : vec BatchOperationKind; }; - type CommitProposedBatchArguments = record { - batch_id: BatchId; - evidence: blob; + batch_id : BatchId; + evidence : vec nat8; }; - type ComputeEvidenceArguments = record { - batch_id: BatchId; - max_iterations: opt nat16 + batch_id : BatchId; + max_iterations : opt nat16; +}; +type ConfigurationResponse = record { + max_batches : opt nat64; + max_bytes : opt nat64; + max_chunks : opt nat64; +}; +type ConfigureArguments = record { + max_batches : opt opt nat64; + max_bytes : opt opt nat64; + max_chunks : opt opt nat64; }; - -type DeleteBatchArguments = record { - batch_id: BatchId; +type CreateAssetArguments = record { + key : Key; + content_type : text; + headers : opt vec HeaderField; + allow_raw_access : opt bool; + max_age : opt nat64; + enable_aliasing : opt bool; +}; +type DeleteAssetArguments = record { key : Key }; +type DeleteBatchArguments = record { batch_id : BatchId }; +type GrantPermission = record { + permission : Permission; + to_principal : principal; }; - -type HeaderField = record { text; text; }; - +type HeaderField = record { text; text }; type HttpRequest = record { - method: text; - url: text; - headers: vec HeaderField; - body: blob; - certificate_version: opt nat16; + url : text; + method : text; + body : vec nat8; + headers : vec HeaderField; + certificate_version : opt nat16; }; - type HttpResponse = record { - status_code: nat16; - headers: vec HeaderField; - body: blob; - streaming_strategy: opt StreamingStrategy; -}; - -type StreamingCallbackHttpResponse = record { - body: blob; - token: opt StreamingCallbackToken; + body : vec nat8; + headers : vec HeaderField; + streaming_strategy : opt StreamingStrategy; + status_code : nat16; }; - -type StreamingCallbackToken = record { - key: Key; - content_encoding: text; - index: nat; - sha256: opt blob; +type InitArgs = record {}; +type Key = text; +type ListPermitted = record { permission : Permission }; +type Permission = variant { Prepare; ManagePermissions; Commit }; +type RevokePermission = record { + permission : Permission; + of_principal : principal; }; - -type StreamingStrategy = variant { - Callback: record { - callback: func (StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query; - token: StreamingCallbackToken; - }; +type SetAssetContentArguments = record { + key : Key; + sha256 : opt vec nat8; + chunk_ids : vec ChunkId; + content_encoding : text; }; - type SetAssetPropertiesArguments = record { - key: Key; - max_age: opt opt nat64; - headers: opt opt vec HeaderField; - allow_raw_access: opt opt bool; - is_aliased: opt opt bool; -}; - -type ConfigurationResponse = record { - max_batches: opt nat64; - max_chunks: opt nat64; - max_bytes: opt nat64; + key : Key; + headers : opt opt vec HeaderField; + is_aliased : opt opt bool; + allow_raw_access : opt opt bool; + max_age : opt opt nat64; }; - -type ConfigureArguments = record { - max_batches: opt opt nat64; - max_chunks: opt opt nat64; - max_bytes: opt opt nat64; +type SetPermissions = record { + prepare : vec principal; + commit : vec principal; + manage_permissions : vec principal; }; - -type Permission = variant { - Commit; - ManagePermissions; - Prepare; +type StreamingCallbackHttpResponse = record { + token : opt StreamingCallbackToken; + body : vec nat8; }; - -type GrantPermission = record { - to_principal: principal; - permission: Permission; +type StreamingCallbackToken = record { + key : Key; + sha256 : opt vec nat8; + index : nat; + content_encoding : text; }; -type RevokePermission = record { - of_principal: principal; - permission: Permission; +type StreamingStrategy = variant { + Callback : record { + token : StreamingCallbackToken; + callback : func (StreamingCallbackToken) -> ( + opt StreamingCallbackHttpResponse, + ) query; + }; }; -type ListPermitted = record { permission: Permission }; - +type Time = int; +type UnsetAssetContentArguments = record { key : Key; content_encoding : text }; +type UpgradeArgs = record { set_permissions : opt SetPermissions }; type ValidationResult = variant { Ok : text; Err : text }; - -service: { - api_version: () -> (nat16) query; - - get: (record { - key: Key; - accept_encodings: vec text; - }) -> (record { - content: blob; // may be the entirety of the content, or just chunk index 0 - content_type: text; - content_encoding: text; - sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments - total_length: nat; // all chunks except last have size == content.size() - }) query; - - // if get() returned chunks > 1, call this to retrieve them. - // chunks may or may not be split up at the same boundaries as presented to create_chunk(). - get_chunk: (record { - key: Key; - content_encoding: text; - index: nat; - sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments - }) -> (record { content: blob }) query; - - list : (record {}) -> (vec record { - key: Key; - content_type: text; - encodings: vec record { - content_encoding: text; - sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments - length: nat; // Size of this encoding's blob. Calculated when uploading assets. - modified: Time; - }; - }) query; - - certified_tree : (record {}) -> (record { - certificate: blob; - tree: blob; - }) query; - - create_batch : (record {}) -> (record { batch_id: BatchId }); - - create_chunk: (record { batch_id: BatchId; content: blob }) -> (record { chunk_id: ChunkId }); - - // Perform all operations successfully, or reject - commit_batch: (CommitBatchArguments) -> (); - - // Save the batch operations for later commit - propose_commit_batch: (CommitBatchArguments) -> (); - - // Given a batch already proposed, perform all operations successfully, or reject - commit_proposed_batch: (CommitProposedBatchArguments) -> (); - - // Compute a hash over the CommitBatchArguments. Call until it returns Some(evidence). - compute_evidence: (ComputeEvidenceArguments) -> (opt blob); - - // Delete a batch that has been created, or proposed for commit, but not yet committed - delete_batch: (DeleteBatchArguments) -> (); - - create_asset: (CreateAssetArguments) -> (); - set_asset_content: (SetAssetContentArguments) -> (); - unset_asset_content: (UnsetAssetContentArguments) -> (); - - delete_asset: (DeleteAssetArguments) -> (); - - clear: (ClearArguments) -> (); - - // Single call to create an asset with content for a single content encoding that - // fits within the message ingress limit. - store: (record { - key: Key; - content_type: text; - content_encoding: text; - content: blob; - sha256: opt blob - }) -> (); - - http_request: (request: HttpRequest) -> (HttpResponse) query; - http_request_streaming_callback: (token: StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query; - - authorize: (principal) -> (); - deauthorize: (principal) -> (); - list_authorized: () -> (vec principal) query; - grant_permission: (GrantPermission) -> (); - revoke_permission: (RevokePermission) -> (); - list_permitted: (ListPermitted) -> (vec principal) query; - take_ownership: () -> (); - - get_asset_properties : (key: Key) -> (record { - max_age: opt nat64; - headers: opt vec HeaderField; - allow_raw_access: opt bool; - is_aliased: opt bool; } ) query; - set_asset_properties: (SetAssetPropertiesArguments) -> (); - - get_configuration: () -> (ConfigurationResponse); - configure: (ConfigureArguments) -> (); - - validate_grant_permission: (GrantPermission) -> (ValidationResult); - validate_revoke_permission: (RevokePermission) -> (ValidationResult); - validate_take_ownership: () -> (ValidationResult); - validate_commit_proposed_batch: (CommitProposedBatchArguments) -> (ValidationResult); - validate_configure: (ConfigureArguments) -> (ValidationResult); -} +service : { + api_version : () -> (nat16) query; + authorize : (principal) -> (); + certified_tree : (record {}) -> ( + record { certificate : vec nat8; tree : vec nat8 }, + ) query; + clear : (ClearArguments) -> (); + commit_batch : (CommitBatchArguments) -> (); + commit_proposed_batch : (CommitProposedBatchArguments) -> (); + compute_evidence : (ComputeEvidenceArguments) -> (opt vec nat8); + configure : (ConfigureArguments) -> (); + create_asset : (CreateAssetArguments) -> (); + create_batch : (record {}) -> (record { batch_id : BatchId }); + create_chunk : (record { content : vec nat8; batch_id : BatchId }) -> ( + record { chunk_id : ChunkId }, + ); + deauthorize : (principal) -> (); + delete_asset : (DeleteAssetArguments) -> (); + delete_batch : (DeleteBatchArguments) -> (); + get : (record { key : Key; accept_encodings : vec text }) -> ( + record { + content : vec nat8; + sha256 : opt vec nat8; + content_type : text; + content_encoding : text; + total_length : nat; + }, + ) query; + get_asset_properties : (Key) -> ( + record { + headers : opt vec HeaderField; + is_aliased : opt bool; + allow_raw_access : opt bool; + max_age : opt nat64; + }, + ) query; + get_chunk : ( + record { + key : Key; + sha256 : opt vec nat8; + index : nat; + content_encoding : text; + }, + ) -> (record { content : vec nat8 }) query; + get_configuration : () -> (ConfigurationResponse); + grant_permission : (GrantPermission) -> (); + http_request : (HttpRequest) -> (HttpResponse) query; + http_request_streaming_callback : (StreamingCallbackToken) -> ( + opt StreamingCallbackHttpResponse, + ) query; + list : (record {}) -> ( + vec record { + key : Key; + encodings : vec record { + modified : Time; + sha256 : opt vec nat8; + length : nat; + content_encoding : text; + }; + content_type : text; + }, + ) query; + list_authorized : () -> (vec principal); + list_permitted : (ListPermitted) -> (vec principal); + propose_commit_batch : (CommitBatchArguments) -> (); + revoke_permission : (RevokePermission) -> (); + set_asset_content : (SetAssetContentArguments) -> (); + set_asset_properties : (SetAssetPropertiesArguments) -> (); + store : ( + record { + key : Key; + content : vec nat8; + sha256 : opt vec nat8; + content_type : text; + content_encoding : text; + }, + ) -> (); + take_ownership : () -> (); + unset_asset_content : (UnsetAssetContentArguments) -> (); + validate_commit_proposed_batch : (CommitProposedBatchArguments) -> ( + ValidationResult, + ); + validate_configure : (ConfigureArguments) -> (ValidationResult); + validate_grant_permission : (GrantPermission) -> (ValidationResult); + validate_revoke_permission : (RevokePermission) -> (ValidationResult); + validate_take_ownership : () -> (ValidationResult); +} \ No newline at end of file diff --git a/.dfx/local/canisters/assets/service.did.d.ts b/.dfx/local/canisters/assets/service.did.d.ts index ad645fa1..0b4168ef 100644 --- a/.dfx/local/canisters/assets/service.did.d.ts +++ b/.dfx/local/canisters/assets/service.did.d.ts @@ -1,6 +1,9 @@ import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; +export type AssetCanisterArgs = { 'Upgrade' : UpgradeArgs } | + { 'Init' : InitArgs }; export type BatchId = bigint; export type BatchOperationKind = { 'SetAssetProperties' : SetAssetPropertiesArguments @@ -62,6 +65,7 @@ export interface HttpResponse { 'streaming_strategy' : [] | [StreamingStrategy], 'status_code' : number, } +export type InitArgs = {}; export type Key = string; export interface ListPermitted { 'permission' : Permission } export type Permission = { 'Prepare' : null } | @@ -84,6 +88,11 @@ export interface SetAssetPropertiesArguments { 'allow_raw_access' : [] | [[] | [boolean]], 'max_age' : [] | [[] | [bigint]], } +export interface SetPermissions { + 'prepare' : Array, + 'commit' : Array, + 'manage_permissions' : Array, +} export interface StreamingCallbackHttpResponse { 'token' : [] | [StreamingCallbackToken], 'body' : Uint8Array | number[], @@ -105,6 +114,7 @@ export interface UnsetAssetContentArguments { 'key' : Key, 'content_encoding' : string, } +export interface UpgradeArgs { 'set_permissions' : [] | [SetPermissions] } export type ValidationResult = { 'Ok' : string } | { 'Err' : string }; export interface _SERVICE { @@ -226,3 +236,5 @@ export interface _SERVICE { >, 'validate_take_ownership' : ActorMethod<[], ValidationResult>, } +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[]; diff --git a/.dfx/local/canisters/assets/service.did.js b/.dfx/local/canisters/assets/service.did.js index 31ef5ce8..1cc196eb 100644 --- a/.dfx/local/canisters/assets/service.did.js +++ b/.dfx/local/canisters/assets/service.did.js @@ -211,12 +211,8 @@ export const idlFactory = ({ IDL }) => { ], ['query'], ), - 'list_authorized' : IDL.Func([], [IDL.Vec(IDL.Principal)], ['query']), - 'list_permitted' : IDL.Func( - [ListPermitted], - [IDL.Vec(IDL.Principal)], - ['query'], - ), + 'list_authorized' : IDL.Func([], [IDL.Vec(IDL.Principal)], []), + 'list_permitted' : IDL.Func([ListPermitted], [IDL.Vec(IDL.Principal)], []), 'propose_commit_batch' : IDL.Func([CommitBatchArguments], [], []), 'revoke_permission' : IDL.Func([RevokePermission], [], []), 'set_asset_content' : IDL.Func([SetAssetContentArguments], [], []), diff --git a/.dfx/local/canisters/backend/backend.did b/.dfx/local/canisters/backend/backend.did index 2dc5bb9d..342bc778 100644 --- a/.dfx/local/canisters/backend/backend.did +++ b/.dfx/local/canisters/backend/backend.did @@ -1,12 +1,16 @@ type User = record { - created_at: int; - email: text; + email_address: text; email_notifications: bool; name: text; - phone: text; phone_notifications: bool; - wallet: text; + phone_number: text; + }; +type Transaction = + record { + amount: text; + from: text; + to: text; }; type Subaccount = blob; type Result = @@ -14,13 +18,20 @@ type Result = err: text; ok: text; }; -type Response_1 = +type Response_2 = record { data: opt text; error_text: opt text; status: nat16; status_text: text; }; +type Response_1 = + record { + data: opt Transaction; + error_text: opt text; + status: nat16; + status_text: text; + }; type Response = record { data: opt User; @@ -28,32 +39,70 @@ type Response = status: nat16; status_text: text; }; +type GetAccountIdentifierSuccess = record { + accountIdentifier: AccountIdentifier;}; +type GetAccountIdentifierResult = + variant { + err: GetAccountIdentifierErr; + ok: GetAccountIdentifierSuccess; + }; +type GetAccountIdentifierErr = record {message: opt text;}; +type GetAccountIdentifierArgs = record {"principal": principal;}; type Backend = service { - deleteUser: (text) -> (Response_1); + accountIdentifierToBlob: (AccountIdentifier) -> + (AccountIdentifierToBlobResult); getAddress: () -> (text); getCanisterAddress: () -> (text); getCanisterBalance: () -> (text); getFundingAddress: () -> (text); getFundingBalance: () -> (text); getInvoice: () -> (Account); + /// * Get latest log items. Log output is capped at 100 items. getLogs: () -> (vec text) query; getTradingAddress: () -> (text); getTradingBalance: () -> (text); + /// * High-Level API + /// * Get the merchant's information getUser: () -> (Response) query; getUsersList: () -> (vec record { text; User; }) query; - setCourierApiKey: (text) -> (Response_1); - transactionsLength: () -> (text) query; + get_account_identifier: (GetAccountIdentifierArgs) -> + (GetAccountIdentifierResult) query; + /// * Set the courier API key. Only the owner can set the courier API key. + setCourierApiKey: (text) -> (Response_2); transferFromCanistertoSubAccount: () -> (Result); transferFromSubAccountToCanister: (nat) -> (Result); - transferFromSubAccountToSubAccount: (text, nat) -> (Result); + transferFromSubAccountToSubAccount: (text, nat) -> (Response_1); + /// * Update the merchant's information updateUser: (User) -> (Response); + /// * Check if user exists and return Bool + userExists: () -> (bool) query; userLength: () -> (text) query; whoami: () -> (principal); }; +type AccountIdentifierToBlobSuccess = blob; +type AccountIdentifierToBlobResult = + variant { + err: AccountIdentifierToBlobErr; + ok: AccountIdentifierToBlobSuccess; + }; +type AccountIdentifierToBlobErr = + record { + kind: variant { + InvalidAccountIdentifier; + Other; + }; + message: opt text; + }; +type AccountIdentifier = + variant { + "blob": blob; + "principal": principal; + "text": text; + }; type Account = record { owner: principal; diff --git a/.dfx/local/canisters/backend/backend.most b/.dfx/local/canisters/backend/backend.most index 6c74fc43..2474644b 100644 --- a/.dfx/local/canisters/backend/backend.most +++ b/.dfx/local/canisters/backend/backend.most @@ -6,35 +6,19 @@ type Hash = Nat32; type Key__1 = {hash : Hash; key : K}; type Leaf = {keyvals : AssocList__1, V>; size : Nat}; type List = ?(T, List); -type Transaction = - { - amount : Nat; - created_at : Int; - from : Principal; - memo : Text; - to : Principal - }; type Trie = {#branch : Branch; #empty; #leaf : Leaf}; type User = { - created_at : Int; - email : Text; + email_address : Text; email_notifications : Bool; name : Text; - phone : Text; phone_notifications : Bool; - wallet : Text + phone_number : Text }; +type User__1 = User; actor { stable var courierApiKey : Text; stable var latestTransactionIndex : Nat; - stable var next : Nat32; - stable var transactions : - { - #branch : Branch; - #empty; - #leaf : Leaf - }; stable var userStore : - {#branch : Branch; #empty; #leaf : Leaf} + {#branch : Branch; #empty; #leaf : Leaf} }; diff --git a/.dfx/local/canisters/backend/backend.old.most b/.dfx/local/canisters/backend/backend.old.most index 6c74fc43..12a89650 100644 --- a/.dfx/local/canisters/backend/backend.old.most +++ b/.dfx/local/canisters/backend/backend.old.most @@ -6,35 +6,27 @@ type Hash = Nat32; type Key__1 = {hash : Hash; key : K}; type Leaf = {keyvals : AssocList__1, V>; size : Nat}; type List = ?(T, List); -type Transaction = - { - amount : Nat; - created_at : Int; - from : Principal; - memo : Text; - to : Principal - }; +type Transaction = {amount : Text; from : Text; to : Text}; +type Transaction__2 = Transaction; type Trie = {#branch : Branch; #empty; #leaf : Leaf}; type User = { - created_at : Int; - email : Text; + email_address : Text; email_notifications : Bool; name : Text; - phone : Text; phone_notifications : Bool; - wallet : Text + phone_number : Text }; +type User__1 = User; actor { stable var courierApiKey : Text; stable var latestTransactionIndex : Nat; - stable var next : Nat32; stable var transactions : { - #branch : Branch; + #branch : Branch; #empty; - #leaf : Leaf + #leaf : Leaf }; stable var userStore : - {#branch : Branch; #empty; #leaf : Leaf} + {#branch : Branch; #empty; #leaf : Leaf} }; diff --git a/.dfx/local/canisters/backend/backend.wasm b/.dfx/local/canisters/backend/backend.wasm index 1b9bc457..cb0c23fd 100644 Binary files a/.dfx/local/canisters/backend/backend.wasm and b/.dfx/local/canisters/backend/backend.wasm differ diff --git a/.dfx/local/canisters/backend/constructor.did b/.dfx/local/canisters/backend/constructor.did index 2dc5bb9d..342bc778 100644 --- a/.dfx/local/canisters/backend/constructor.did +++ b/.dfx/local/canisters/backend/constructor.did @@ -1,12 +1,16 @@ type User = record { - created_at: int; - email: text; + email_address: text; email_notifications: bool; name: text; - phone: text; phone_notifications: bool; - wallet: text; + phone_number: text; + }; +type Transaction = + record { + amount: text; + from: text; + to: text; }; type Subaccount = blob; type Result = @@ -14,13 +18,20 @@ type Result = err: text; ok: text; }; -type Response_1 = +type Response_2 = record { data: opt text; error_text: opt text; status: nat16; status_text: text; }; +type Response_1 = + record { + data: opt Transaction; + error_text: opt text; + status: nat16; + status_text: text; + }; type Response = record { data: opt User; @@ -28,32 +39,70 @@ type Response = status: nat16; status_text: text; }; +type GetAccountIdentifierSuccess = record { + accountIdentifier: AccountIdentifier;}; +type GetAccountIdentifierResult = + variant { + err: GetAccountIdentifierErr; + ok: GetAccountIdentifierSuccess; + }; +type GetAccountIdentifierErr = record {message: opt text;}; +type GetAccountIdentifierArgs = record {"principal": principal;}; type Backend = service { - deleteUser: (text) -> (Response_1); + accountIdentifierToBlob: (AccountIdentifier) -> + (AccountIdentifierToBlobResult); getAddress: () -> (text); getCanisterAddress: () -> (text); getCanisterBalance: () -> (text); getFundingAddress: () -> (text); getFundingBalance: () -> (text); getInvoice: () -> (Account); + /// * Get latest log items. Log output is capped at 100 items. getLogs: () -> (vec text) query; getTradingAddress: () -> (text); getTradingBalance: () -> (text); + /// * High-Level API + /// * Get the merchant's information getUser: () -> (Response) query; getUsersList: () -> (vec record { text; User; }) query; - setCourierApiKey: (text) -> (Response_1); - transactionsLength: () -> (text) query; + get_account_identifier: (GetAccountIdentifierArgs) -> + (GetAccountIdentifierResult) query; + /// * Set the courier API key. Only the owner can set the courier API key. + setCourierApiKey: (text) -> (Response_2); transferFromCanistertoSubAccount: () -> (Result); transferFromSubAccountToCanister: (nat) -> (Result); - transferFromSubAccountToSubAccount: (text, nat) -> (Result); + transferFromSubAccountToSubAccount: (text, nat) -> (Response_1); + /// * Update the merchant's information updateUser: (User) -> (Response); + /// * Check if user exists and return Bool + userExists: () -> (bool) query; userLength: () -> (text) query; whoami: () -> (principal); }; +type AccountIdentifierToBlobSuccess = blob; +type AccountIdentifierToBlobResult = + variant { + err: AccountIdentifierToBlobErr; + ok: AccountIdentifierToBlobSuccess; + }; +type AccountIdentifierToBlobErr = + record { + kind: variant { + InvalidAccountIdentifier; + Other; + }; + message: opt text; + }; +type AccountIdentifier = + variant { + "blob": blob; + "principal": principal; + "text": text; + }; type Account = record { owner: principal; diff --git a/.dfx/local/canisters/backend/constructor.old.did b/.dfx/local/canisters/backend/constructor.old.did index df71a235..c63ac159 100644 --- a/.dfx/local/canisters/backend/constructor.old.did +++ b/.dfx/local/canisters/backend/constructor.old.did @@ -1,12 +1,16 @@ type User = record { - created_at: int; - email: text; + email_address: text; email_notifications: bool; name: text; - phone: text; phone_notifications: bool; - wallet: text; + phone_number: text; + }; +type Transaction = + record { + amount: text; + from: text; + to: text; }; type Subaccount = blob; type Result = @@ -14,13 +18,20 @@ type Result = err: text; ok: text; }; -type Response_1 = +type Response_2 = record { data: opt text; error_text: opt text; status: nat16; status_text: text; }; +type Response_1 = + record { + data: opt Transaction; + error_text: opt text; + status: nat16; + status_text: text; + }; type Response = record { data: opt User; @@ -28,13 +39,43 @@ type Response = status: nat16; status_text: text; }; +type GetAccountIdentifierSuccess = record { + accountIdentifier: AccountIdentifier;}; +type GetAccountIdentifierResult = + variant { + err: GetAccountIdentifierErr; + ok: GetAccountIdentifierSuccess; + }; +type GetAccountIdentifierErr = record {message: opt text;}; +type GetAccountIdentifierArgs = record {"principal": principal;}; +type AccountIdentifierToBlobSuccess = blob; +type AccountIdentifierToBlobResult = + variant { + err: AccountIdentifierToBlobErr; + ok: AccountIdentifierToBlobSuccess; + }; +type AccountIdentifierToBlobErr = + record { + kind: variant { + InvalidAccountIdentifier; + Other; + }; + message: opt text; + }; +type AccountIdentifier = + variant { + "blob": blob; + "principal": principal; + "text": text; + }; type Account = record { owner: principal; subaccount: opt Subaccount; }; service : { - deleteUser: (text) -> (Response_1); + accountIdentifierToBlob: (AccountIdentifier) -> + (AccountIdentifierToBlobResult); getAddress: () -> (text); getCanisterAddress: () -> (text); getCanisterBalance: () -> (text); @@ -44,17 +85,23 @@ service : { getLogs: () -> (vec text) query; getTradingAddress: () -> (text); getTradingBalance: () -> (text); + getTransactionList: () -> (vec record { + text; + Transaction; + }) query; getUser: () -> (Response) query; getUsersList: () -> (vec record { text; User; }) query; - setCourierApiKey: (text) -> (Response_1); - transactionsLength: () -> (text) query; + get_account_identifier: (GetAccountIdentifierArgs) -> + (GetAccountIdentifierResult) query; + setCourierApiKey: (text) -> (Response_2); transferFromCanistertoSubAccount: () -> (Result); transferFromSubAccountToCanister: (nat) -> (Result); - transferFromSubAccountToSubAccount: (text, nat) -> (Result); + transferFromSubAccountToSubAccount: (text, nat) -> (Response_1); updateUser: (User) -> (Response); + userExists: () -> (bool) query; userLength: () -> (text) query; whoami: () -> (principal); } diff --git a/.dfx/local/canisters/backend/service.did b/.dfx/local/canisters/backend/service.did index 982b75d2..3f4f0c6c 100644 --- a/.dfx/local/canisters/backend/service.did +++ b/.dfx/local/canisters/backend/service.did @@ -1,6 +1,22 @@ type Account = record { owner : principal; subaccount : opt Subaccount }; +type AccountIdentifier = variant { + "principal" : principal; + "blob" : vec nat8; + "text" : text; +}; +type AccountIdentifierToBlobErr = record { + kind : variant { InvalidAccountIdentifier; Other }; + message : opt text; +}; +type AccountIdentifierToBlobResult = variant { + ok : AccountIdentifierToBlobSuccess; + err : AccountIdentifierToBlobErr; +}; +type AccountIdentifierToBlobSuccess = vec nat8; type Backend = service { - deleteUser : (text) -> (Response_1); + accountIdentifierToBlob : (AccountIdentifier) -> ( + AccountIdentifierToBlobResult, + ); getAddress : () -> (text); getCanisterAddress : () -> (text); getCanisterBalance : () -> (text); @@ -12,15 +28,27 @@ type Backend = service { getTradingBalance : () -> (text); getUser : () -> (Response) query; getUsersList : () -> (vec record { text; User }) query; - setCourierApiKey : (text) -> (Response_1); - transactionsLength : () -> (text) query; + get_account_identifier : (GetAccountIdentifierArgs) -> ( + GetAccountIdentifierResult, + ) query; + setCourierApiKey : (text) -> (Response_2); transferFromCanistertoSubAccount : () -> (Result); transferFromSubAccountToCanister : (nat) -> (Result); - transferFromSubAccountToSubAccount : (text, nat) -> (Result); + transferFromSubAccountToSubAccount : (text, nat) -> (Response_1); updateUser : (User) -> (Response); + userExists : () -> (bool) query; userLength : () -> (text) query; whoami : () -> (principal); }; +type GetAccountIdentifierArgs = record { "principal" : principal }; +type GetAccountIdentifierErr = record { message : opt text }; +type GetAccountIdentifierResult = variant { + ok : GetAccountIdentifierSuccess; + err : GetAccountIdentifierErr; +}; +type GetAccountIdentifierSuccess = record { + accountIdentifier : AccountIdentifier; +}; type Response = record { status : nat16; data : opt User; @@ -28,6 +56,12 @@ type Response = record { error_text : opt text; }; type Response_1 = record { + status : nat16; + data : opt Transaction; + status_text : text; + error_text : opt text; +}; +type Response_2 = record { status : nat16; data : opt text; status_text : text; @@ -35,13 +69,12 @@ type Response_1 = record { }; type Result = variant { ok : text; err : text }; type Subaccount = vec nat8; +type Transaction = record { to : text; from : text; amount : text }; type User = record { + email_address : text; phone_notifications : bool; name : text; email_notifications : bool; - created_at : int; - email : text; - wallet : text; - phone : text; + phone_number : text; }; service : Backend \ No newline at end of file diff --git a/.dfx/local/canisters/backend/service.did.d.ts b/.dfx/local/canisters/backend/service.did.d.ts index fc3c73b3..bcafad77 100644 --- a/.dfx/local/canisters/backend/service.did.d.ts +++ b/.dfx/local/canisters/backend/service.did.d.ts @@ -1,12 +1,29 @@ import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; export interface Account { 'owner' : Principal, 'subaccount' : [] | [Subaccount], } +export type AccountIdentifier = { 'principal' : Principal } | + { 'blob' : Uint8Array | number[] } | + { 'text' : string }; +export interface AccountIdentifierToBlobErr { + 'kind' : { 'InvalidAccountIdentifier' : null } | + { 'Other' : null }, + 'message' : [] | [string], +} +export type AccountIdentifierToBlobResult = { + 'ok' : AccountIdentifierToBlobSuccess + } | + { 'err' : AccountIdentifierToBlobErr }; +export type AccountIdentifierToBlobSuccess = Uint8Array | number[]; export interface Backend { - 'deleteUser' : ActorMethod<[string], Response_1>, + 'accountIdentifierToBlob' : ActorMethod< + [AccountIdentifier], + AccountIdentifierToBlobResult + >, 'getAddress' : ActorMethod<[], string>, 'getCanisterAddress' : ActorMethod<[], string>, 'getCanisterBalance' : ActorMethod<[], string>, @@ -18,15 +35,31 @@ export interface Backend { 'getTradingBalance' : ActorMethod<[], string>, 'getUser' : ActorMethod<[], Response>, 'getUsersList' : ActorMethod<[], Array<[string, User]>>, - 'setCourierApiKey' : ActorMethod<[string], Response_1>, - 'transactionsLength' : ActorMethod<[], string>, + 'get_account_identifier' : ActorMethod< + [GetAccountIdentifierArgs], + GetAccountIdentifierResult + >, + 'setCourierApiKey' : ActorMethod<[string], Response_2>, 'transferFromCanistertoSubAccount' : ActorMethod<[], Result>, 'transferFromSubAccountToCanister' : ActorMethod<[bigint], Result>, - 'transferFromSubAccountToSubAccount' : ActorMethod<[string, bigint], Result>, + 'transferFromSubAccountToSubAccount' : ActorMethod< + [string, bigint], + Response_1 + >, 'updateUser' : ActorMethod<[User], Response>, + 'userExists' : ActorMethod<[], boolean>, 'userLength' : ActorMethod<[], string>, 'whoami' : ActorMethod<[], Principal>, } +export interface GetAccountIdentifierArgs { 'principal' : Principal } +export interface GetAccountIdentifierErr { 'message' : [] | [string] } +export type GetAccountIdentifierResult = { + 'ok' : GetAccountIdentifierSuccess + } | + { 'err' : GetAccountIdentifierErr }; +export interface GetAccountIdentifierSuccess { + 'accountIdentifier' : AccountIdentifier, +} export interface Response { 'status' : number, 'data' : [] | [User], @@ -34,6 +67,12 @@ export interface Response { 'error_text' : [] | [string], } export interface Response_1 { + 'status' : number, + 'data' : [] | [Transaction], + 'status_text' : string, + 'error_text' : [] | [string], +} +export interface Response_2 { 'status' : number, 'data' : [] | [string], 'status_text' : string, @@ -42,13 +81,18 @@ export interface Response_1 { export type Result = { 'ok' : string } | { 'err' : string }; export type Subaccount = Uint8Array | number[]; +export interface Transaction { + 'to' : string, + 'from' : string, + 'amount' : string, +} export interface User { + 'email_address' : string, 'phone_notifications' : boolean, 'name' : string, 'email_notifications' : boolean, - 'created_at' : bigint, - 'email' : string, - 'wallet' : string, - 'phone' : string, + 'phone_number' : string, } export interface _SERVICE extends Backend {} +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[]; diff --git a/.dfx/local/canisters/backend/service.did.js b/.dfx/local/canisters/backend/service.did.js index 8a50116b..672ef1cd 100644 --- a/.dfx/local/canisters/backend/service.did.js +++ b/.dfx/local/canisters/backend/service.did.js @@ -1,9 +1,20 @@ export const idlFactory = ({ IDL }) => { - const Response_1 = IDL.Record({ - 'status' : IDL.Nat16, - 'data' : IDL.Opt(IDL.Text), - 'status_text' : IDL.Text, - 'error_text' : IDL.Opt(IDL.Text), + const AccountIdentifier = IDL.Variant({ + 'principal' : IDL.Principal, + 'blob' : IDL.Vec(IDL.Nat8), + 'text' : IDL.Text, + }); + const AccountIdentifierToBlobSuccess = IDL.Vec(IDL.Nat8); + const AccountIdentifierToBlobErr = IDL.Record({ + 'kind' : IDL.Variant({ + 'InvalidAccountIdentifier' : IDL.Null, + 'Other' : IDL.Null, + }), + 'message' : IDL.Opt(IDL.Text), + }); + const AccountIdentifierToBlobResult = IDL.Variant({ + 'ok' : AccountIdentifierToBlobSuccess, + 'err' : AccountIdentifierToBlobErr, }); const Subaccount = IDL.Vec(IDL.Nat8); const Account = IDL.Record({ @@ -11,13 +22,11 @@ export const idlFactory = ({ IDL }) => { 'subaccount' : IDL.Opt(Subaccount), }); const User = IDL.Record({ + 'email_address' : IDL.Text, 'phone_notifications' : IDL.Bool, 'name' : IDL.Text, 'email_notifications' : IDL.Bool, - 'created_at' : IDL.Int, - 'email' : IDL.Text, - 'wallet' : IDL.Text, - 'phone' : IDL.Text, + 'phone_number' : IDL.Text, }); const Response = IDL.Record({ 'status' : IDL.Nat16, @@ -25,9 +34,39 @@ export const idlFactory = ({ IDL }) => { 'status_text' : IDL.Text, 'error_text' : IDL.Opt(IDL.Text), }); + const GetAccountIdentifierArgs = IDL.Record({ 'principal' : IDL.Principal }); + const GetAccountIdentifierSuccess = IDL.Record({ + 'accountIdentifier' : AccountIdentifier, + }); + const GetAccountIdentifierErr = IDL.Record({ 'message' : IDL.Opt(IDL.Text) }); + const GetAccountIdentifierResult = IDL.Variant({ + 'ok' : GetAccountIdentifierSuccess, + 'err' : GetAccountIdentifierErr, + }); + const Response_2 = IDL.Record({ + 'status' : IDL.Nat16, + 'data' : IDL.Opt(IDL.Text), + 'status_text' : IDL.Text, + 'error_text' : IDL.Opt(IDL.Text), + }); const Result = IDL.Variant({ 'ok' : IDL.Text, 'err' : IDL.Text }); + const Transaction = IDL.Record({ + 'to' : IDL.Text, + 'from' : IDL.Text, + 'amount' : IDL.Text, + }); + const Response_1 = IDL.Record({ + 'status' : IDL.Nat16, + 'data' : IDL.Opt(Transaction), + 'status_text' : IDL.Text, + 'error_text' : IDL.Opt(IDL.Text), + }); const Backend = IDL.Service({ - 'deleteUser' : IDL.Func([IDL.Text], [Response_1], []), + 'accountIdentifierToBlob' : IDL.Func( + [AccountIdentifier], + [AccountIdentifierToBlobResult], + [], + ), 'getAddress' : IDL.Func([], [IDL.Text], []), 'getCanisterAddress' : IDL.Func([], [IDL.Text], []), 'getCanisterBalance' : IDL.Func([], [IDL.Text], []), @@ -43,16 +82,21 @@ export const idlFactory = ({ IDL }) => { [IDL.Vec(IDL.Tuple(IDL.Text, User))], ['query'], ), - 'setCourierApiKey' : IDL.Func([IDL.Text], [Response_1], []), - 'transactionsLength' : IDL.Func([], [IDL.Text], ['query']), + 'get_account_identifier' : IDL.Func( + [GetAccountIdentifierArgs], + [GetAccountIdentifierResult], + ['query'], + ), + 'setCourierApiKey' : IDL.Func([IDL.Text], [Response_2], []), 'transferFromCanistertoSubAccount' : IDL.Func([], [Result], []), 'transferFromSubAccountToCanister' : IDL.Func([IDL.Nat], [Result], []), 'transferFromSubAccountToSubAccount' : IDL.Func( [IDL.Text, IDL.Nat], - [Result], + [Response_1], [], ), 'updateUser' : IDL.Func([User], [Response], []), + 'userExists' : IDL.Func([], [IDL.Bool], ['query']), 'userLength' : IDL.Func([], [IDL.Text], ['query']), 'whoami' : IDL.Func([], [IDL.Principal], []), }); diff --git a/.dfx/local/canisters/ckbtc_ledger/service.did.d.ts b/.dfx/local/canisters/ckbtc_ledger/service.did.d.ts index a494988d..78cadf80 100644 --- a/.dfx/local/canisters/ckbtc_ledger/service.did.d.ts +++ b/.dfx/local/canisters/ckbtc_ledger/service.did.d.ts @@ -1,5 +1,6 @@ import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; export interface Account { 'owner' : Principal, @@ -157,3 +158,5 @@ export interface _SERVICE { 'icrc1_total_supply' : ActorMethod<[], Tokens>, 'icrc1_transfer' : ActorMethod<[TransferArg], TransferResult>, } +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[]; diff --git a/.dfx/local/canisters/icrc1_index/service.did.d.ts b/.dfx/local/canisters/icrc1_index/service.did.d.ts index 472883d7..09569f40 100644 --- a/.dfx/local/canisters/icrc1_index/service.did.d.ts +++ b/.dfx/local/canisters/icrc1_index/service.did.d.ts @@ -1,5 +1,6 @@ import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; export interface Account { 'owner' : Principal, @@ -77,3 +78,5 @@ export interface _SERVICE { 'ledger_id' : ActorMethod<[], Principal>, 'list_subaccounts' : ActorMethod<[ListSubaccountsArgs], Array>, } +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[]; diff --git a/.dfx/local/canisters/idl/bkyz2-fmaaa-aaaaa-qaaaq-cai.did b/.dfx/local/canisters/idl/bkyz2-fmaaa-aaaaa-qaaaq-cai.did new file mode 100644 index 00000000..ed129e46 --- /dev/null +++ b/.dfx/local/canisters/idl/bkyz2-fmaaa-aaaaa-qaaaq-cai.did @@ -0,0 +1,276 @@ +type BlockIndex = nat; +type Subaccount = blob; +// Number of nanoseconds since the UNIX epoch in UTC timezone. +type Timestamp = nat64; +// Number of nanoseconds between two [Timestamp]s. +type Duration = nat64; +type Tokens = nat; +type TxIndex = nat; + +type Account = record { + owner : principal; + subaccount : opt Subaccount; +}; + +type TransferArg = record { + from_subaccount : opt Subaccount; + to : Account; + amount : Tokens; + fee : opt Tokens; + memo : opt blob; + created_at_time: opt Timestamp; +}; + +type TransferError = variant { + BadFee : record { expected_fee : Tokens }; + BadBurn : record { min_burn_amount : Tokens }; + InsufficientFunds : record { balance : Tokens }; + TooOld; + CreatedInFuture : record { ledger_time : nat64 }; + TemporarilyUnavailable; + Duplicate : record { duplicate_of : BlockIndex }; + GenericError : record { error_code : nat; message : text }; +}; + +type TransferResult = variant { + Ok : BlockIndex; + Err : TransferError; +}; + +// The value returned from the [icrc1_metadata] endpoint. +type MetadataValue = variant { + Nat : nat; + Int : int; + Text : text; + Blob : blob; +}; + +// The initialization parameters of the Ledger +type InitArgs = record { + minting_account : Account; + fee_collector_account : opt Account; + transfer_fee : nat64; + token_symbol : text; + token_name : text; + metadata : vec record { text; MetadataValue }; + initial_balances : vec record { Account; nat64 }; + archive_options : record { + num_blocks_to_archive : nat64; + trigger_threshold : nat64; + max_message_size_bytes : opt nat64; + cycles_for_archive_creation : opt nat64; + node_max_memory_size_bytes : opt nat64; + controller_id : principal; + }; +}; + +type ChangeFeeCollector = variant { + Unset; SetTo: Account; +}; + +type UpgradeArgs = record { + metadata : opt vec record { text; MetadataValue }; + token_symbol : opt text; + token_name : opt text; + transfer_fee : opt nat64; + change_fee_collector : opt ChangeFeeCollector; +}; + +type LedgerArg = variant { + Init: InitArgs; + Upgrade: opt UpgradeArgs; +}; + +type GetTransactionsRequest = record { + // The index of the first tx to fetch. + start : TxIndex; + // The number of transactions to fetch. + length : nat; +}; + +type GetTransactionsResponse = record { + // The total number of transactions in the log. + log_length : nat; + + // List of transaction that were available in the ledger when it processed the call. + // + // The transactions form a contiguous range, with the first transaction having index + // [first_index] (see below), and the last transaction having index + // [first_index] + len(transactions) - 1. + // + // The transaction range can be an arbitrary sub-range of the originally requested range. + transactions : vec Transaction; + + // The index of the first transaction in [transactions]. + // If the transaction vector is empty, the exact value of this field is not specified. + first_index : TxIndex; + + // Encoding of instructions for fetching archived transactions whose indices fall into the + // requested range. + // + // For each entry `e` in [archived_transactions], `[e.from, e.from + len)` is a sub-range + // of the originally requested transaction range. + archived_transactions : vec record { + // The index of the first archived transaction you can fetch using the [callback]. + start : TxIndex; + + // The number of transactions you can fetch using the callback. + length : nat; + + // The function you should call to fetch the archived transactions. + // The range of the transaction accessible using this function is given by [from] + // and [len] fields above. + callback : QueryArchiveFn; + }; +}; + + +// A prefix of the transaction range specified in the [GetTransactionsRequest] request. +type TransactionRange = record { + // A prefix of the requested transaction range. + // The index of the first transaction is equal to [GetTransactionsRequest.from]. + // + // Note that the number of transactions might be less than the requested + // [GetTransactionsRequest.length] for various reasons, for example: + // + // 1. The query might have hit the replica with an outdated state + // that doesn't have the whole range yet. + // 2. The requested range is too large to fit into a single reply. + // + // NOTE: the list of transactions can be empty if: + // + // 1. [GetTransactionsRequest.length] was zero. + // 2. [GetTransactionsRequest.from] was larger than the last transaction known to + // the canister. + transactions : vec Transaction; +}; + +// A function for fetching archived transaction. +type QueryArchiveFn = func (GetTransactionsRequest) -> (TransactionRange) query; + +type Transaction = record { + kind : text; + mint : opt record { + amount : nat; + to : Account; + memo : opt blob; + created_at_time : opt nat64; + }; + burn : opt record { + amount : nat; + from : Account; + memo : opt blob; + created_at_time : opt nat64; + }; + transfer : opt record { + amount : nat; + from : Account; + to : Account; + memo : opt blob; + created_at_time : opt nat64; + fee : opt nat; + }; + timestamp : nat64; +}; + +type Value = variant { + Blob : blob; + Text : text; + Nat : nat; + Nat64: nat64; + Int : int; + Array : vec Value; + Map : Map; +}; + +type Map = vec record { text; Value }; + +type Block = Value; + +type GetBlocksArgs = record { + // The index of the first block to fetch. + start : BlockIndex; + // Max number of blocks to fetch. + length : nat; +}; + +// A prefix of the block range specified in the [GetBlocksArgs] request. +type BlockRange = record { + // A prefix of the requested block range. + // The index of the first block is equal to [GetBlocksArgs.start]. + // + // Note that the number of blocks might be less than the requested + // [GetBlocksArgs.length] for various reasons, for example: + // + // 1. The query might have hit the replica with an outdated state + // that doesn't have the whole range yet. + // 2. The requested range is too large to fit into a single reply. + // + // NOTE: the list of blocks can be empty if: + // + // 1. [GetBlocksArgs.length] was zero. + // 2. [GetBlocksArgs.start] was larger than the last block known to + // the canister. + blocks : vec Block; +}; + +// A function for fetching archived blocks. +type QueryBlockArchiveFn = func (GetBlocksArgs) -> (BlockRange) query; + +// The result of a "get_blocks" call. +type GetBlocksResponse = record { + // The index of the first block in "blocks". + // If the blocks vector is empty, the exact value of this field is not specified. + first_index : BlockIndex; + + // The total number of blocks in the chain. + // If the chain length is positive, the index of the last block is `chain_len - 1`. + chain_length : nat64; + + // System certificate for the hash of the latest block in the chain. + // Only present if `get_blocks` is called in a non-replicated query context. + certificate : opt blob; + + // List of blocks that were available in the ledger when it processed the call. + // + // The blocks form a contiguous range, with the first block having index + // [first_block_index] (see below), and the last block having index + // [first_block_index] + len(blocks) - 1. + // + // The block range can be an arbitrary sub-range of the originally requested range. + blocks : vec Block; + + // Encoding of instructions for fetching archived blocks. + archived_blocks : vec record { + // The index of the first archived block. + start : BlockIndex; + + // The number of blocks that can be fetched. + length : nat; + + // Callback to fetch the archived blocks. + callback : QueryBlockArchiveFn; + }; +}; + +// Certificate for the block at `block_index`. +type DataCertificate = record { + certificate : opt blob; + hash_tree : blob; +}; + +service : { + icrc1_name : () -> (text) query; + icrc1_symbol : () -> (text) query; + icrc1_decimals : () -> (nat8) query; + icrc1_metadata : () -> (vec record { text; MetadataValue }) query; + icrc1_total_supply : () -> (Tokens) query; + icrc1_fee : () -> (Tokens) query; + icrc1_minting_account : () -> (opt Account) query; + icrc1_balance_of : (Account) -> (Tokens) query; + icrc1_transfer : (TransferArg) -> (TransferResult); + icrc1_supported_standards : () -> (vec record { name : text; url : text }) query; + get_transactions : (GetTransactionsRequest) -> (GetTransactionsResponse) query; + get_blocks : (GetBlocksArgs) -> (GetBlocksResponse) query; + get_data_certificate : () -> (DataCertificate) query; +} \ No newline at end of file diff --git a/.dfx/local/canisters/icrc1_index/constructor.old.did b/.dfx/local/canisters/idl/br5f7-7uaaa-aaaaa-qaaca-cai.did similarity index 100% rename from .dfx/local/canisters/icrc1_index/constructor.old.did rename to .dfx/local/canisters/idl/br5f7-7uaaa-aaaaa-qaaca-cai.did diff --git a/.dfx/local/canisters/assets/constructor.old.did b/.dfx/local/canisters/idl/bw4dl-smaaa-aaaaa-qaacq-cai.did similarity index 92% rename from .dfx/local/canisters/assets/constructor.old.did rename to .dfx/local/canisters/idl/bw4dl-smaaa-aaaaa-qaacq-cai.did index c4f659eb..51bb1a23 100644 --- a/.dfx/local/canisters/assets/constructor.old.did +++ b/.dfx/local/canisters/idl/bw4dl-smaaa-aaaaa-qaacq-cai.did @@ -139,7 +139,25 @@ type ListPermitted = record { permission: Permission }; type ValidationResult = variant { Ok : text; Err : text }; -service: { +type AssetCanisterArgs = variant { + Init: InitArgs; + Upgrade: UpgradeArgs; +}; + +type InitArgs = record {}; + +type UpgradeArgs = record { + set_permissions: opt SetPermissions; +}; + +/// Sets the list of principals granted each permission. +type SetPermissions = record { + prepare: vec principal; + commit: vec principal; + manage_permissions: vec principal; +}; + +service: (asset_canister_args: opt AssetCanisterArgs) -> { api_version: () -> (nat16) query; get: (record { @@ -220,10 +238,10 @@ service: { authorize: (principal) -> (); deauthorize: (principal) -> (); - list_authorized: () -> (vec principal) query; + list_authorized: () -> (vec principal); grant_permission: (GrantPermission) -> (); revoke_permission: (RevokePermission) -> (); - list_permitted: (ListPermitted) -> (vec principal) query; + list_permitted: (ListPermitted) -> (vec principal); take_ownership: () -> (); get_asset_properties : (key: Key) -> (record { diff --git a/deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did b/.dfx/local/canisters/idl/rdmx6-jaaaa-aaaaa-aaadq-cai.did similarity index 100% rename from deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did rename to .dfx/local/canisters/idl/rdmx6-jaaaa-aaaaa-aaadq-cai.did diff --git a/.dfx/local/canisters/internet-identity/constructor.did b/.dfx/local/canisters/internet-identity/constructor.did deleted file mode 100644 index dd464712..00000000 --- a/.dfx/local/canisters/internet-identity/constructor.did +++ /dev/null @@ -1,620 +0,0 @@ -type UserNumber = nat64; -type PublicKey = blob; -type CredentialId = blob; -type DeviceKey = PublicKey; -type UserKey = PublicKey; -type SessionKey = PublicKey; -type FrontendHostname = text; -type Timestamp = nat64; - -type HeaderField = record { - text; - text; -}; - -type HttpRequest = record { - method: text; - url: text; - headers: vec HeaderField; - body: blob; - certificate_version: opt nat16; -}; - -type HttpResponse = record { - status_code: nat16; - headers: vec HeaderField; - body: blob; - upgrade : opt bool; - streaming_strategy: opt StreamingStrategy; -}; - -type StreamingCallbackHttpResponse = record { - body: blob; - token: opt Token; -}; - -type Token = record {}; - -type StreamingStrategy = variant { - Callback: record { - callback: func (Token) -> (StreamingCallbackHttpResponse) query; - token: Token; - }; -}; - -type Purpose = variant { - recovery; - authentication; -}; - -type KeyType = variant { - unknown; - platform; - cross_platform; - seed_phrase; - browser_storage_key; -}; - -// This describes whether a device is "protected" or not. -// When protected, a device can only be updated or removed if the -// user is authenticated with that very device. -type DeviceProtection = variant { - protected; - unprotected; -}; - -type Challenge = record { - png_base64: text; - challenge_key: ChallengeKey; -}; - -type DeviceData = record { - pubkey : DeviceKey; - alias : text; - credential_id : opt CredentialId; - purpose: Purpose; - key_type: KeyType; - protection: DeviceProtection; - origin: opt text; - // Metadata map for additional device information. - // - // Note: some fields above will be moved to the metadata map in the future. - // All field names of `DeviceData` (such as 'alias', 'origin, etc.) are - // reserved and cannot be written. - // In addition, the keys "usage" and "authenticator_attachment" are reserved as well. - metadata: opt MetadataMap; -}; - -// The same as `DeviceData` but with the `last_usage` field. -// This field cannot be written, hence the separate type. -type DeviceWithUsage = record { - pubkey : DeviceKey; - alias : text; - credential_id : opt CredentialId; - purpose: Purpose; - key_type: KeyType; - protection: DeviceProtection; - origin: opt text; - last_usage: opt Timestamp; - metadata: opt MetadataMap; -}; - -// Map with some variants for the value type. -// Note, due to the Candid mapping this must be a tuple type thus we cannot name the fields `key` and `value`. -type MetadataMap = vec record { - text; - variant { map : MetadataMap; string : text; bytes : vec nat8 }; -}; - -type RegisterResponse = variant { - // A new user was successfully registered. - registered: record { - user_number: UserNumber; - }; - // No more registrations are possible in this instance of the II service canister. - canister_full; - // The challenge was not successful. - bad_challenge; -}; - -type AddTentativeDeviceResponse = variant { - // The device was tentatively added. - added_tentatively: record { - verification_code: text; - // Expiration date, in nanos since the epoch - device_registration_timeout: Timestamp; - }; - // Device registration mode is off, either due to timeout or because it was never enabled. - device_registration_mode_off; - // There is another device already added tentatively - another_device_tentatively_added; -}; - -type VerifyTentativeDeviceResponse = variant { - // The device was successfully verified. - verified; - // Wrong verification code entered. Retry with correct code. - wrong_code: record { - retries_left: nat8 - }; - // Device registration mode is off, either due to timeout or because it was never enabled. - device_registration_mode_off; - // There is no tentative device to be verified. - no_device_to_verify; -}; - -type Delegation = record { - pubkey: PublicKey; - expiration: Timestamp; - targets: opt vec principal; -}; - -type SignedDelegation = record { - delegation: Delegation; - signature: blob; -}; - -type GetDelegationResponse = variant { - // The signed delegation was successfully retrieved. - signed_delegation: SignedDelegation; - - // The signature is not ready. Maybe retry by calling `prepare_delegation` - no_such_delegation -}; - -type InternetIdentityStats = record { - users_registered: nat64; - storage_layout_version: nat8; - assigned_user_number_range: record { - nat64; - nat64; - }; - archive_info: ArchiveInfo; - canister_creation_cycles_cost: nat64; - max_num_latest_delegation_origins: nat64; - latest_delegation_origins: vec FrontendHostname -}; - -// Configuration parameters related to the archive. -type ArchiveConfig = record { - // The allowed module hash of the archive canister. - // Changing this parameter does _not_ deploy the archive, but enable archive deployments with the - // corresponding wasm module. - module_hash : blob; - // Buffered archive entries limit. If reached, II will stop accepting new anchor operations - // until the buffered operations are acknowledged by the archive. - entries_buffer_limit: nat64; - // The maximum number of entries to be transferred to the archive per call. - entries_fetch_limit: nat16; - // Polling interval to fetch new entries from II (in nanoseconds). - // Changes to this parameter will only take effect after an archive deployment. - polling_interval_ns: nat64; -}; - -// Information about the archive. -type ArchiveInfo = record { - // Canister id of the archive or empty if no archive has been deployed yet. - archive_canister : opt principal; - // Configuration parameters related to the II archive. - archive_config: opt ArchiveConfig; -}; - -// Rate limit configuration. -// Currently only used for `register`. -type RateLimitConfig = record { - // Time it takes (in ns) for a rate limiting token to be replenished. - time_per_token_ns : nat64; - // How many tokens are at most generated (to accommodate peaks). - max_tokens: nat64; -}; - -// Init arguments of II which can be supplied on install and upgrade. -// Setting a value to null keeps the previous value. -type InternetIdentityInit = record { - // Set lowest and highest anchor - assigned_user_number_range : opt record { - nat64; - nat64; - }; - // Configuration parameters related to the II archive. - // Note: some parameters changes (like the polling interval) will only take effect after an archive deployment. - // See ArchiveConfig for details. - archive_config: opt ArchiveConfig; - // Set the amounts of cycles sent with the create canister message. - // This is configurable because in the staging environment cycles are required. - // The canister creation cost on mainnet is currently 100'000'000'000 cycles. If this value is higher thant the - // canister creation cost, the newly created canister will keep extra cycles. - canister_creation_cycles_cost : opt nat64; - // Rate limit for the `register` call. - register_rate_limit : opt RateLimitConfig; - // Maximum number of latest delegation origins to track. - // Default: 1000 - max_num_latest_delegation_origins : opt nat64; - // Maximum number of inflight captchas. - // Default: 500 - max_inflight_captchas: opt nat64; -}; - -type ChallengeKey = text; - -type ChallengeResult = record { - key : ChallengeKey; - chars : text; -}; -type CaptchaResult = ChallengeResult; - -// Extra information about registration status for new devices -type DeviceRegistrationInfo = record { - // If present, the user has tentatively added a new device. This - // new device needs to be verified (see relevant endpoint) before - // 'expiration'. - tentative_device : opt DeviceData; - // The timestamp at which the anchor will turn off registration mode - // (and the tentative device will be forgotten, if any, and if not verified) - expiration: Timestamp; -}; - -// Information about the anchor -type IdentityAnchorInfo = record { - // All devices that can authenticate to this anchor - devices : vec DeviceWithUsage; - // Device registration status used when adding devices, see DeviceRegistrationInfo - device_registration: opt DeviceRegistrationInfo; -}; - -type AnchorCredentials = record { - credentials : vec WebAuthnCredential; - recovery_credentials : vec WebAuthnCredential; - recovery_phrases: vec PublicKey; -}; - -type WebAuthnCredential = record { - credential_id : CredentialId; - pubkey: PublicKey; -}; - -type DeployArchiveResult = variant { - // The archive was deployed successfully and the supplied wasm module has been installed. The principal of the archive - // canister is returned. - success: principal; - // Initial archive creation is already in progress. - creation_in_progress; - // Archive deployment failed. An error description is returned. - failed: text; -}; - -type BufferedArchiveEntry = record { - anchor_number: UserNumber; - timestamp: Timestamp; - sequence_number: nat64; - entry: blob; -}; - -// API V2 specific types -// WARNING: These type are experimental and may change in the future. - -type IdentityNumber = nat64; - -// Map with some variants for the value type. -// Note, due to the Candid mapping this must be a tuple type thus we cannot name the fields `key` and `value`. -type MetadataMapV2 = vec record { - text; - variant { Map : MetadataMapV2; String : text; Bytes : vec nat8 }; -}; - -// Authentication method using WebAuthn signatures -// See https://www.w3.org/TR/webauthn-2/ -// This is a separate type because WebAuthn requires to also store -// the credential id (in addition to the public key). -type WebAuthn = record { - credential_id: CredentialId; - pubkey: PublicKey; -}; - -// Authentication method using generic signatures -// See https://internetcomputer.org/docs/current/references/ic-interface-spec/#signatures for -// supported signature schemes. -type PublicKeyAuthn = record { - pubkey: PublicKey; -}; - -// The authentication methods currently supported by II. -type AuthnMethod = variant { - WebAuthn: WebAuthn; - PubKey: PublicKeyAuthn; -}; - -// This describes whether an authentication method is "protected" or not. -// When protected, a authentication method can only be updated or removed if the -// user is authenticated with that very authentication method. -type AuthnMethodProtection = variant { - Protected; - Unprotected; -}; - -type AuthnMethodPurpose = variant { - Recovery; - Authentication; -}; - -type AuthnMethodSecuritySettings = record { - protection: AuthnMethodProtection; - purpose: AuthnMethodPurpose; -}; - -type AuthnMethodData = record { - authn_method: AuthnMethod; - security_settings: AuthnMethodSecuritySettings; - // contains the following fields of the DeviceWithUsage type: - // - alias - // - origin - // - authenticator_attachment: data taken from key_type and reduced to "platform", "cross_platform" or absent on migration - // - usage: data taken from key_type and reduced to "recovery_phrase", "browser_storage_key" or absent on migration - // Note: for compatibility reasons with the v1 API, the entries above (if present) - // must be of the `String` variant. This restriction may be lifted in the future. - metadata: MetadataMapV2; - last_authentication: opt Timestamp; -}; - -// Extra information about registration status for new authentication methods -type AuthnMethodRegistrationInfo = record { - // If present, the user has registered a new authentication method. This - // new authentication needs to be verified before 'expiration' in order to - // be added to the identity. - authn_method : opt AuthnMethodData; - // The timestamp at which the identity will turn off registration mode - // (and the authentication method will be forgotten, if any, and if not verified) - expiration: Timestamp; -}; - -type AuthnMethodConfirmationCode = record { - confirmation_code: text; - expiration: Timestamp; -}; - -type AuthnMethodRegisterError = variant { - // Authentication method registration mode is off, either due to timeout or because it was never enabled. - RegistrationModeOff; - // There is another authentication method already registered that needs to be confirmed first. - RegistrationAlreadyInProgress; - // The metadata of the provided authentication method contains invalid entries. - InvalidMetadata: text; -}; - -type AuthnMethodConfirmationError = variant { - // Wrong confirmation code entered. Retry with correct code. - WrongCode: record { - retries_left: nat8 - }; - // Authentication method registration mode is off, either due to timeout or because it was never enabled. - RegistrationModeOff; - // There is no registered authentication method to be confirmed. - NoAuthnMethodToConfirm; -}; - -type IdentityAuthnInfo = record { - authn_methods: vec AuthnMethod; - recovery_authn_methods: vec AuthnMethod; -}; - -type IdentityInfo = record { - authn_methods: vec AuthnMethodData; - authn_method_registration: opt AuthnMethodRegistrationInfo; - // Authentication method independent metadata - metadata: MetadataMapV2; -}; - -type IdentityInfoError = variant { - /// The principal is not authorized to call this method with the given arguments. - Unauthorized: principal; - /// Internal canister error. See the error message for details. - InternalCanisterError: text; -}; - - - -type IdentityRegisterError = variant { - // No more registrations are possible in this instance of the II service canister. - CanisterFull; - // The captcha check was not successful. - BadCaptcha; - // The metadata of the provided authentication method contains invalid entries. - InvalidMetadata: text; -}; - -type AuthnMethodAddError = variant { - InvalidMetadata: text; -}; - -type AuthnMethodReplaceError = variant { - InvalidMetadata: text; - // No authentication method found with the given public key. - AuthnMethodNotFound; -}; - -type AuthnMethodMetadataReplaceError = variant { - InvalidMetadata: text; - /// No authentication method found with the given public key. - AuthnMethodNotFound; -}; - -type AuthnMethodSecuritySettingsReplaceError = variant { - /// No authentication method found with the given public key. - AuthnMethodNotFound; -}; - -type IdentityMetadataReplaceError = variant { - /// The principal is not authorized to call this method with the given arguments. - Unauthorized: principal; - /// The identity including the new metadata exceeds the maximum allowed size. - StorageSpaceExceeded: record {space_available: nat64; space_required: nat64}; - /// Internal canister error. See the error message for details. - InternalCanisterError: text; -}; - -type PrepareIdAliasRequest = record { - /// Origin of the issuer in the attribute sharing flow. - issuer : FrontendHostname; - /// Origin of the relying party in the attribute sharing flow. - relying_party : FrontendHostname; - /// Identity for which the IdAlias should be generated. - identity_number : IdentityNumber; -}; - -type PrepareIdAliasError = variant { - /// The principal is not authorized to call this method with the given arguments. - Unauthorized: principal; - /// Internal canister error. See the error message for details. - InternalCanisterError: text; -}; - -/// The prepared id alias contains two (still unsigned) credentials in JWT format, -/// certifying the id alias for the issuer resp. the relying party. -type PreparedIdAlias = record { - rp_id_alias_jwt : text; - issuer_id_alias_jwt : text; - canister_sig_pk_der : PublicKey; -}; - -/// The request to retrieve the actual signed id alias credentials. -/// The field values should be equal to the values of corresponding -/// fields from the preceding `PrepareIdAliasRequest` and `PrepareIdAliasResponse`. -type GetIdAliasRequest = record { - rp_id_alias_jwt : text; - issuer : FrontendHostname; - issuer_id_alias_jwt : text; - relying_party : FrontendHostname; - identity_number : IdentityNumber; -}; - -type GetIdAliasError = variant { - /// The principal is not authorized to call this method with the given arguments. - Unauthorized: principal; - /// The credential(s) are not available: may be expired or not prepared yet (call prepare_id_alias to prepare). - NoSuchCredentials : text; - /// Internal canister error. See the error message for details. - InternalCanisterError: text; -}; - -/// The signed id alias credentials for each involved party. -type IdAliasCredentials = record { - rp_id_alias_credential : SignedIdAlias; - issuer_id_alias_credential : SignedIdAlias; -}; - -type SignedIdAlias = record { - credential_jws : text; - id_alias : principal; - id_dapp : principal; -}; - -service : (opt InternetIdentityInit) -> { - init_salt: () -> (); - create_challenge : () -> (Challenge); - register : (DeviceData, ChallengeResult, opt principal) -> (RegisterResponse); - add : (UserNumber, DeviceData) -> (); - update : (UserNumber, DeviceKey, DeviceData) -> (); - // Atomically replace device matching the device key with the new device data - replace : (UserNumber, DeviceKey, DeviceData) -> (); - remove : (UserNumber, DeviceKey) -> (); - // Returns all devices of the user (authentication and recovery) but no information about device registrations. - // Note: Clears out the 'alias' fields on the devices. Use 'get_anchor_info' to obtain the full information. - // Deprecated: Use 'get_anchor_credentials' instead. - lookup : (UserNumber) -> (vec DeviceData) query; - get_anchor_credentials : (UserNumber) -> (AnchorCredentials) query; - get_anchor_info : (UserNumber) -> (IdentityAnchorInfo); - get_principal : (UserNumber, FrontendHostname) -> (principal) query; - stats : () -> (InternetIdentityStats) query; - - enter_device_registration_mode : (UserNumber) -> (Timestamp); - exit_device_registration_mode : (UserNumber) -> (); - add_tentative_device : (UserNumber, DeviceData) -> (AddTentativeDeviceResponse); - verify_tentative_device : (UserNumber, verification_code: text) -> (VerifyTentativeDeviceResponse); - - prepare_delegation : (UserNumber, FrontendHostname, SessionKey, maxTimeToLive : opt nat64) -> (UserKey, Timestamp); - get_delegation: (UserNumber, FrontendHostname, SessionKey, Timestamp) -> (GetDelegationResponse) query; - - http_request: (request: HttpRequest) -> (HttpResponse) query; - http_request_update: (request: HttpRequest) -> (HttpResponse); - - deploy_archive: (wasm: blob) -> (DeployArchiveResult); - /// Returns a batch of entries _sorted by sequence number_ to be archived. - /// This is an update call because the archive information _must_ be certified. - /// Only callable by this IIs archive canister. - fetch_entries: () -> (vec BufferedArchiveEntry); - acknowledge_entries: (sequence_number: nat64) -> (); - - // V2 API - // WARNING: The following methods are experimental and may change in the future. - - // Creates a new captcha. The solution needs to be submitted using the - // `identity_register` call. - captcha_create: () -> (variant {Ok: Challenge; Err;}); - - // Registers a new identity with the given authn_method. - // A valid captcha solution to a previously generated captcha (using create_captcha) must be provided. - // The sender needs to match the supplied authn_method. - identity_register: (AuthnMethodData, CaptchaResult, opt principal) -> (variant {Ok: IdentityNumber; Err: IdentityRegisterError;}); - - // Returns information about the authentication methods of the identity with the given number. - // Only returns the minimal information required for authentication without exposing any metadata such as aliases. - identity_authn_info: (IdentityNumber) -> (variant {Ok: IdentityAuthnInfo; Err;}) query; - - // Returns information about the identity with the given number. - // Requires authentication. - identity_info: (IdentityNumber) -> (variant {Ok: IdentityInfo; Err: IdentityInfoError;}); - - // Replaces the authentication method independent metadata map. - // The existing metadata map will be overwritten. - // Requires authentication. - identity_metadata_replace: (IdentityNumber, MetadataMapV2) -> (variant {Ok; Err: IdentityMetadataReplaceError;}); - - // Adds a new authentication method to the identity. - // Requires authentication. - authn_method_add: (IdentityNumber, AuthnMethodData) -> (variant {Ok; Err: AuthnMethodAddError;}); - - // Atomically replaces the authentication method matching the supplied public key with the new authentication method - // provided. - // Requires authentication. - authn_method_replace: (IdentityNumber, PublicKey, AuthnMethodData) -> (variant {Ok; Err: AuthnMethodReplaceError;}); - - // Replaces the authentication method metadata map. - // The existing metadata map will be overwritten. - // Requires authentication. - authn_method_metadata_replace: (IdentityNumber, PublicKey, MetadataMapV2) -> (variant {Ok; Err: AuthnMethodMetadataReplaceError;}); - - // Replaces the authentication method security settings. - // The existing security settings will be overwritten. - // Requires authentication. - authn_method_security_settings_replace: (IdentityNumber, PublicKey, AuthnMethodSecuritySettings) -> (variant {Ok; Err: AuthnMethodSecuritySettingsReplaceError;}); - - // Removes the authentication method associated with the public key from the identity. - // Requires authentication. - authn_method_remove: (IdentityNumber, PublicKey) -> (variant {Ok; Err;}); - - // Enters the authentication method registration mode for the identity. - // In this mode, a new authentication method can be registered, which then needs to be - // confirmed before it can be used for authentication on this identity. - // The registration mode is automatically exited after the returned expiration timestamp. - // Requires authentication. - authn_method_registration_mode_enter : (IdentityNumber) -> (variant {Ok: record { expiration: Timestamp; }; Err;}); - - // Exits the authentication method registration mode for the identity. - // Requires authentication. - authn_method_registration_mode_exit : (IdentityNumber) -> (variant {Ok; Err;}); - - // Registers a new authentication method to the identity. - // This authentication method needs to be confirmed before it can be used for authentication on this identity. - authn_method_register: (IdentityNumber, AuthnMethodData) -> (variant {Ok: AuthnMethodConfirmationCode; Err: AuthnMethodRegisterError;}); - - // Confirms a previously registered authentication method. - // On successful confirmation, the authentication method is permanently added to the identity and can - // subsequently be used for authentication for that identity. - // Requires authentication. - authn_method_confirm: (IdentityNumber, confirmation_code: text) -> (variant {Ok; Err: AuthnMethodConfirmationError;}); - - // Attribute Sharing MVP API - // The methods below are used to generate ID-alias credentials during attribute sharing flow. - prepare_id_alias : (PrepareIdAliasRequest) -> (variant {Ok: PreparedIdAlias; Err: PrepareIdAliasError;}); - get_id_alias : (GetIdAliasRequest) -> (variant {Ok: IdAliasCredentials; Err: GetIdAliasError;}) query; -} diff --git a/.dfx/local/canisters/internet-identity/index.js b/.dfx/local/canisters/internet-identity/index.js deleted file mode 100644 index 36bb4de6..00000000 --- a/.dfx/local/canisters/internet-identity/index.js +++ /dev/null @@ -1,42 +0,0 @@ -import { Actor, HttpAgent } from "@dfinity/agent"; - -// Imports and re-exports candid interface -import { idlFactory } from './internet-identity.did.js'; -export { idlFactory } from './internet-identity.did.js'; -// CANISTER_ID is replaced by webpack based on node environment -export const canisterId = process.env.INTERNET-IDENTITY_CANISTER_ID; - -/** - * @deprecated since dfx 0.11.1 - * Do not import from `.dfx`, instead switch to using `dfx generate` to generate your JS interface. - * @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent - * @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options] - * @return {import("@dfinity/agent").ActorSubclass} - */ -export const createActor = (canisterId, options = {}) => { - console.warn(`Deprecation warning: you are currently importing code from .dfx. Going forward, refactor to use the dfx generate command for JavaScript bindings. - -See https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/ for migration instructions`); - const agent = options.agent || new HttpAgent({ ...options.agentOptions }); - - // Fetch root key for certificate validation during development - if (process.env.DFX_NETWORK !== "ic") { - agent.fetchRootKey().catch(err => { - console.warn("Unable to fetch root key. Check to ensure that your local replica is running"); - console.error(err); - }); - } - - // Creates an actor with using the candid interface and the HttpAgent - return Actor.createActor(idlFactory, { - agent, - canisterId, - ...(options ? options.actorOptions : {}), - }); -}; - -/** - * A ready-to-use agent for the internet-identity canister - * @type {import("@dfinity/agent").ActorSubclass} - */ -export const internet-identity = createActor(canisterId); diff --git a/.dfx/local/canisters/internet-identity/init_args.txt b/.dfx/local/canisters/internet-identity/init_args.txt deleted file mode 100644 index ff08b423..00000000 --- a/.dfx/local/canisters/internet-identity/init_args.txt +++ /dev/null @@ -1 +0,0 @@ -(opt InternetIdentityInit) \ No newline at end of file diff --git a/.dfx/local/canisters/internet-identity/service.did b/.dfx/local/canisters/internet-identity/service.did deleted file mode 100644 index fd53d49c..00000000 --- a/.dfx/local/canisters/internet-identity/service.did +++ /dev/null @@ -1,356 +0,0 @@ -type AddTentativeDeviceResponse = variant { - device_registration_mode_off; - another_device_tentatively_added; - added_tentatively : record { - verification_code : text; - device_registration_timeout : Timestamp; - }; -}; -type AnchorCredentials = record { - recovery_phrases : vec PublicKey; - credentials : vec WebAuthnCredential; - recovery_credentials : vec WebAuthnCredential; -}; -type ArchiveConfig = record { - polling_interval_ns : nat64; - entries_buffer_limit : nat64; - module_hash : vec nat8; - entries_fetch_limit : nat16; -}; -type ArchiveInfo = record { - archive_config : opt ArchiveConfig; - archive_canister : opt principal; -}; -type AuthnMethod = variant { PubKey : PublicKeyAuthn; WebAuthn : WebAuthn }; -type AuthnMethodAddError = variant { InvalidMetadata : text }; -type AuthnMethodConfirmationCode = record { - confirmation_code : text; - expiration : Timestamp; -}; -type AuthnMethodConfirmationError = variant { - RegistrationModeOff; - NoAuthnMethodToConfirm; - WrongCode : record { retries_left : nat8 }; -}; -type AuthnMethodData = record { - security_settings : AuthnMethodSecuritySettings; - metadata : MetadataMapV2; - last_authentication : opt Timestamp; - authn_method : AuthnMethod; -}; -type AuthnMethodMetadataReplaceError = variant { - AuthnMethodNotFound; - InvalidMetadata : text; -}; -type AuthnMethodProtection = variant { Protected; Unprotected }; -type AuthnMethodPurpose = variant { Recovery; Authentication }; -type AuthnMethodRegisterError = variant { - RegistrationModeOff; - RegistrationAlreadyInProgress; - InvalidMetadata : text; -}; -type AuthnMethodRegistrationInfo = record { - expiration : Timestamp; - authn_method : opt AuthnMethodData; -}; -type AuthnMethodReplaceError = variant { - AuthnMethodNotFound; - InvalidMetadata : text; -}; -type AuthnMethodSecuritySettings = record { - protection : AuthnMethodProtection; - purpose : AuthnMethodPurpose; -}; -type AuthnMethodSecuritySettingsReplaceError = variant { AuthnMethodNotFound }; -type BufferedArchiveEntry = record { - sequence_number : nat64; - entry : vec nat8; - anchor_number : UserNumber; - timestamp : Timestamp; -}; -type CaptchaResult = ChallengeResult; -type Challenge = record { png_base64 : text; challenge_key : ChallengeKey }; -type ChallengeKey = text; -type ChallengeResult = record { key : ChallengeKey; chars : text }; -type CredentialId = vec nat8; -type Delegation = record { - pubkey : PublicKey; - targets : opt vec principal; - expiration : Timestamp; -}; -type DeployArchiveResult = variant { - creation_in_progress; - success : principal; - failed : text; -}; -type DeviceData = record { - alias : text; - metadata : opt MetadataMap; - origin : opt text; - protection : DeviceProtection; - pubkey : DeviceKey; - key_type : KeyType; - purpose : Purpose; - credential_id : opt CredentialId; -}; -type DeviceKey = PublicKey; -type DeviceProtection = variant { unprotected; protected }; -type DeviceRegistrationInfo = record { - tentative_device : opt DeviceData; - expiration : Timestamp; -}; -type DeviceWithUsage = record { - alias : text; - last_usage : opt Timestamp; - metadata : opt MetadataMap; - origin : opt text; - protection : DeviceProtection; - pubkey : DeviceKey; - key_type : KeyType; - purpose : Purpose; - credential_id : opt CredentialId; -}; -type FrontendHostname = text; -type GetDelegationResponse = variant { - no_such_delegation; - signed_delegation : SignedDelegation; -}; -type GetIdAliasError = variant { - InternalCanisterError : text; - Unauthorized : principal; - NoSuchCredentials : text; -}; -type GetIdAliasRequest = record { - rp_id_alias_jwt : text; - issuer : FrontendHostname; - issuer_id_alias_jwt : text; - relying_party : FrontendHostname; - identity_number : IdentityNumber; -}; -type HeaderField = record { text; text }; -type HttpRequest = record { - url : text; - method : text; - body : vec nat8; - headers : vec HeaderField; - certificate_version : opt nat16; -}; -type HttpResponse = record { - body : vec nat8; - headers : vec HeaderField; - upgrade : opt bool; - streaming_strategy : opt StreamingStrategy; - status_code : nat16; -}; -type IdAliasCredentials = record { - rp_id_alias_credential : SignedIdAlias; - issuer_id_alias_credential : SignedIdAlias; -}; -type IdentityAnchorInfo = record { - devices : vec DeviceWithUsage; - device_registration : opt DeviceRegistrationInfo; -}; -type IdentityAuthnInfo = record { - authn_methods : vec AuthnMethod; - recovery_authn_methods : vec AuthnMethod; -}; -type IdentityInfo = record { - authn_methods : vec AuthnMethodData; - metadata : MetadataMapV2; - authn_method_registration : opt AuthnMethodRegistrationInfo; -}; -type IdentityInfoError = variant { - InternalCanisterError : text; - Unauthorized : principal; -}; -type IdentityMetadataReplaceError = variant { - InternalCanisterError : text; - Unauthorized : principal; - StorageSpaceExceeded : record { - space_required : nat64; - space_available : nat64; - }; -}; -type IdentityNumber = nat64; -type IdentityRegisterError = variant { - BadCaptcha; - CanisterFull; - InvalidMetadata : text; -}; -type InternetIdentityInit = record { - max_num_latest_delegation_origins : opt nat64; - assigned_user_number_range : opt record { nat64; nat64 }; - max_inflight_captchas : opt nat64; - archive_config : opt ArchiveConfig; - canister_creation_cycles_cost : opt nat64; - register_rate_limit : opt RateLimitConfig; -}; -type InternetIdentityStats = record { - storage_layout_version : nat8; - users_registered : nat64; - max_num_latest_delegation_origins : nat64; - assigned_user_number_range : record { nat64; nat64 }; - latest_delegation_origins : vec FrontendHostname; - archive_info : ArchiveInfo; - canister_creation_cycles_cost : nat64; -}; -type KeyType = variant { - platform; - seed_phrase; - cross_platform; - unknown; - browser_storage_key; -}; -type MetadataMap = vec record { - text; - variant { map : MetadataMap; string : text; bytes : vec nat8 }; -}; -type MetadataMapV2 = vec record { - text; - variant { Map : MetadataMapV2; String : text; Bytes : vec nat8 }; -}; -type PrepareIdAliasError = variant { - InternalCanisterError : text; - Unauthorized : principal; -}; -type PrepareIdAliasRequest = record { - issuer : FrontendHostname; - relying_party : FrontendHostname; - identity_number : IdentityNumber; -}; -type PreparedIdAlias = record { - rp_id_alias_jwt : text; - issuer_id_alias_jwt : text; - canister_sig_pk_der : PublicKey; -}; -type PublicKey = vec nat8; -type PublicKeyAuthn = record { pubkey : PublicKey }; -type Purpose = variant { authentication; recovery }; -type RateLimitConfig = record { max_tokens : nat64; time_per_token_ns : nat64 }; -type RegisterResponse = variant { - bad_challenge; - canister_full; - registered : record { user_number : UserNumber }; -}; -type SessionKey = PublicKey; -type SignedDelegation = record { - signature : vec nat8; - delegation : Delegation; -}; -type SignedIdAlias = record { - credential_jws : text; - id_alias : principal; - id_dapp : principal; -}; -type StreamingCallbackHttpResponse = record { - token : opt Token; - body : vec nat8; -}; -type StreamingStrategy = variant { - Callback : record { - token : Token; - callback : func (Token) -> (StreamingCallbackHttpResponse) query; - }; -}; -type Timestamp = nat64; -type Token = record {}; -type UserKey = PublicKey; -type UserNumber = nat64; -type VerifyTentativeDeviceResponse = variant { - device_registration_mode_off; - verified; - wrong_code : record { retries_left : nat8 }; - no_device_to_verify; -}; -type WebAuthn = record { pubkey : PublicKey; credential_id : CredentialId }; -type WebAuthnCredential = record { - pubkey : PublicKey; - credential_id : CredentialId; -}; -service : { - acknowledge_entries : (nat64) -> (); - add : (UserNumber, DeviceData) -> (); - add_tentative_device : (UserNumber, DeviceData) -> ( - AddTentativeDeviceResponse, - ); - authn_method_add : (IdentityNumber, AuthnMethodData) -> ( - variant { Ok; Err : AuthnMethodAddError }, - ); - authn_method_confirm : (IdentityNumber, text) -> ( - variant { Ok; Err : AuthnMethodConfirmationError }, - ); - authn_method_metadata_replace : ( - IdentityNumber, - PublicKey, - MetadataMapV2, - ) -> (variant { Ok; Err : AuthnMethodMetadataReplaceError }); - authn_method_register : (IdentityNumber, AuthnMethodData) -> ( - variant { - Ok : AuthnMethodConfirmationCode; - Err : AuthnMethodRegisterError; - }, - ); - authn_method_registration_mode_enter : (IdentityNumber) -> ( - variant { Ok : record { expiration : Timestamp }; Err }, - ); - authn_method_registration_mode_exit : (IdentityNumber) -> ( - variant { Ok; Err }, - ); - authn_method_remove : (IdentityNumber, PublicKey) -> (variant { Ok; Err }); - authn_method_replace : (IdentityNumber, PublicKey, AuthnMethodData) -> ( - variant { Ok; Err : AuthnMethodReplaceError }, - ); - authn_method_security_settings_replace : ( - IdentityNumber, - PublicKey, - AuthnMethodSecuritySettings, - ) -> (variant { Ok; Err : AuthnMethodSecuritySettingsReplaceError }); - captcha_create : () -> (variant { Ok : Challenge; Err }); - create_challenge : () -> (Challenge); - deploy_archive : (vec nat8) -> (DeployArchiveResult); - enter_device_registration_mode : (UserNumber) -> (Timestamp); - exit_device_registration_mode : (UserNumber) -> (); - fetch_entries : () -> (vec BufferedArchiveEntry); - get_anchor_credentials : (UserNumber) -> (AnchorCredentials) query; - get_anchor_info : (UserNumber) -> (IdentityAnchorInfo); - get_delegation : (UserNumber, FrontendHostname, SessionKey, Timestamp) -> ( - GetDelegationResponse, - ) query; - get_id_alias : (GetIdAliasRequest) -> ( - variant { Ok : IdAliasCredentials; Err : GetIdAliasError }, - ) query; - get_principal : (UserNumber, FrontendHostname) -> (principal) query; - http_request : (HttpRequest) -> (HttpResponse) query; - http_request_update : (HttpRequest) -> (HttpResponse); - identity_authn_info : (IdentityNumber) -> ( - variant { Ok : IdentityAuthnInfo; Err }, - ) query; - identity_info : (IdentityNumber) -> ( - variant { Ok : IdentityInfo; Err : IdentityInfoError }, - ); - identity_metadata_replace : (IdentityNumber, MetadataMapV2) -> ( - variant { Ok; Err : IdentityMetadataReplaceError }, - ); - identity_register : (AuthnMethodData, CaptchaResult, opt principal) -> ( - variant { Ok : IdentityNumber; Err : IdentityRegisterError }, - ); - init_salt : () -> (); - lookup : (UserNumber) -> (vec DeviceData) query; - prepare_delegation : ( - UserNumber, - FrontendHostname, - SessionKey, - opt nat64, - ) -> (UserKey, Timestamp); - prepare_id_alias : (PrepareIdAliasRequest) -> ( - variant { Ok : PreparedIdAlias; Err : PrepareIdAliasError }, - ); - register : (DeviceData, ChallengeResult, opt principal) -> (RegisterResponse); - remove : (UserNumber, DeviceKey) -> (); - replace : (UserNumber, DeviceKey, DeviceData) -> (); - stats : () -> (InternetIdentityStats) query; - update : (UserNumber, DeviceKey, DeviceData) -> (); - verify_tentative_device : (UserNumber, text) -> ( - VerifyTentativeDeviceResponse, - ); -} \ No newline at end of file diff --git a/.dfx/local/canisters/internet-identity/service.did.d.ts b/.dfx/local/canisters/internet-identity/service.did.d.ts deleted file mode 100644 index 976016ba..00000000 --- a/.dfx/local/canisters/internet-identity/service.did.d.ts +++ /dev/null @@ -1,389 +0,0 @@ -import type { Principal } from '@dfinity/principal'; -import type { ActorMethod } from '@dfinity/agent'; - -export type AddTentativeDeviceResponse = { - 'device_registration_mode_off' : null - } | - { 'another_device_tentatively_added' : null } | - { - 'added_tentatively' : { - 'verification_code' : string, - 'device_registration_timeout' : Timestamp, - } - }; -export interface AnchorCredentials { - 'recovery_phrases' : Array, - 'credentials' : Array, - 'recovery_credentials' : Array, -} -export interface ArchiveConfig { - 'polling_interval_ns' : bigint, - 'entries_buffer_limit' : bigint, - 'module_hash' : Uint8Array | number[], - 'entries_fetch_limit' : number, -} -export interface ArchiveInfo { - 'archive_config' : [] | [ArchiveConfig], - 'archive_canister' : [] | [Principal], -} -export type AuthnMethod = { 'PubKey' : PublicKeyAuthn } | - { 'WebAuthn' : WebAuthn }; -export type AuthnMethodAddError = { 'InvalidMetadata' : string }; -export interface AuthnMethodConfirmationCode { - 'confirmation_code' : string, - 'expiration' : Timestamp, -} -export type AuthnMethodConfirmationError = { 'RegistrationModeOff' : null } | - { 'NoAuthnMethodToConfirm' : null } | - { 'WrongCode' : { 'retries_left' : number } }; -export interface AuthnMethodData { - 'security_settings' : AuthnMethodSecuritySettings, - 'metadata' : MetadataMapV2, - 'last_authentication' : [] | [Timestamp], - 'authn_method' : AuthnMethod, -} -export type AuthnMethodMetadataReplaceError = { 'AuthnMethodNotFound' : null } | - { 'InvalidMetadata' : string }; -export type AuthnMethodProtection = { 'Protected' : null } | - { 'Unprotected' : null }; -export type AuthnMethodPurpose = { 'Recovery' : null } | - { 'Authentication' : null }; -export type AuthnMethodRegisterError = { 'RegistrationModeOff' : null } | - { 'RegistrationAlreadyInProgress' : null } | - { 'InvalidMetadata' : string }; -export interface AuthnMethodRegistrationInfo { - 'expiration' : Timestamp, - 'authn_method' : [] | [AuthnMethodData], -} -export type AuthnMethodReplaceError = { 'AuthnMethodNotFound' : null } | - { 'InvalidMetadata' : string }; -export interface AuthnMethodSecuritySettings { - 'protection' : AuthnMethodProtection, - 'purpose' : AuthnMethodPurpose, -} -export type AuthnMethodSecuritySettingsReplaceError = { - 'AuthnMethodNotFound' : null - }; -export interface BufferedArchiveEntry { - 'sequence_number' : bigint, - 'entry' : Uint8Array | number[], - 'anchor_number' : UserNumber, - 'timestamp' : Timestamp, -} -export type CaptchaResult = ChallengeResult; -export interface Challenge { - 'png_base64' : string, - 'challenge_key' : ChallengeKey, -} -export type ChallengeKey = string; -export interface ChallengeResult { 'key' : ChallengeKey, 'chars' : string } -export type CredentialId = Uint8Array | number[]; -export interface Delegation { - 'pubkey' : PublicKey, - 'targets' : [] | [Array], - 'expiration' : Timestamp, -} -export type DeployArchiveResult = { 'creation_in_progress' : null } | - { 'success' : Principal } | - { 'failed' : string }; -export interface DeviceData { - 'alias' : string, - 'metadata' : [] | [MetadataMap], - 'origin' : [] | [string], - 'protection' : DeviceProtection, - 'pubkey' : DeviceKey, - 'key_type' : KeyType, - 'purpose' : Purpose, - 'credential_id' : [] | [CredentialId], -} -export type DeviceKey = PublicKey; -export type DeviceProtection = { 'unprotected' : null } | - { 'protected' : null }; -export interface DeviceRegistrationInfo { - 'tentative_device' : [] | [DeviceData], - 'expiration' : Timestamp, -} -export interface DeviceWithUsage { - 'alias' : string, - 'last_usage' : [] | [Timestamp], - 'metadata' : [] | [MetadataMap], - 'origin' : [] | [string], - 'protection' : DeviceProtection, - 'pubkey' : DeviceKey, - 'key_type' : KeyType, - 'purpose' : Purpose, - 'credential_id' : [] | [CredentialId], -} -export type FrontendHostname = string; -export type GetDelegationResponse = { 'no_such_delegation' : null } | - { 'signed_delegation' : SignedDelegation }; -export type GetIdAliasError = { 'InternalCanisterError' : string } | - { 'Unauthorized' : Principal } | - { 'NoSuchCredentials' : string }; -export interface GetIdAliasRequest { - 'rp_id_alias_jwt' : string, - 'issuer' : FrontendHostname, - 'issuer_id_alias_jwt' : string, - 'relying_party' : FrontendHostname, - 'identity_number' : IdentityNumber, -} -export type HeaderField = [string, string]; -export interface HttpRequest { - 'url' : string, - 'method' : string, - 'body' : Uint8Array | number[], - 'headers' : Array, - 'certificate_version' : [] | [number], -} -export interface HttpResponse { - 'body' : Uint8Array | number[], - 'headers' : Array, - 'upgrade' : [] | [boolean], - 'streaming_strategy' : [] | [StreamingStrategy], - 'status_code' : number, -} -export interface IdAliasCredentials { - 'rp_id_alias_credential' : SignedIdAlias, - 'issuer_id_alias_credential' : SignedIdAlias, -} -export interface IdentityAnchorInfo { - 'devices' : Array, - 'device_registration' : [] | [DeviceRegistrationInfo], -} -export interface IdentityAuthnInfo { - 'authn_methods' : Array, - 'recovery_authn_methods' : Array, -} -export interface IdentityInfo { - 'authn_methods' : Array, - 'metadata' : MetadataMapV2, - 'authn_method_registration' : [] | [AuthnMethodRegistrationInfo], -} -export type IdentityInfoError = { 'InternalCanisterError' : string } | - { 'Unauthorized' : Principal }; -export type IdentityMetadataReplaceError = { - 'InternalCanisterError' : string - } | - { 'Unauthorized' : Principal } | - { - 'StorageSpaceExceeded' : { - 'space_required' : bigint, - 'space_available' : bigint, - } - }; -export type IdentityNumber = bigint; -export type IdentityRegisterError = { 'BadCaptcha' : null } | - { 'CanisterFull' : null } | - { 'InvalidMetadata' : string }; -export interface InternetIdentityInit { - 'max_num_latest_delegation_origins' : [] | [bigint], - 'assigned_user_number_range' : [] | [[bigint, bigint]], - 'max_inflight_captchas' : [] | [bigint], - 'archive_config' : [] | [ArchiveConfig], - 'canister_creation_cycles_cost' : [] | [bigint], - 'register_rate_limit' : [] | [RateLimitConfig], -} -export interface InternetIdentityStats { - 'storage_layout_version' : number, - 'users_registered' : bigint, - 'max_num_latest_delegation_origins' : bigint, - 'assigned_user_number_range' : [bigint, bigint], - 'latest_delegation_origins' : Array, - 'archive_info' : ArchiveInfo, - 'canister_creation_cycles_cost' : bigint, -} -export type KeyType = { 'platform' : null } | - { 'seed_phrase' : null } | - { 'cross_platform' : null } | - { 'unknown' : null } | - { 'browser_storage_key' : null }; -export type MetadataMap = Array< - [ - string, - { 'map' : MetadataMap } | - { 'string' : string } | - { 'bytes' : Uint8Array | number[] }, - ] ->; -export type MetadataMapV2 = Array< - [ - string, - { 'Map' : MetadataMapV2 } | - { 'String' : string } | - { 'Bytes' : Uint8Array | number[] }, - ] ->; -export type PrepareIdAliasError = { 'InternalCanisterError' : string } | - { 'Unauthorized' : Principal }; -export interface PrepareIdAliasRequest { - 'issuer' : FrontendHostname, - 'relying_party' : FrontendHostname, - 'identity_number' : IdentityNumber, -} -export interface PreparedIdAlias { - 'rp_id_alias_jwt' : string, - 'issuer_id_alias_jwt' : string, - 'canister_sig_pk_der' : PublicKey, -} -export type PublicKey = Uint8Array | number[]; -export interface PublicKeyAuthn { 'pubkey' : PublicKey } -export type Purpose = { 'authentication' : null } | - { 'recovery' : null }; -export interface RateLimitConfig { - 'max_tokens' : bigint, - 'time_per_token_ns' : bigint, -} -export type RegisterResponse = { 'bad_challenge' : null } | - { 'canister_full' : null } | - { 'registered' : { 'user_number' : UserNumber } }; -export type SessionKey = PublicKey; -export interface SignedDelegation { - 'signature' : Uint8Array | number[], - 'delegation' : Delegation, -} -export interface SignedIdAlias { - 'credential_jws' : string, - 'id_alias' : Principal, - 'id_dapp' : Principal, -} -export interface StreamingCallbackHttpResponse { - 'token' : [] | [Token], - 'body' : Uint8Array | number[], -} -export type StreamingStrategy = { - 'Callback' : { 'token' : Token, 'callback' : [Principal, string] } - }; -export type Timestamp = bigint; -export type Token = {}; -export type UserKey = PublicKey; -export type UserNumber = bigint; -export type VerifyTentativeDeviceResponse = { - 'device_registration_mode_off' : null - } | - { 'verified' : null } | - { 'wrong_code' : { 'retries_left' : number } } | - { 'no_device_to_verify' : null }; -export interface WebAuthn { - 'pubkey' : PublicKey, - 'credential_id' : CredentialId, -} -export interface WebAuthnCredential { - 'pubkey' : PublicKey, - 'credential_id' : CredentialId, -} -export interface _SERVICE { - 'acknowledge_entries' : ActorMethod<[bigint], undefined>, - 'add' : ActorMethod<[UserNumber, DeviceData], undefined>, - 'add_tentative_device' : ActorMethod< - [UserNumber, DeviceData], - AddTentativeDeviceResponse - >, - 'authn_method_add' : ActorMethod< - [IdentityNumber, AuthnMethodData], - { 'Ok' : null } | - { 'Err' : AuthnMethodAddError } - >, - 'authn_method_confirm' : ActorMethod< - [IdentityNumber, string], - { 'Ok' : null } | - { 'Err' : AuthnMethodConfirmationError } - >, - 'authn_method_metadata_replace' : ActorMethod< - [IdentityNumber, PublicKey, MetadataMapV2], - { 'Ok' : null } | - { 'Err' : AuthnMethodMetadataReplaceError } - >, - 'authn_method_register' : ActorMethod< - [IdentityNumber, AuthnMethodData], - { 'Ok' : AuthnMethodConfirmationCode } | - { 'Err' : AuthnMethodRegisterError } - >, - 'authn_method_registration_mode_enter' : ActorMethod< - [IdentityNumber], - { 'Ok' : { 'expiration' : Timestamp } } | - { 'Err' : null } - >, - 'authn_method_registration_mode_exit' : ActorMethod< - [IdentityNumber], - { 'Ok' : null } | - { 'Err' : null } - >, - 'authn_method_remove' : ActorMethod< - [IdentityNumber, PublicKey], - { 'Ok' : null } | - { 'Err' : null } - >, - 'authn_method_replace' : ActorMethod< - [IdentityNumber, PublicKey, AuthnMethodData], - { 'Ok' : null } | - { 'Err' : AuthnMethodReplaceError } - >, - 'authn_method_security_settings_replace' : ActorMethod< - [IdentityNumber, PublicKey, AuthnMethodSecuritySettings], - { 'Ok' : null } | - { 'Err' : AuthnMethodSecuritySettingsReplaceError } - >, - 'captcha_create' : ActorMethod<[], { 'Ok' : Challenge } | { 'Err' : null }>, - 'create_challenge' : ActorMethod<[], Challenge>, - 'deploy_archive' : ActorMethod<[Uint8Array | number[]], DeployArchiveResult>, - 'enter_device_registration_mode' : ActorMethod<[UserNumber], Timestamp>, - 'exit_device_registration_mode' : ActorMethod<[UserNumber], undefined>, - 'fetch_entries' : ActorMethod<[], Array>, - 'get_anchor_credentials' : ActorMethod<[UserNumber], AnchorCredentials>, - 'get_anchor_info' : ActorMethod<[UserNumber], IdentityAnchorInfo>, - 'get_delegation' : ActorMethod< - [UserNumber, FrontendHostname, SessionKey, Timestamp], - GetDelegationResponse - >, - 'get_id_alias' : ActorMethod< - [GetIdAliasRequest], - { 'Ok' : IdAliasCredentials } | - { 'Err' : GetIdAliasError } - >, - 'get_principal' : ActorMethod<[UserNumber, FrontendHostname], Principal>, - 'http_request' : ActorMethod<[HttpRequest], HttpResponse>, - 'http_request_update' : ActorMethod<[HttpRequest], HttpResponse>, - 'identity_authn_info' : ActorMethod< - [IdentityNumber], - { 'Ok' : IdentityAuthnInfo } | - { 'Err' : null } - >, - 'identity_info' : ActorMethod< - [IdentityNumber], - { 'Ok' : IdentityInfo } | - { 'Err' : IdentityInfoError } - >, - 'identity_metadata_replace' : ActorMethod< - [IdentityNumber, MetadataMapV2], - { 'Ok' : null } | - { 'Err' : IdentityMetadataReplaceError } - >, - 'identity_register' : ActorMethod< - [AuthnMethodData, CaptchaResult, [] | [Principal]], - { 'Ok' : IdentityNumber } | - { 'Err' : IdentityRegisterError } - >, - 'init_salt' : ActorMethod<[], undefined>, - 'lookup' : ActorMethod<[UserNumber], Array>, - 'prepare_delegation' : ActorMethod< - [UserNumber, FrontendHostname, SessionKey, [] | [bigint]], - [UserKey, Timestamp] - >, - 'prepare_id_alias' : ActorMethod< - [PrepareIdAliasRequest], - { 'Ok' : PreparedIdAlias } | - { 'Err' : PrepareIdAliasError } - >, - 'register' : ActorMethod< - [DeviceData, ChallengeResult, [] | [Principal]], - RegisterResponse - >, - 'remove' : ActorMethod<[UserNumber, DeviceKey], undefined>, - 'replace' : ActorMethod<[UserNumber, DeviceKey, DeviceData], undefined>, - 'stats' : ActorMethod<[], InternetIdentityStats>, - 'update' : ActorMethod<[UserNumber, DeviceKey, DeviceData], undefined>, - 'verify_tentative_device' : ActorMethod< - [UserNumber, string], - VerifyTentativeDeviceResponse - >, -} diff --git a/.dfx/local/canisters/internet-identity/service.did.js b/.dfx/local/canisters/internet-identity/service.did.js deleted file mode 100644 index e92c6719..00000000 --- a/.dfx/local/canisters/internet-identity/service.did.js +++ /dev/null @@ -1,474 +0,0 @@ -export const idlFactory = ({ IDL }) => { - const MetadataMap = IDL.Rec(); - const MetadataMapV2 = IDL.Rec(); - const UserNumber = IDL.Nat64; - MetadataMap.fill( - IDL.Vec( - IDL.Tuple( - IDL.Text, - IDL.Variant({ - 'map' : MetadataMap, - 'string' : IDL.Text, - 'bytes' : IDL.Vec(IDL.Nat8), - }), - ) - ) - ); - const DeviceProtection = IDL.Variant({ - 'unprotected' : IDL.Null, - 'protected' : IDL.Null, - }); - const PublicKey = IDL.Vec(IDL.Nat8); - const DeviceKey = PublicKey; - const KeyType = IDL.Variant({ - 'platform' : IDL.Null, - 'seed_phrase' : IDL.Null, - 'cross_platform' : IDL.Null, - 'unknown' : IDL.Null, - 'browser_storage_key' : IDL.Null, - }); - const Purpose = IDL.Variant({ - 'authentication' : IDL.Null, - 'recovery' : IDL.Null, - }); - const CredentialId = IDL.Vec(IDL.Nat8); - const DeviceData = IDL.Record({ - 'alias' : IDL.Text, - 'metadata' : IDL.Opt(MetadataMap), - 'origin' : IDL.Opt(IDL.Text), - 'protection' : DeviceProtection, - 'pubkey' : DeviceKey, - 'key_type' : KeyType, - 'purpose' : Purpose, - 'credential_id' : IDL.Opt(CredentialId), - }); - const Timestamp = IDL.Nat64; - const AddTentativeDeviceResponse = IDL.Variant({ - 'device_registration_mode_off' : IDL.Null, - 'another_device_tentatively_added' : IDL.Null, - 'added_tentatively' : IDL.Record({ - 'verification_code' : IDL.Text, - 'device_registration_timeout' : Timestamp, - }), - }); - const IdentityNumber = IDL.Nat64; - const AuthnMethodProtection = IDL.Variant({ - 'Protected' : IDL.Null, - 'Unprotected' : IDL.Null, - }); - const AuthnMethodPurpose = IDL.Variant({ - 'Recovery' : IDL.Null, - 'Authentication' : IDL.Null, - }); - const AuthnMethodSecuritySettings = IDL.Record({ - 'protection' : AuthnMethodProtection, - 'purpose' : AuthnMethodPurpose, - }); - MetadataMapV2.fill( - IDL.Vec( - IDL.Tuple( - IDL.Text, - IDL.Variant({ - 'Map' : MetadataMapV2, - 'String' : IDL.Text, - 'Bytes' : IDL.Vec(IDL.Nat8), - }), - ) - ) - ); - const PublicKeyAuthn = IDL.Record({ 'pubkey' : PublicKey }); - const WebAuthn = IDL.Record({ - 'pubkey' : PublicKey, - 'credential_id' : CredentialId, - }); - const AuthnMethod = IDL.Variant({ - 'PubKey' : PublicKeyAuthn, - 'WebAuthn' : WebAuthn, - }); - const AuthnMethodData = IDL.Record({ - 'security_settings' : AuthnMethodSecuritySettings, - 'metadata' : MetadataMapV2, - 'last_authentication' : IDL.Opt(Timestamp), - 'authn_method' : AuthnMethod, - }); - const AuthnMethodAddError = IDL.Variant({ 'InvalidMetadata' : IDL.Text }); - const AuthnMethodConfirmationError = IDL.Variant({ - 'RegistrationModeOff' : IDL.Null, - 'NoAuthnMethodToConfirm' : IDL.Null, - 'WrongCode' : IDL.Record({ 'retries_left' : IDL.Nat8 }), - }); - const AuthnMethodMetadataReplaceError = IDL.Variant({ - 'AuthnMethodNotFound' : IDL.Null, - 'InvalidMetadata' : IDL.Text, - }); - const AuthnMethodConfirmationCode = IDL.Record({ - 'confirmation_code' : IDL.Text, - 'expiration' : Timestamp, - }); - const AuthnMethodRegisterError = IDL.Variant({ - 'RegistrationModeOff' : IDL.Null, - 'RegistrationAlreadyInProgress' : IDL.Null, - 'InvalidMetadata' : IDL.Text, - }); - const AuthnMethodReplaceError = IDL.Variant({ - 'AuthnMethodNotFound' : IDL.Null, - 'InvalidMetadata' : IDL.Text, - }); - const AuthnMethodSecuritySettingsReplaceError = IDL.Variant({ - 'AuthnMethodNotFound' : IDL.Null, - }); - const ChallengeKey = IDL.Text; - const Challenge = IDL.Record({ - 'png_base64' : IDL.Text, - 'challenge_key' : ChallengeKey, - }); - const DeployArchiveResult = IDL.Variant({ - 'creation_in_progress' : IDL.Null, - 'success' : IDL.Principal, - 'failed' : IDL.Text, - }); - const BufferedArchiveEntry = IDL.Record({ - 'sequence_number' : IDL.Nat64, - 'entry' : IDL.Vec(IDL.Nat8), - 'anchor_number' : UserNumber, - 'timestamp' : Timestamp, - }); - const WebAuthnCredential = IDL.Record({ - 'pubkey' : PublicKey, - 'credential_id' : CredentialId, - }); - const AnchorCredentials = IDL.Record({ - 'recovery_phrases' : IDL.Vec(PublicKey), - 'credentials' : IDL.Vec(WebAuthnCredential), - 'recovery_credentials' : IDL.Vec(WebAuthnCredential), - }); - const DeviceWithUsage = IDL.Record({ - 'alias' : IDL.Text, - 'last_usage' : IDL.Opt(Timestamp), - 'metadata' : IDL.Opt(MetadataMap), - 'origin' : IDL.Opt(IDL.Text), - 'protection' : DeviceProtection, - 'pubkey' : DeviceKey, - 'key_type' : KeyType, - 'purpose' : Purpose, - 'credential_id' : IDL.Opt(CredentialId), - }); - const DeviceRegistrationInfo = IDL.Record({ - 'tentative_device' : IDL.Opt(DeviceData), - 'expiration' : Timestamp, - }); - const IdentityAnchorInfo = IDL.Record({ - 'devices' : IDL.Vec(DeviceWithUsage), - 'device_registration' : IDL.Opt(DeviceRegistrationInfo), - }); - const FrontendHostname = IDL.Text; - const SessionKey = PublicKey; - const Delegation = IDL.Record({ - 'pubkey' : PublicKey, - 'targets' : IDL.Opt(IDL.Vec(IDL.Principal)), - 'expiration' : Timestamp, - }); - const SignedDelegation = IDL.Record({ - 'signature' : IDL.Vec(IDL.Nat8), - 'delegation' : Delegation, - }); - const GetDelegationResponse = IDL.Variant({ - 'no_such_delegation' : IDL.Null, - 'signed_delegation' : SignedDelegation, - }); - const GetIdAliasRequest = IDL.Record({ - 'rp_id_alias_jwt' : IDL.Text, - 'issuer' : FrontendHostname, - 'issuer_id_alias_jwt' : IDL.Text, - 'relying_party' : FrontendHostname, - 'identity_number' : IdentityNumber, - }); - const SignedIdAlias = IDL.Record({ - 'credential_jws' : IDL.Text, - 'id_alias' : IDL.Principal, - 'id_dapp' : IDL.Principal, - }); - const IdAliasCredentials = IDL.Record({ - 'rp_id_alias_credential' : SignedIdAlias, - 'issuer_id_alias_credential' : SignedIdAlias, - }); - const GetIdAliasError = IDL.Variant({ - 'InternalCanisterError' : IDL.Text, - 'Unauthorized' : IDL.Principal, - 'NoSuchCredentials' : IDL.Text, - }); - const HeaderField = IDL.Tuple(IDL.Text, IDL.Text); - const HttpRequest = IDL.Record({ - 'url' : IDL.Text, - 'method' : IDL.Text, - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'certificate_version' : IDL.Opt(IDL.Nat16), - }); - const Token = IDL.Record({}); - const StreamingCallbackHttpResponse = IDL.Record({ - 'token' : IDL.Opt(Token), - 'body' : IDL.Vec(IDL.Nat8), - }); - const StreamingStrategy = IDL.Variant({ - 'Callback' : IDL.Record({ - 'token' : Token, - 'callback' : IDL.Func( - [Token], - [StreamingCallbackHttpResponse], - ['query'], - ), - }), - }); - const HttpResponse = IDL.Record({ - 'body' : IDL.Vec(IDL.Nat8), - 'headers' : IDL.Vec(HeaderField), - 'upgrade' : IDL.Opt(IDL.Bool), - 'streaming_strategy' : IDL.Opt(StreamingStrategy), - 'status_code' : IDL.Nat16, - }); - const IdentityAuthnInfo = IDL.Record({ - 'authn_methods' : IDL.Vec(AuthnMethod), - 'recovery_authn_methods' : IDL.Vec(AuthnMethod), - }); - const AuthnMethodRegistrationInfo = IDL.Record({ - 'expiration' : Timestamp, - 'authn_method' : IDL.Opt(AuthnMethodData), - }); - const IdentityInfo = IDL.Record({ - 'authn_methods' : IDL.Vec(AuthnMethodData), - 'metadata' : MetadataMapV2, - 'authn_method_registration' : IDL.Opt(AuthnMethodRegistrationInfo), - }); - const IdentityInfoError = IDL.Variant({ - 'InternalCanisterError' : IDL.Text, - 'Unauthorized' : IDL.Principal, - }); - const IdentityMetadataReplaceError = IDL.Variant({ - 'InternalCanisterError' : IDL.Text, - 'Unauthorized' : IDL.Principal, - 'StorageSpaceExceeded' : IDL.Record({ - 'space_required' : IDL.Nat64, - 'space_available' : IDL.Nat64, - }), - }); - const ChallengeResult = IDL.Record({ - 'key' : ChallengeKey, - 'chars' : IDL.Text, - }); - const CaptchaResult = ChallengeResult; - const IdentityRegisterError = IDL.Variant({ - 'BadCaptcha' : IDL.Null, - 'CanisterFull' : IDL.Null, - 'InvalidMetadata' : IDL.Text, - }); - const UserKey = PublicKey; - const PrepareIdAliasRequest = IDL.Record({ - 'issuer' : FrontendHostname, - 'relying_party' : FrontendHostname, - 'identity_number' : IdentityNumber, - }); - const PreparedIdAlias = IDL.Record({ - 'rp_id_alias_jwt' : IDL.Text, - 'issuer_id_alias_jwt' : IDL.Text, - 'canister_sig_pk_der' : PublicKey, - }); - const PrepareIdAliasError = IDL.Variant({ - 'InternalCanisterError' : IDL.Text, - 'Unauthorized' : IDL.Principal, - }); - const RegisterResponse = IDL.Variant({ - 'bad_challenge' : IDL.Null, - 'canister_full' : IDL.Null, - 'registered' : IDL.Record({ 'user_number' : UserNumber }), - }); - const ArchiveConfig = IDL.Record({ - 'polling_interval_ns' : IDL.Nat64, - 'entries_buffer_limit' : IDL.Nat64, - 'module_hash' : IDL.Vec(IDL.Nat8), - 'entries_fetch_limit' : IDL.Nat16, - }); - const ArchiveInfo = IDL.Record({ - 'archive_config' : IDL.Opt(ArchiveConfig), - 'archive_canister' : IDL.Opt(IDL.Principal), - }); - const InternetIdentityStats = IDL.Record({ - 'storage_layout_version' : IDL.Nat8, - 'users_registered' : IDL.Nat64, - 'max_num_latest_delegation_origins' : IDL.Nat64, - 'assigned_user_number_range' : IDL.Tuple(IDL.Nat64, IDL.Nat64), - 'latest_delegation_origins' : IDL.Vec(FrontendHostname), - 'archive_info' : ArchiveInfo, - 'canister_creation_cycles_cost' : IDL.Nat64, - }); - const VerifyTentativeDeviceResponse = IDL.Variant({ - 'device_registration_mode_off' : IDL.Null, - 'verified' : IDL.Null, - 'wrong_code' : IDL.Record({ 'retries_left' : IDL.Nat8 }), - 'no_device_to_verify' : IDL.Null, - }); - return IDL.Service({ - 'acknowledge_entries' : IDL.Func([IDL.Nat64], [], []), - 'add' : IDL.Func([UserNumber, DeviceData], [], []), - 'add_tentative_device' : IDL.Func( - [UserNumber, DeviceData], - [AddTentativeDeviceResponse], - [], - ), - 'authn_method_add' : IDL.Func( - [IdentityNumber, AuthnMethodData], - [IDL.Variant({ 'Ok' : IDL.Null, 'Err' : AuthnMethodAddError })], - [], - ), - 'authn_method_confirm' : IDL.Func( - [IdentityNumber, IDL.Text], - [ - IDL.Variant({ - 'Ok' : IDL.Null, - 'Err' : AuthnMethodConfirmationError, - }), - ], - [], - ), - 'authn_method_metadata_replace' : IDL.Func( - [IdentityNumber, PublicKey, MetadataMapV2], - [ - IDL.Variant({ - 'Ok' : IDL.Null, - 'Err' : AuthnMethodMetadataReplaceError, - }), - ], - [], - ), - 'authn_method_register' : IDL.Func( - [IdentityNumber, AuthnMethodData], - [ - IDL.Variant({ - 'Ok' : AuthnMethodConfirmationCode, - 'Err' : AuthnMethodRegisterError, - }), - ], - [], - ), - 'authn_method_registration_mode_enter' : IDL.Func( - [IdentityNumber], - [ - IDL.Variant({ - 'Ok' : IDL.Record({ 'expiration' : Timestamp }), - 'Err' : IDL.Null, - }), - ], - [], - ), - 'authn_method_registration_mode_exit' : IDL.Func( - [IdentityNumber], - [IDL.Variant({ 'Ok' : IDL.Null, 'Err' : IDL.Null })], - [], - ), - 'authn_method_remove' : IDL.Func( - [IdentityNumber, PublicKey], - [IDL.Variant({ 'Ok' : IDL.Null, 'Err' : IDL.Null })], - [], - ), - 'authn_method_replace' : IDL.Func( - [IdentityNumber, PublicKey, AuthnMethodData], - [IDL.Variant({ 'Ok' : IDL.Null, 'Err' : AuthnMethodReplaceError })], - [], - ), - 'authn_method_security_settings_replace' : IDL.Func( - [IdentityNumber, PublicKey, AuthnMethodSecuritySettings], - [ - IDL.Variant({ - 'Ok' : IDL.Null, - 'Err' : AuthnMethodSecuritySettingsReplaceError, - }), - ], - [], - ), - 'captcha_create' : IDL.Func( - [], - [IDL.Variant({ 'Ok' : Challenge, 'Err' : IDL.Null })], - [], - ), - 'create_challenge' : IDL.Func([], [Challenge], []), - 'deploy_archive' : IDL.Func([IDL.Vec(IDL.Nat8)], [DeployArchiveResult], []), - 'enter_device_registration_mode' : IDL.Func([UserNumber], [Timestamp], []), - 'exit_device_registration_mode' : IDL.Func([UserNumber], [], []), - 'fetch_entries' : IDL.Func([], [IDL.Vec(BufferedArchiveEntry)], []), - 'get_anchor_credentials' : IDL.Func( - [UserNumber], - [AnchorCredentials], - ['query'], - ), - 'get_anchor_info' : IDL.Func([UserNumber], [IdentityAnchorInfo], []), - 'get_delegation' : IDL.Func( - [UserNumber, FrontendHostname, SessionKey, Timestamp], - [GetDelegationResponse], - ['query'], - ), - 'get_id_alias' : IDL.Func( - [GetIdAliasRequest], - [IDL.Variant({ 'Ok' : IdAliasCredentials, 'Err' : GetIdAliasError })], - ['query'], - ), - 'get_principal' : IDL.Func( - [UserNumber, FrontendHostname], - [IDL.Principal], - ['query'], - ), - 'http_request' : IDL.Func([HttpRequest], [HttpResponse], ['query']), - 'http_request_update' : IDL.Func([HttpRequest], [HttpResponse], []), - 'identity_authn_info' : IDL.Func( - [IdentityNumber], - [IDL.Variant({ 'Ok' : IdentityAuthnInfo, 'Err' : IDL.Null })], - ['query'], - ), - 'identity_info' : IDL.Func( - [IdentityNumber], - [IDL.Variant({ 'Ok' : IdentityInfo, 'Err' : IdentityInfoError })], - [], - ), - 'identity_metadata_replace' : IDL.Func( - [IdentityNumber, MetadataMapV2], - [ - IDL.Variant({ - 'Ok' : IDL.Null, - 'Err' : IdentityMetadataReplaceError, - }), - ], - [], - ), - 'identity_register' : IDL.Func( - [AuthnMethodData, CaptchaResult, IDL.Opt(IDL.Principal)], - [IDL.Variant({ 'Ok' : IdentityNumber, 'Err' : IdentityRegisterError })], - [], - ), - 'init_salt' : IDL.Func([], [], []), - 'lookup' : IDL.Func([UserNumber], [IDL.Vec(DeviceData)], ['query']), - 'prepare_delegation' : IDL.Func( - [UserNumber, FrontendHostname, SessionKey, IDL.Opt(IDL.Nat64)], - [UserKey, Timestamp], - [], - ), - 'prepare_id_alias' : IDL.Func( - [PrepareIdAliasRequest], - [IDL.Variant({ 'Ok' : PreparedIdAlias, 'Err' : PrepareIdAliasError })], - [], - ), - 'register' : IDL.Func( - [DeviceData, ChallengeResult, IDL.Opt(IDL.Principal)], - [RegisterResponse], - [], - ), - 'remove' : IDL.Func([UserNumber, DeviceKey], [], []), - 'replace' : IDL.Func([UserNumber, DeviceKey, DeviceData], [], []), - 'stats' : IDL.Func([], [InternetIdentityStats], ['query']), - 'update' : IDL.Func([UserNumber, DeviceKey, DeviceData], [], []), - 'verify_tentative_device' : IDL.Func( - [UserNumber, IDL.Text], - [VerifyTentativeDeviceResponse], - [], - ), - }); -}; -export const init = ({ IDL }) => { return []; }; diff --git a/.dfx/local/lsp/bd3sg-teaaa-aaaaa-qaaba-cai.did b/.dfx/local/lsp/bd3sg-teaaa-aaaaa-qaaba-cai.did index 982b75d2..3f4f0c6c 100644 --- a/.dfx/local/lsp/bd3sg-teaaa-aaaaa-qaaba-cai.did +++ b/.dfx/local/lsp/bd3sg-teaaa-aaaaa-qaaba-cai.did @@ -1,6 +1,22 @@ type Account = record { owner : principal; subaccount : opt Subaccount }; +type AccountIdentifier = variant { + "principal" : principal; + "blob" : vec nat8; + "text" : text; +}; +type AccountIdentifierToBlobErr = record { + kind : variant { InvalidAccountIdentifier; Other }; + message : opt text; +}; +type AccountIdentifierToBlobResult = variant { + ok : AccountIdentifierToBlobSuccess; + err : AccountIdentifierToBlobErr; +}; +type AccountIdentifierToBlobSuccess = vec nat8; type Backend = service { - deleteUser : (text) -> (Response_1); + accountIdentifierToBlob : (AccountIdentifier) -> ( + AccountIdentifierToBlobResult, + ); getAddress : () -> (text); getCanisterAddress : () -> (text); getCanisterBalance : () -> (text); @@ -12,15 +28,27 @@ type Backend = service { getTradingBalance : () -> (text); getUser : () -> (Response) query; getUsersList : () -> (vec record { text; User }) query; - setCourierApiKey : (text) -> (Response_1); - transactionsLength : () -> (text) query; + get_account_identifier : (GetAccountIdentifierArgs) -> ( + GetAccountIdentifierResult, + ) query; + setCourierApiKey : (text) -> (Response_2); transferFromCanistertoSubAccount : () -> (Result); transferFromSubAccountToCanister : (nat) -> (Result); - transferFromSubAccountToSubAccount : (text, nat) -> (Result); + transferFromSubAccountToSubAccount : (text, nat) -> (Response_1); updateUser : (User) -> (Response); + userExists : () -> (bool) query; userLength : () -> (text) query; whoami : () -> (principal); }; +type GetAccountIdentifierArgs = record { "principal" : principal }; +type GetAccountIdentifierErr = record { message : opt text }; +type GetAccountIdentifierResult = variant { + ok : GetAccountIdentifierSuccess; + err : GetAccountIdentifierErr; +}; +type GetAccountIdentifierSuccess = record { + accountIdentifier : AccountIdentifier; +}; type Response = record { status : nat16; data : opt User; @@ -28,6 +56,12 @@ type Response = record { error_text : opt text; }; type Response_1 = record { + status : nat16; + data : opt Transaction; + status_text : text; + error_text : opt text; +}; +type Response_2 = record { status : nat16; data : opt text; status_text : text; @@ -35,13 +69,12 @@ type Response_1 = record { }; type Result = variant { ok : text; err : text }; type Subaccount = vec nat8; +type Transaction = record { to : text; from : text; amount : text }; type User = record { + email_address : text; phone_notifications : bool; name : text; email_notifications : bool; - created_at : int; - email : text; - wallet : text; - phone : text; + phone_number : text; }; service : Backend \ No newline at end of file diff --git a/.dfx/local/lsp/bw4dl-smaaa-aaaaa-qaacq-cai.did b/.dfx/local/lsp/bw4dl-smaaa-aaaaa-qaacq-cai.did index c4f659eb..4d9ea8be 100644 --- a/.dfx/local/lsp/bw4dl-smaaa-aaaaa-qaacq-cai.did +++ b/.dfx/local/lsp/bw4dl-smaaa-aaaaa-qaacq-cai.did @@ -1,244 +1,197 @@ +type AssetCanisterArgs = variant { Upgrade : UpgradeArgs; Init : InitArgs }; type BatchId = nat; +type BatchOperationKind = variant { + SetAssetProperties : SetAssetPropertiesArguments; + CreateAsset : CreateAssetArguments; + UnsetAssetContent : UnsetAssetContentArguments; + DeleteAsset : DeleteAssetArguments; + SetAssetContent : SetAssetContentArguments; + Clear : ClearArguments; +}; type ChunkId = nat; -type Key = text; -type Time = int; - -type CreateAssetArguments = record { - key: Key; - content_type: text; - max_age: opt nat64; - headers: opt vec HeaderField; - enable_aliasing: opt bool; - allow_raw_access: opt bool; -}; - -// Add or change content for an asset, by content encoding -type SetAssetContentArguments = record { - key: Key; - content_encoding: text; - chunk_ids: vec ChunkId; - sha256: opt blob; -}; - -// Remove content for an asset, by content encoding -type UnsetAssetContentArguments = record { - key: Key; - content_encoding: text; -}; - -// Delete an asset -type DeleteAssetArguments = record { - key: Key; -}; - -// Reset everything type ClearArguments = record {}; - -type BatchOperationKind = variant { - CreateAsset: CreateAssetArguments; - SetAssetContent: SetAssetContentArguments; - - SetAssetProperties: SetAssetPropertiesArguments; - - UnsetAssetContent: UnsetAssetContentArguments; - DeleteAsset: DeleteAssetArguments; - - Clear: ClearArguments; -}; - type CommitBatchArguments = record { - batch_id: BatchId; - operations: vec BatchOperationKind + batch_id : BatchId; + operations : vec BatchOperationKind; }; - type CommitProposedBatchArguments = record { - batch_id: BatchId; - evidence: blob; + batch_id : BatchId; + evidence : vec nat8; }; - type ComputeEvidenceArguments = record { - batch_id: BatchId; - max_iterations: opt nat16 + batch_id : BatchId; + max_iterations : opt nat16; +}; +type ConfigurationResponse = record { + max_batches : opt nat64; + max_bytes : opt nat64; + max_chunks : opt nat64; +}; +type ConfigureArguments = record { + max_batches : opt opt nat64; + max_bytes : opt opt nat64; + max_chunks : opt opt nat64; }; - -type DeleteBatchArguments = record { - batch_id: BatchId; +type CreateAssetArguments = record { + key : Key; + content_type : text; + headers : opt vec HeaderField; + allow_raw_access : opt bool; + max_age : opt nat64; + enable_aliasing : opt bool; +}; +type DeleteAssetArguments = record { key : Key }; +type DeleteBatchArguments = record { batch_id : BatchId }; +type GrantPermission = record { + permission : Permission; + to_principal : principal; }; - -type HeaderField = record { text; text; }; - +type HeaderField = record { text; text }; type HttpRequest = record { - method: text; - url: text; - headers: vec HeaderField; - body: blob; - certificate_version: opt nat16; + url : text; + method : text; + body : vec nat8; + headers : vec HeaderField; + certificate_version : opt nat16; }; - type HttpResponse = record { - status_code: nat16; - headers: vec HeaderField; - body: blob; - streaming_strategy: opt StreamingStrategy; -}; - -type StreamingCallbackHttpResponse = record { - body: blob; - token: opt StreamingCallbackToken; + body : vec nat8; + headers : vec HeaderField; + streaming_strategy : opt StreamingStrategy; + status_code : nat16; }; - -type StreamingCallbackToken = record { - key: Key; - content_encoding: text; - index: nat; - sha256: opt blob; +type InitArgs = record {}; +type Key = text; +type ListPermitted = record { permission : Permission }; +type Permission = variant { Prepare; ManagePermissions; Commit }; +type RevokePermission = record { + permission : Permission; + of_principal : principal; }; - -type StreamingStrategy = variant { - Callback: record { - callback: func (StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query; - token: StreamingCallbackToken; - }; +type SetAssetContentArguments = record { + key : Key; + sha256 : opt vec nat8; + chunk_ids : vec ChunkId; + content_encoding : text; }; - type SetAssetPropertiesArguments = record { - key: Key; - max_age: opt opt nat64; - headers: opt opt vec HeaderField; - allow_raw_access: opt opt bool; - is_aliased: opt opt bool; -}; - -type ConfigurationResponse = record { - max_batches: opt nat64; - max_chunks: opt nat64; - max_bytes: opt nat64; + key : Key; + headers : opt opt vec HeaderField; + is_aliased : opt opt bool; + allow_raw_access : opt opt bool; + max_age : opt opt nat64; }; - -type ConfigureArguments = record { - max_batches: opt opt nat64; - max_chunks: opt opt nat64; - max_bytes: opt opt nat64; +type SetPermissions = record { + prepare : vec principal; + commit : vec principal; + manage_permissions : vec principal; }; - -type Permission = variant { - Commit; - ManagePermissions; - Prepare; +type StreamingCallbackHttpResponse = record { + token : opt StreamingCallbackToken; + body : vec nat8; }; - -type GrantPermission = record { - to_principal: principal; - permission: Permission; +type StreamingCallbackToken = record { + key : Key; + sha256 : opt vec nat8; + index : nat; + content_encoding : text; }; -type RevokePermission = record { - of_principal: principal; - permission: Permission; +type StreamingStrategy = variant { + Callback : record { + token : StreamingCallbackToken; + callback : func (StreamingCallbackToken) -> ( + opt StreamingCallbackHttpResponse, + ) query; + }; }; -type ListPermitted = record { permission: Permission }; - +type Time = int; +type UnsetAssetContentArguments = record { key : Key; content_encoding : text }; +type UpgradeArgs = record { set_permissions : opt SetPermissions }; type ValidationResult = variant { Ok : text; Err : text }; - -service: { - api_version: () -> (nat16) query; - - get: (record { - key: Key; - accept_encodings: vec text; - }) -> (record { - content: blob; // may be the entirety of the content, or just chunk index 0 - content_type: text; - content_encoding: text; - sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments - total_length: nat; // all chunks except last have size == content.size() - }) query; - - // if get() returned chunks > 1, call this to retrieve them. - // chunks may or may not be split up at the same boundaries as presented to create_chunk(). - get_chunk: (record { - key: Key; - content_encoding: text; - index: nat; - sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments - }) -> (record { content: blob }) query; - - list : (record {}) -> (vec record { - key: Key; - content_type: text; - encodings: vec record { - content_encoding: text; - sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments - length: nat; // Size of this encoding's blob. Calculated when uploading assets. - modified: Time; - }; - }) query; - - certified_tree : (record {}) -> (record { - certificate: blob; - tree: blob; - }) query; - - create_batch : (record {}) -> (record { batch_id: BatchId }); - - create_chunk: (record { batch_id: BatchId; content: blob }) -> (record { chunk_id: ChunkId }); - - // Perform all operations successfully, or reject - commit_batch: (CommitBatchArguments) -> (); - - // Save the batch operations for later commit - propose_commit_batch: (CommitBatchArguments) -> (); - - // Given a batch already proposed, perform all operations successfully, or reject - commit_proposed_batch: (CommitProposedBatchArguments) -> (); - - // Compute a hash over the CommitBatchArguments. Call until it returns Some(evidence). - compute_evidence: (ComputeEvidenceArguments) -> (opt blob); - - // Delete a batch that has been created, or proposed for commit, but not yet committed - delete_batch: (DeleteBatchArguments) -> (); - - create_asset: (CreateAssetArguments) -> (); - set_asset_content: (SetAssetContentArguments) -> (); - unset_asset_content: (UnsetAssetContentArguments) -> (); - - delete_asset: (DeleteAssetArguments) -> (); - - clear: (ClearArguments) -> (); - - // Single call to create an asset with content for a single content encoding that - // fits within the message ingress limit. - store: (record { - key: Key; - content_type: text; - content_encoding: text; - content: blob; - sha256: opt blob - }) -> (); - - http_request: (request: HttpRequest) -> (HttpResponse) query; - http_request_streaming_callback: (token: StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query; - - authorize: (principal) -> (); - deauthorize: (principal) -> (); - list_authorized: () -> (vec principal) query; - grant_permission: (GrantPermission) -> (); - revoke_permission: (RevokePermission) -> (); - list_permitted: (ListPermitted) -> (vec principal) query; - take_ownership: () -> (); - - get_asset_properties : (key: Key) -> (record { - max_age: opt nat64; - headers: opt vec HeaderField; - allow_raw_access: opt bool; - is_aliased: opt bool; } ) query; - set_asset_properties: (SetAssetPropertiesArguments) -> (); - - get_configuration: () -> (ConfigurationResponse); - configure: (ConfigureArguments) -> (); - - validate_grant_permission: (GrantPermission) -> (ValidationResult); - validate_revoke_permission: (RevokePermission) -> (ValidationResult); - validate_take_ownership: () -> (ValidationResult); - validate_commit_proposed_batch: (CommitProposedBatchArguments) -> (ValidationResult); - validate_configure: (ConfigureArguments) -> (ValidationResult); -} +service : { + api_version : () -> (nat16) query; + authorize : (principal) -> (); + certified_tree : (record {}) -> ( + record { certificate : vec nat8; tree : vec nat8 }, + ) query; + clear : (ClearArguments) -> (); + commit_batch : (CommitBatchArguments) -> (); + commit_proposed_batch : (CommitProposedBatchArguments) -> (); + compute_evidence : (ComputeEvidenceArguments) -> (opt vec nat8); + configure : (ConfigureArguments) -> (); + create_asset : (CreateAssetArguments) -> (); + create_batch : (record {}) -> (record { batch_id : BatchId }); + create_chunk : (record { content : vec nat8; batch_id : BatchId }) -> ( + record { chunk_id : ChunkId }, + ); + deauthorize : (principal) -> (); + delete_asset : (DeleteAssetArguments) -> (); + delete_batch : (DeleteBatchArguments) -> (); + get : (record { key : Key; accept_encodings : vec text }) -> ( + record { + content : vec nat8; + sha256 : opt vec nat8; + content_type : text; + content_encoding : text; + total_length : nat; + }, + ) query; + get_asset_properties : (Key) -> ( + record { + headers : opt vec HeaderField; + is_aliased : opt bool; + allow_raw_access : opt bool; + max_age : opt nat64; + }, + ) query; + get_chunk : ( + record { + key : Key; + sha256 : opt vec nat8; + index : nat; + content_encoding : text; + }, + ) -> (record { content : vec nat8 }) query; + get_configuration : () -> (ConfigurationResponse); + grant_permission : (GrantPermission) -> (); + http_request : (HttpRequest) -> (HttpResponse) query; + http_request_streaming_callback : (StreamingCallbackToken) -> ( + opt StreamingCallbackHttpResponse, + ) query; + list : (record {}) -> ( + vec record { + key : Key; + encodings : vec record { + modified : Time; + sha256 : opt vec nat8; + length : nat; + content_encoding : text; + }; + content_type : text; + }, + ) query; + list_authorized : () -> (vec principal); + list_permitted : (ListPermitted) -> (vec principal); + propose_commit_batch : (CommitBatchArguments) -> (); + revoke_permission : (RevokePermission) -> (); + set_asset_content : (SetAssetContentArguments) -> (); + set_asset_properties : (SetAssetPropertiesArguments) -> (); + store : ( + record { + key : Key; + content : vec nat8; + sha256 : opt vec nat8; + content_type : text; + content_encoding : text; + }, + ) -> (); + take_ownership : () -> (); + unset_asset_content : (UnsetAssetContentArguments) -> (); + validate_commit_proposed_batch : (CommitProposedBatchArguments) -> ( + ValidationResult, + ); + validate_configure : (ConfigureArguments) -> (ValidationResult); + validate_grant_permission : (GrantPermission) -> (ValidationResult); + validate_revoke_permission : (RevokePermission) -> (ValidationResult); + validate_take_ownership : () -> (ValidationResult); +} \ No newline at end of file diff --git a/.dfx/local/lsp/rdmx6-jaaaa-aaaaa-aaadq-cai.did b/.dfx/local/lsp/rdmx6-jaaaa-aaaaa-aaadq-cai.did deleted file mode 100644 index fd53d49c..00000000 --- a/.dfx/local/lsp/rdmx6-jaaaa-aaaaa-aaadq-cai.did +++ /dev/null @@ -1,356 +0,0 @@ -type AddTentativeDeviceResponse = variant { - device_registration_mode_off; - another_device_tentatively_added; - added_tentatively : record { - verification_code : text; - device_registration_timeout : Timestamp; - }; -}; -type AnchorCredentials = record { - recovery_phrases : vec PublicKey; - credentials : vec WebAuthnCredential; - recovery_credentials : vec WebAuthnCredential; -}; -type ArchiveConfig = record { - polling_interval_ns : nat64; - entries_buffer_limit : nat64; - module_hash : vec nat8; - entries_fetch_limit : nat16; -}; -type ArchiveInfo = record { - archive_config : opt ArchiveConfig; - archive_canister : opt principal; -}; -type AuthnMethod = variant { PubKey : PublicKeyAuthn; WebAuthn : WebAuthn }; -type AuthnMethodAddError = variant { InvalidMetadata : text }; -type AuthnMethodConfirmationCode = record { - confirmation_code : text; - expiration : Timestamp; -}; -type AuthnMethodConfirmationError = variant { - RegistrationModeOff; - NoAuthnMethodToConfirm; - WrongCode : record { retries_left : nat8 }; -}; -type AuthnMethodData = record { - security_settings : AuthnMethodSecuritySettings; - metadata : MetadataMapV2; - last_authentication : opt Timestamp; - authn_method : AuthnMethod; -}; -type AuthnMethodMetadataReplaceError = variant { - AuthnMethodNotFound; - InvalidMetadata : text; -}; -type AuthnMethodProtection = variant { Protected; Unprotected }; -type AuthnMethodPurpose = variant { Recovery; Authentication }; -type AuthnMethodRegisterError = variant { - RegistrationModeOff; - RegistrationAlreadyInProgress; - InvalidMetadata : text; -}; -type AuthnMethodRegistrationInfo = record { - expiration : Timestamp; - authn_method : opt AuthnMethodData; -}; -type AuthnMethodReplaceError = variant { - AuthnMethodNotFound; - InvalidMetadata : text; -}; -type AuthnMethodSecuritySettings = record { - protection : AuthnMethodProtection; - purpose : AuthnMethodPurpose; -}; -type AuthnMethodSecuritySettingsReplaceError = variant { AuthnMethodNotFound }; -type BufferedArchiveEntry = record { - sequence_number : nat64; - entry : vec nat8; - anchor_number : UserNumber; - timestamp : Timestamp; -}; -type CaptchaResult = ChallengeResult; -type Challenge = record { png_base64 : text; challenge_key : ChallengeKey }; -type ChallengeKey = text; -type ChallengeResult = record { key : ChallengeKey; chars : text }; -type CredentialId = vec nat8; -type Delegation = record { - pubkey : PublicKey; - targets : opt vec principal; - expiration : Timestamp; -}; -type DeployArchiveResult = variant { - creation_in_progress; - success : principal; - failed : text; -}; -type DeviceData = record { - alias : text; - metadata : opt MetadataMap; - origin : opt text; - protection : DeviceProtection; - pubkey : DeviceKey; - key_type : KeyType; - purpose : Purpose; - credential_id : opt CredentialId; -}; -type DeviceKey = PublicKey; -type DeviceProtection = variant { unprotected; protected }; -type DeviceRegistrationInfo = record { - tentative_device : opt DeviceData; - expiration : Timestamp; -}; -type DeviceWithUsage = record { - alias : text; - last_usage : opt Timestamp; - metadata : opt MetadataMap; - origin : opt text; - protection : DeviceProtection; - pubkey : DeviceKey; - key_type : KeyType; - purpose : Purpose; - credential_id : opt CredentialId; -}; -type FrontendHostname = text; -type GetDelegationResponse = variant { - no_such_delegation; - signed_delegation : SignedDelegation; -}; -type GetIdAliasError = variant { - InternalCanisterError : text; - Unauthorized : principal; - NoSuchCredentials : text; -}; -type GetIdAliasRequest = record { - rp_id_alias_jwt : text; - issuer : FrontendHostname; - issuer_id_alias_jwt : text; - relying_party : FrontendHostname; - identity_number : IdentityNumber; -}; -type HeaderField = record { text; text }; -type HttpRequest = record { - url : text; - method : text; - body : vec nat8; - headers : vec HeaderField; - certificate_version : opt nat16; -}; -type HttpResponse = record { - body : vec nat8; - headers : vec HeaderField; - upgrade : opt bool; - streaming_strategy : opt StreamingStrategy; - status_code : nat16; -}; -type IdAliasCredentials = record { - rp_id_alias_credential : SignedIdAlias; - issuer_id_alias_credential : SignedIdAlias; -}; -type IdentityAnchorInfo = record { - devices : vec DeviceWithUsage; - device_registration : opt DeviceRegistrationInfo; -}; -type IdentityAuthnInfo = record { - authn_methods : vec AuthnMethod; - recovery_authn_methods : vec AuthnMethod; -}; -type IdentityInfo = record { - authn_methods : vec AuthnMethodData; - metadata : MetadataMapV2; - authn_method_registration : opt AuthnMethodRegistrationInfo; -}; -type IdentityInfoError = variant { - InternalCanisterError : text; - Unauthorized : principal; -}; -type IdentityMetadataReplaceError = variant { - InternalCanisterError : text; - Unauthorized : principal; - StorageSpaceExceeded : record { - space_required : nat64; - space_available : nat64; - }; -}; -type IdentityNumber = nat64; -type IdentityRegisterError = variant { - BadCaptcha; - CanisterFull; - InvalidMetadata : text; -}; -type InternetIdentityInit = record { - max_num_latest_delegation_origins : opt nat64; - assigned_user_number_range : opt record { nat64; nat64 }; - max_inflight_captchas : opt nat64; - archive_config : opt ArchiveConfig; - canister_creation_cycles_cost : opt nat64; - register_rate_limit : opt RateLimitConfig; -}; -type InternetIdentityStats = record { - storage_layout_version : nat8; - users_registered : nat64; - max_num_latest_delegation_origins : nat64; - assigned_user_number_range : record { nat64; nat64 }; - latest_delegation_origins : vec FrontendHostname; - archive_info : ArchiveInfo; - canister_creation_cycles_cost : nat64; -}; -type KeyType = variant { - platform; - seed_phrase; - cross_platform; - unknown; - browser_storage_key; -}; -type MetadataMap = vec record { - text; - variant { map : MetadataMap; string : text; bytes : vec nat8 }; -}; -type MetadataMapV2 = vec record { - text; - variant { Map : MetadataMapV2; String : text; Bytes : vec nat8 }; -}; -type PrepareIdAliasError = variant { - InternalCanisterError : text; - Unauthorized : principal; -}; -type PrepareIdAliasRequest = record { - issuer : FrontendHostname; - relying_party : FrontendHostname; - identity_number : IdentityNumber; -}; -type PreparedIdAlias = record { - rp_id_alias_jwt : text; - issuer_id_alias_jwt : text; - canister_sig_pk_der : PublicKey; -}; -type PublicKey = vec nat8; -type PublicKeyAuthn = record { pubkey : PublicKey }; -type Purpose = variant { authentication; recovery }; -type RateLimitConfig = record { max_tokens : nat64; time_per_token_ns : nat64 }; -type RegisterResponse = variant { - bad_challenge; - canister_full; - registered : record { user_number : UserNumber }; -}; -type SessionKey = PublicKey; -type SignedDelegation = record { - signature : vec nat8; - delegation : Delegation; -}; -type SignedIdAlias = record { - credential_jws : text; - id_alias : principal; - id_dapp : principal; -}; -type StreamingCallbackHttpResponse = record { - token : opt Token; - body : vec nat8; -}; -type StreamingStrategy = variant { - Callback : record { - token : Token; - callback : func (Token) -> (StreamingCallbackHttpResponse) query; - }; -}; -type Timestamp = nat64; -type Token = record {}; -type UserKey = PublicKey; -type UserNumber = nat64; -type VerifyTentativeDeviceResponse = variant { - device_registration_mode_off; - verified; - wrong_code : record { retries_left : nat8 }; - no_device_to_verify; -}; -type WebAuthn = record { pubkey : PublicKey; credential_id : CredentialId }; -type WebAuthnCredential = record { - pubkey : PublicKey; - credential_id : CredentialId; -}; -service : { - acknowledge_entries : (nat64) -> (); - add : (UserNumber, DeviceData) -> (); - add_tentative_device : (UserNumber, DeviceData) -> ( - AddTentativeDeviceResponse, - ); - authn_method_add : (IdentityNumber, AuthnMethodData) -> ( - variant { Ok; Err : AuthnMethodAddError }, - ); - authn_method_confirm : (IdentityNumber, text) -> ( - variant { Ok; Err : AuthnMethodConfirmationError }, - ); - authn_method_metadata_replace : ( - IdentityNumber, - PublicKey, - MetadataMapV2, - ) -> (variant { Ok; Err : AuthnMethodMetadataReplaceError }); - authn_method_register : (IdentityNumber, AuthnMethodData) -> ( - variant { - Ok : AuthnMethodConfirmationCode; - Err : AuthnMethodRegisterError; - }, - ); - authn_method_registration_mode_enter : (IdentityNumber) -> ( - variant { Ok : record { expiration : Timestamp }; Err }, - ); - authn_method_registration_mode_exit : (IdentityNumber) -> ( - variant { Ok; Err }, - ); - authn_method_remove : (IdentityNumber, PublicKey) -> (variant { Ok; Err }); - authn_method_replace : (IdentityNumber, PublicKey, AuthnMethodData) -> ( - variant { Ok; Err : AuthnMethodReplaceError }, - ); - authn_method_security_settings_replace : ( - IdentityNumber, - PublicKey, - AuthnMethodSecuritySettings, - ) -> (variant { Ok; Err : AuthnMethodSecuritySettingsReplaceError }); - captcha_create : () -> (variant { Ok : Challenge; Err }); - create_challenge : () -> (Challenge); - deploy_archive : (vec nat8) -> (DeployArchiveResult); - enter_device_registration_mode : (UserNumber) -> (Timestamp); - exit_device_registration_mode : (UserNumber) -> (); - fetch_entries : () -> (vec BufferedArchiveEntry); - get_anchor_credentials : (UserNumber) -> (AnchorCredentials) query; - get_anchor_info : (UserNumber) -> (IdentityAnchorInfo); - get_delegation : (UserNumber, FrontendHostname, SessionKey, Timestamp) -> ( - GetDelegationResponse, - ) query; - get_id_alias : (GetIdAliasRequest) -> ( - variant { Ok : IdAliasCredentials; Err : GetIdAliasError }, - ) query; - get_principal : (UserNumber, FrontendHostname) -> (principal) query; - http_request : (HttpRequest) -> (HttpResponse) query; - http_request_update : (HttpRequest) -> (HttpResponse); - identity_authn_info : (IdentityNumber) -> ( - variant { Ok : IdentityAuthnInfo; Err }, - ) query; - identity_info : (IdentityNumber) -> ( - variant { Ok : IdentityInfo; Err : IdentityInfoError }, - ); - identity_metadata_replace : (IdentityNumber, MetadataMapV2) -> ( - variant { Ok; Err : IdentityMetadataReplaceError }, - ); - identity_register : (AuthnMethodData, CaptchaResult, opt principal) -> ( - variant { Ok : IdentityNumber; Err : IdentityRegisterError }, - ); - init_salt : () -> (); - lookup : (UserNumber) -> (vec DeviceData) query; - prepare_delegation : ( - UserNumber, - FrontendHostname, - SessionKey, - opt nat64, - ) -> (UserKey, Timestamp); - prepare_id_alias : (PrepareIdAliasRequest) -> ( - variant { Ok : PreparedIdAlias; Err : PrepareIdAliasError }, - ); - register : (DeviceData, ChallengeResult, opt principal) -> (RegisterResponse); - remove : (UserNumber, DeviceKey) -> (); - replace : (UserNumber, DeviceKey, DeviceData) -> (); - stats : () -> (InternetIdentityStats) query; - update : (UserNumber, DeviceKey, DeviceData) -> (); - verify_tentative_device : (UserNumber, text) -> ( - VerifyTentativeDeviceResponse, - ); -} \ No newline at end of file diff --git a/.dfx/local/wallets.json b/.dfx/local/wallets.json index a69f7698..578d5337 100644 --- a/.dfx/local/wallets.json +++ b/.dfx/local/wallets.json @@ -1,6 +1,6 @@ { "identities": { - "default": { + "cosmas": { "local": "bnz7o-iuaaa-aaaaa-qaaaa-cai" } } diff --git a/.dfx/network/local/ic-canister-http-config.json b/.dfx/network/local/ic-canister-http-config.json index c3e00ab0..82bab910 100644 --- a/.dfx/network/local/ic-canister-http-config.json +++ b/.dfx/network/local/ic-canister-http-config.json @@ -1,6 +1,6 @@ { "incoming_source": { - "Path": "/tmp/ic-https-outcalls-adapter-socket.2927.1706864562" + "Path": "/tmp/ic-https-outcalls-adapter-socket.16405.1707643609" }, "logger": { "level": "error" diff --git a/.dfx/network/local/ic-canister-http-socket-path b/.dfx/network/local/ic-canister-http-socket-path index a4d72291..a2964abd 100644 --- a/.dfx/network/local/ic-canister-http-socket-path +++ b/.dfx/network/local/ic-canister-http-socket-path @@ -1 +1 @@ -/tmp/ic-https-outcalls-adapter-socket.2927.1706864562 \ No newline at end of file +/tmp/ic-https-outcalls-adapter-socket.16405.1707643609 \ No newline at end of file diff --git a/.dfx/network/local/ic-https-outcalls-adapter-pid b/.dfx/network/local/ic-https-outcalls-adapter-pid index dd35c6b7..a0b994fa 100644 --- a/.dfx/network/local/ic-https-outcalls-adapter-pid +++ b/.dfx/network/local/ic-https-outcalls-adapter-pid @@ -1 +1 @@ -548 \ No newline at end of file +16415 \ No newline at end of file diff --git a/.dfx/network/local/icx-proxy-pid b/.dfx/network/local/icx-proxy-pid index 1e36b913..a3883829 100644 --- a/.dfx/network/local/icx-proxy-pid +++ b/.dfx/network/local/icx-proxy-pid @@ -1 +1 @@ -1258 \ No newline at end of file +16530 \ No newline at end of file diff --git a/.dfx/network/local/network-id b/.dfx/network/local/network-id index 6eb055aa..e25cd4cb 100644 --- a/.dfx/network/local/network-id +++ b/.dfx/network/local/network-id @@ -1,3 +1,3 @@ { - "created": "2024-02-02 09:02:42.665152868 +00:00:00" + "created": "2024-02-11 09:26:49.832041295 +00:00:00" } \ No newline at end of file diff --git a/.dfx/network/local/pid b/.dfx/network/local/pid deleted file mode 100644 index 88101bcc..00000000 --- a/.dfx/network/local/pid +++ /dev/null @@ -1 +0,0 @@ -465 \ No newline at end of file diff --git a/.dfx/network/local/replica-configuration/replica-1.port b/.dfx/network/local/replica-configuration/replica-1.port index e7a7f067..395423cf 100644 --- a/.dfx/network/local/replica-configuration/replica-1.port +++ b/.dfx/network/local/replica-configuration/replica-1.port @@ -1 +1 @@ -39585 \ No newline at end of file +40105 \ No newline at end of file diff --git a/.dfx/network/local/replica-configuration/replica-pid b/.dfx/network/local/replica-configuration/replica-pid index 18133faa..accbd9cb 100644 --- a/.dfx/network/local/replica-configuration/replica-pid +++ b/.dfx/network/local/replica-configuration/replica-pid @@ -1 +1 @@ -564 \ No newline at end of file +16422 \ No newline at end of file diff --git a/.dfx/network/local/replica-effective-config.json b/.dfx/network/local/replica-effective-config.json index 286b3a10..3665a040 100644 --- a/.dfx/network/local/replica-effective-config.json +++ b/.dfx/network/local/replica-effective-config.json @@ -1,5 +1,5 @@ { - "replica_rev": "91bf38ff3cb927cb94027d9da513cd15f91a5b04", + "replica_rev": "044cfd5147fc97d7e5a214966941b6580c325d72", "type": "replica", "config": { "http_handler": { @@ -22,7 +22,7 @@ }, "canister_http_adapter": { "enabled": true, - "socket_path": "/tmp/ic-https-outcalls-adapter-socket.2927.1706864562" + "socket_path": "/tmp/ic-https-outcalls-adapter-socket.16405.1707643609" }, "log_level": "error", "artificial_delay": 600, diff --git a/.dfx/network/local/state/replicated_state/ic.json5 b/.dfx/network/local/state/replicated_state/ic.json5 index 272b33ac..1d57a0ef 100644 --- a/.dfx/network/local/state/replicated_state/ic.json5 +++ b/.dfx/network/local/state/replicated_state/ic.json5 @@ -1 +1 @@ -{"registry_client":{"local_store":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/ic_registry_local_store"},"transport":{"node_ip":"0.0.0.0","listening_port":0,"send_queue_size":1024,"max_streams":1},"state_manager":{"state_root":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/node-100/state","file_backed_memory_allocator":"Enabled"},"hypervisor":{"embedders_config":{"max_wasm_stack_size":5242880,"query_execution_threads_per_canister":2,"max_globals":300,"max_functions":50000,"max_custom_sections":16,"max_custom_sections_size":1048576,"max_number_exported_functions":1000,"max_sum_exported_function_name_lengths":20000,"cost_to_compile_wasm_instruction":6000,"num_rayon_compilation_threads":10,"feature_flags":{"rate_limiting_of_debug_prints":"Disabled","write_barrier":"Disabled","wasm_native_stable_memory":"Enabled"},"metering_type":"New","stable_memory_dirty_page_limit":2097152,"stable_memory_accessed_page_limit":2097152,"min_sandbox_count":500,"max_sandbox_count":2000,"max_sandbox_idle_time":{"secs":1800,"nanos":0},"subnet_type":"application","dirty_page_overhead":0,"trace_execution":"Disabled"},"create_funds_whitelist":"","max_instructions_for_message_acceptance_calls":5000000000,"subnet_memory_threshold":483183820800,"subnet_memory_capacity":751619276800,"subnet_message_memory_capacity":26843545600,"ingress_history_memory_capacity":4294967296,"subnet_wasm_custom_sections_memory_capacity":2147483648,"subnet_memory_reservation":10737418240,"max_canister_memory_size":107374182400,"default_provisional_cycles_balance":100000000000000,"default_freeze_threshold":2592000,"max_controllers":10,"canister_sandboxing_flag":"Enabled","query_execution_threads_total":4,"query_scheduling_time_slice_per_canister":{"secs":0,"nanos":20000000},"max_query_call_graph_depth":6,"max_query_call_graph_instructions":5000000000,"max_query_call_walltime":{"secs":10,"nanos":0},"instruction_overhead_per_query_call":50000000,"rate_limiting_of_heap_delta":"Disabled","rate_limiting_of_instructions":"Disabled","allocatable_compute_capacity_in_percent":50,"deterministic_time_slicing":"Enabled","bitcoin":{"privileged_access":["g4xu7-jiaaa-aaaan-aaaaq-cai","ghsi2-tqaaa-aaaan-aaaca-cai","gsvzx-syaaa-aaaan-aaabq-cai"],"testnet_canister_id":"g4xu7-jiaaa-aaaan-aaaaq-cai","mainnet_canister_id":"ghsi2-tqaaa-aaaan-aaaca-cai"},"composite_queries":"Enabled","query_caching":"Enabled","query_cache_capacity":104857600,"max_compilation_cache_size":10737418240,"query_stats_aggregation":"Disabled"},"http_handler":{"listen_addr":"127.0.0.1:0","port_file_path":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/replica-configuration/replica-1.port","connection_read_timeout_seconds":1200,"request_timeout_seconds":300,"http_max_concurrent_streams":256,"max_request_size_bytes":5242880,"max_delegation_certificate_size_bytes":1048576,"max_request_receive_seconds":300,"max_read_state_concurrent_requests":100,"max_status_concurrent_requests":100,"max_catch_up_package_concurrent_requests":100,"max_dashboard_concurrent_requests":100,"max_call_concurrent_requests":50,"max_query_concurrent_requests":400,"max_pprof_concurrent_requests":5},"metrics":null,"artifact_pool":{"consensus_pool_path":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool","ingress_pool_max_count":18446744073709551615,"ingress_pool_max_bytes":18446744073709551615},"crypto":{"crypto_root":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/node-100/crypto","csp_vault_type":"in_replica"},"logger":{"node_id":100,"dc_id":200,"level":"error","format":"text_full","debug_overrides":[],"sampling_rates":{},"enabled_tags":[],"target":"Stdout","block_on_overflow":true},"orchestrator_logger":null,"csp_vault_logger":null,"message_routing":null,"malicious_behaviour":null,"firewall":null,"registration":null,"nns_registry_replicator":null,"adapters_config":{"bitcoin_mainnet_uds_path":null,"bitcoin_mainnet_uds_metrics_path":null,"bitcoin_testnet_uds_path":null,"bitcoin_testnet_uds_metrics_path":null,"https_outcalls_uds_path":"/tmp/ic-https-outcalls-adapter-socket.2927.1706864562","https_outcalls_uds_metrics_path":null}} \ No newline at end of file +{"registry_client":{"local_store":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/ic_registry_local_store"},"transport":{"node_ip":"0.0.0.0","listening_port":0,"send_queue_size":1024,"max_streams":1},"state_manager":{"state_root":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/node-100/state","file_backed_memory_allocator":"Enabled","lsmt_storage":"Disabled"},"hypervisor":{"embedders_config":{"max_wasm_stack_size":5242880,"query_execution_threads_per_canister":2,"max_globals":1000,"max_functions":50000,"max_custom_sections":16,"max_custom_sections_size":1048576,"max_number_exported_functions":1000,"max_sum_exported_function_name_lengths":20000,"cost_to_compile_wasm_instruction":6000,"num_rayon_compilation_threads":10,"feature_flags":{"rate_limiting_of_debug_prints":"Disabled","write_barrier":"Disabled","wasm_native_stable_memory":"Enabled"},"metering_type":"New","stable_memory_dirty_page_limit":2097152,"stable_memory_accessed_page_limit":2097152,"min_sandbox_count":500,"max_sandbox_count":2000,"max_sandbox_idle_time":{"secs":1800,"nanos":0},"subnet_type":"application","dirty_page_overhead":0,"trace_execution":"Disabled","max_dirty_pages_without_optimization":262144,"dirty_page_copy_overhead":3000},"create_funds_whitelist":"","max_instructions_for_message_acceptance_calls":200000000,"subnet_memory_threshold":483183820800,"subnet_memory_capacity":751619276800,"subnet_message_memory_capacity":26843545600,"ingress_history_memory_capacity":4294967296,"subnet_wasm_custom_sections_memory_capacity":2147483648,"subnet_memory_reservation":10737418240,"max_canister_memory_size":433791696896,"default_provisional_cycles_balance":100000000000000,"default_freeze_threshold":2592000,"max_controllers":10,"canister_sandboxing_flag":"Enabled","query_execution_threads_total":4,"query_scheduling_time_slice_per_canister":{"secs":0,"nanos":20000000},"max_query_call_graph_depth":6,"max_query_call_graph_instructions":5000000000,"max_query_call_walltime":{"secs":10,"nanos":0},"instruction_overhead_per_query_call":50000000,"rate_limiting_of_heap_delta":"Disabled","rate_limiting_of_instructions":"Disabled","allocatable_compute_capacity_in_percent":50,"deterministic_time_slicing":"Enabled","bitcoin":{"privileged_access":["g4xu7-jiaaa-aaaan-aaaaq-cai","ghsi2-tqaaa-aaaan-aaaca-cai","gsvzx-syaaa-aaaan-aaabq-cai"],"testnet_canister_id":"g4xu7-jiaaa-aaaan-aaaaq-cai","mainnet_canister_id":"ghsi2-tqaaa-aaaan-aaaca-cai"},"composite_queries":"Enabled","query_caching":"Enabled","query_cache_capacity":209715200,"query_cache_max_expiry_time":{"secs":300,"nanos":0},"max_compilation_cache_size":10737418240,"query_stats_aggregation":"Disabled","query_stats_epoch_length":2000,"wasm_chunk_store":"Enabled","stop_canister_timeout_duration":{"secs":300,"nanos":0},"canister_snapshots":"Disabled"},"http_handler":{"listen_addr":"127.0.0.1:0","port_file_path":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/replica-configuration/replica-1.port","connection_read_timeout_seconds":1200,"request_timeout_seconds":300,"http_max_concurrent_streams":256,"max_request_size_bytes":5242880,"max_delegation_certificate_size_bytes":1048576,"max_request_receive_seconds":300,"max_read_state_concurrent_requests":100,"max_status_concurrent_requests":100,"max_catch_up_package_concurrent_requests":100,"max_dashboard_concurrent_requests":100,"max_call_concurrent_requests":50,"max_query_concurrent_requests":400,"max_pprof_concurrent_requests":5},"metrics":null,"artifact_pool":{"consensus_pool_path":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool","ingress_pool_max_count":18446744073709551615,"ingress_pool_max_bytes":18446744073709551615},"crypto":{"crypto_root":"/home/cosmas/harambeeapps/ic-payroll/.dfx/network/local/state/replicated_state/node-100/crypto","csp_vault_type":"in_replica"},"logger":{"node_id":100,"dc_id":200,"level":"error","format":"text_full","debug_overrides":[],"sampling_rates":{},"enabled_tags":[],"target":"Stdout","block_on_overflow":true},"orchestrator_logger":null,"csp_vault_logger":null,"message_routing":null,"malicious_behaviour":null,"firewall":null,"registration":null,"nns_registry_replicator":null,"adapters_config":{"bitcoin_mainnet_uds_path":null,"bitcoin_mainnet_uds_metrics_path":null,"bitcoin_testnet_uds_path":null,"bitcoin_testnet_uds_metrics_path":null,"https_outcalls_uds_path":"/tmp/ic-https-outcalls-adapter-socket.16405.1707643609","https_outcalls_uds_metrics_path":null},"bitcoin_payload_builder_config":null,"ipv4_config":null,"domain":null} \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/ic_registry_local_store/0000000000/00/00/01.pb b/.dfx/network/local/state/replicated_state/ic_registry_local_store/0000000000/00/00/01.pb index ea6e9d66..a045fea2 100644 Binary files a/.dfx/network/local/state/replicated_state/ic_registry_local_store/0000000000/00/00/01.pb and b/.dfx/network/local/state/replicated_state/ic_registry_local_store/0000000000/00/00/01.pb differ diff --git a/.dfx/network/local/state/replicated_state/ic_registry_local_store/time.local_store.v1.CertificationTime.pb b/.dfx/network/local/state/replicated_state/ic_registry_local_store/time.local_store.v1.CertificationTime.pb index 77f162a7..ec2abef6 100644 --- a/.dfx/network/local/state/replicated_state/ic_registry_local_store/time.local_store.v1.CertificationTime.pb +++ b/.dfx/network/local/state/replicated_state/ic_registry_local_store/time.local_store.v1.CertificationTime.pb @@ -1 +1 @@ -àÞ‡Ù„‰€Ø \ No newline at end of file +ç®Ï„¸š±Ù \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/nns_public_key.pem b/.dfx/network/local/state/replicated_state/nns_public_key.pem index 28dbbd17..67163b4b 100644 --- a/.dfx/network/local/state/replicated_state/nns_public_key.pem +++ b/.dfx/network/local/state/replicated_state/nns_public_key.pem @@ -1,5 +1,5 @@ -----BEGIN PUBLIC KEY----- -MIGCMB0GDSsGAQQBgtx8BQMBAgEGDCsGAQQBgtx8BQMCAQNhAJgQRVWNigWXzedf -djoUHYszPjHeN10mxijgRjyAyYQCIch5Mn8xJ4LZbT7mi9suzQhUppwwINaD5oDm -qLlRdOWU2tH4s8TUYNwFlt8QSRs2XyDTh9L8UApork5waD+aNw== +MIGCMB0GDSsGAQQBgtx8BQMBAgEGDCsGAQQBgtx8BQMCAQNhAK6l/mT/7vkY5aFb +bW3I0ZAsk6cQt3FgJ54ZA8lC135LIwWOmkFTUzmxYn70ERmJ7BE8DzGB1JkN440T +0w6N6ZuWSd3dPMn8A2g417Ubij8LFBSpubmLTVwhVJwrIe9MBg== -----END PUBLIC KEY----- diff --git a/.dfx/network/local/state/replicated_state/node-100/committee_signing_key b/.dfx/network/local/state/replicated_state/node-100/committee_signing_key index 652869a2..20d48068 100644 --- a/.dfx/network/local/state/replicated_state/node-100/committee_signing_key +++ b/.dfx/network/local/state/replicated_state/node-100/committee_signing_key @@ -1,2 +1,3 @@ -`˜iyÒìŒ(é†ú¤~ª¿` ˆóúòžJ¿  8ÞFÆhÚ‚ zßG3¯Õ>‹“¢Ê<ö Um]2lF®Œ*rñL§gÕ”í¢MÆÈ«¨¦,ê_ÒJ¡ì àÒ."2 -0¤ŒÃå4Ÿ[µ‡¦CÃ%,'ªèœ<8æ©Q´8—_¾"NÇ»¡‰¥Šòÿ|8¼ \ No newline at end of file +`I®ª}Úõ>½Õ~ðqú½f6ÖUÉ'i–_x*VN‚ËgI§7ÿ†t/¼ö¤Ô½í×òVïÕn‰©ßÖÇ]» }3lMeȵÄ6{Î(ä¡=Îý +vd»RB"2 +0‰@㪄#oh®mŸ# W"ßü£~$ëw :œ}M)~ˆ÷»Ðš¨ªŒ^ì§Ø \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/crypto/canister_sks_data.pb b/.dfx/network/local/state/replicated_state/node-100/crypto/canister_sks_data.pb index 0d17d43d..3d46921c 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/crypto/canister_sks_data.pb and b/.dfx/network/local/state/replicated_state/node-100/crypto/canister_sks_data.pb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/crypto/public_keys.pb b/.dfx/network/local/state/replicated_state/node-100/crypto/public_keys.pb index 7a2b2999..2b40831d 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/crypto/public_keys.pb and b/.dfx/network/local/state/replicated_state/node-100/crypto/public_keys.pb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/crypto/sks_data.pb b/.dfx/network/local/state/replicated_state/node-100/crypto/sks_data.pb index d4ee9f94..e06602d7 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/crypto/sks_data.pb and b/.dfx/network/local/state/replicated_state/node-100/crypto/sks_data.pb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/derived_node_id b/.dfx/network/local/state/replicated_state/node-100/derived_node_id index 8d3e1b14..8e67ce2d 100644 --- a/.dfx/network/local/state/replicated_state/node-100/derived_node_id +++ b/.dfx/network/local/state/replicated_state/node-100/derived_node_id @@ -1 +1 @@ -wez2k-wvbgy-cd2cn-5z4f3-q75xw-hvdxt-u4n4e-67d4a-5zh25-bhdce-pqe \ No newline at end of file +vfglb-zkuzv-pdvxo-a4flp-gebmk-oqxxo-2sk3p-psalp-6rt6a-575l4-gae \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/data.mdb b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/data.mdb index 68ace915..220d7c89 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/data.mdb and b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/data.mdb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/lock.mdb b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/lock.mdb index 696b1c0e..fed51085 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/lock.mdb and b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/certification/lock.mdb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/data.mdb b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/data.mdb index 6ca2b418..6615a37f 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/data.mdb and b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/data.mdb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/lock.mdb b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/lock.mdb index 687b9dff..16a6ba73 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/lock.mdb and b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/consensus/lock.mdb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/data.mdb b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/data.mdb index 94efaf5a..72f52bea 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/data.mdb and b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/data.mdb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/lock.mdb b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/lock.mdb index da392659..81a0d57f 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/lock.mdb and b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/ecdsa/lock.mdb differ diff --git a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/replica_version b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/replica_version index 8adc70fd..899f24fc 100644 --- a/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/replica_version +++ b/.dfx/network/local/state/replicated_state/node-100/ic_consensus_pool/replica_version @@ -1 +1 @@ -0.8.0 \ No newline at end of file +0.9.0 \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/idkg_mega_encryption_key b/.dfx/network/local/state/replicated_state/node-100/idkg_mega_encryption_key index cba96239..591bd6ec 100644 --- a/.dfx/network/local/state/replicated_state/node-100/idkg_mega_encryption_key +++ b/.dfx/network/local/state/replicated_state/node-100/idkg_mega_encryption_key @@ -1 +1 @@ -!Û.C²¼ãÚ2ðV·•æšúRd† ÀLJ÷®¤ íY \ No newline at end of file +!¥v[P;ó”ñÓ¾DßJ™Øó;Æ?eì¼íáÁ~¼“  \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/ni_dkg_dealing_encryption_key b/.dfx/network/local/state/replicated_state/node-100/ni_dkg_dealing_encryption_key index 97116ed9..cd3daa50 100644 --- a/.dfx/network/local/state/replicated_state/node-100/ni_dkg_dealing_encryption_key +++ b/.dfx/network/local/state/replicated_state/node-100/ni_dkg_dealing_encryption_key @@ -1,4 +1,2 @@ - 0—R7ºÿÒU†šÁ%ÙíøaÌ÷šöÀÝ´Ï&­ˆ,=½SýƾÆpðL¦t]Ô†"° -­¡xGroth20WithPop_Bls12_381£gpop_keyX0— l˜¥}F -Sð¡ŠjÛƒi†=Krq -òrlÊ¡]{zx>H6µ‘özG»ichallengeX Ft,jÞ/Åw¨²æß³À[Ù]µ‹°à>DQèÄa½hresponseX 7œú#d®÷/¦)‰Ü»!O¦³þCñõ£€…C*ȵɒŽhresponseX =@"Œ§è—nÍ;3Z3+êhv‡QÒÿ–Q“Yýi!0‰ \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/node_signing_key b/.dfx/network/local/state/replicated_state/node-100/node_signing_key index eefcf662..16fe6cbc 100644 --- a/.dfx/network/local/state/replicated_state/node-100/node_signing_key +++ b/.dfx/network/local/state/replicated_state/node-100/node_signing_key @@ -1 +1 @@ - ¬FD÷ž5Ù”×TÁÚ€IJÅÁøU¶:%@„L \ No newline at end of file + úÄŒY­¹­QÆÃMÎ ÓDKPvZwB´åʇwê3å—@/ \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/canister.pbuf similarity index 97% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/canister.pbuf rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/canister.pbuf index 56a1caf3..c46513c1 100644 --- a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/canister.pbuf +++ b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/canister.pbuf @@ -1,10 +1,10 @@ -¡œM(Ø:‚Á -Øâ -ðâ -ù¤œ -€¥œ +í (Ôýÿÿÿÿÿÿÿ:Á +¸ª +Ъ +éìœ +ðìœ €€@ -²«Í¸D +¯Å˸D acknowledge_entries add add_tentative_device @@ -36,7 +36,7 @@ $authn_method_registration_mode_enter% remove replace update -verify_tentative_deviceget_anchor_credentialsget_delegation get_id_alias get_principal http_requestidentity_authn_infolookupstats ¡œ*ݹ +verify_tentative_deviceget_anchor_credentialsget_delegation get_id_alias get_principal http_requestidentity_authn_infolookupstats í*ݹ O candid:args@(opt InternetIdentityInit) ˆÂ‘ö¶Q&1ñå)…€ÿ¨˜”®pÐÂYž’á~ ‹¶ @@ -662,22 +662,22 @@ service : (opt InternetIdentityInit) -> { }  ‰Ñúz‘Ⱥf¹Ù£ùð0Áz¦ôŸÚ`৛ ­ -dfx¥þ{"pullable":{"wasm_url": "https://github.com/dfinity/internet-identity/releases/download/release-2024-01-26/internet_identity_dev.wasm.gz","dependencies": [],"init_guide": "Use '(null)' for sensible defaults. See the candid interface for more details."}} òmsa;Pí0›„³2¹{Å49@]4O‰JQ ©â +dfx¥þ{"pullable":{"wasm_url": "https://github.com/dfinity/internet-identity/releases/download/release-2024-02-02/internet_identity_dev.wasm.gz","dependencies": [],"init_guide": "Use '(null)' for sensible defaults. See the candid interface for more details."}} cʯ #FKð‡ŽX|âŠb·}"ÛQ•hsÙâlÿð K -supported_certificate_versions)1,2 ŽÔ»bØ—øÑŒ;ZâFATbà€'¨ø_¿M»'‡&û—2 ·8ÍH5–¤Ðä9>øu¹ÞѤ;ÿûlYôi 3¼8Z -MxQˆ´œQ¢ 3¦ÃÛ‡„ňnbtF%6su¤S¼X¤º’‰ 0ž*Wò²Ÿ¯û帀šžÊ -Òah»óòZØ‚ú -ùŽŒÌ¥‹ºØ‚R¢ ¨ì‹¢ Ê”°¢ 嶹V¢È÷ªW -¦ÙŒ¶½š€Ø +supported_certificate_versions)1,2 ŽÔ»bØ—øÑŒ;ZâFATbà€'¨ø_¿M»'‡&û—2 ‘Bèv–;BTÃÙ Ü¿7õ°´Mpócòµ»¯ çò•î8Z + xˆ€%¢ à,iü¸5{ X-äæøp_ÏÔnÃq…Û‚Oæ™Ô²¤²–ϸ€šžÊ +Òܦ”öòZØ‚ú +þÓœëØó³Ù‚¢ãäW¢ ‘­–|¢ Úæ£R¢Ö¹ªW +˜Ø•©±Ù  *   -9ˆŸÄÒÏš€Ø +9êéÅ©©±Ù  -:$ ·8ÍH5–¤Ðä9>øu¹ÞѤ;ÿûlYôi 3¼²ºP9'ŒÂÊP +:$ ‘Bèv–;BTÃÙ Ü¿7õ°´Mpócòµ»¯ çò•î²ºP9'ŒÂÊP    " - \ No newline at end of file +Ð \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/software.wasm new file mode 100644 index 00000000..1faabd86 Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/software.wasm differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/stable_memory.bin similarity index 96% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/stable_memory.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/stable_memory.bin index d75a391f..784ffa60 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/stable_memory.bin and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/stable_memory.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/vmemory_0.bin similarity index 84% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/vmemory_0.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/vmemory_0.bin index 5d9276a2..afbd6f2d 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/wasm_chunk_store.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/wasm_chunk_store.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/wasm_chunk_store.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/00000000000000070101/wasm_chunk_store.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/canister.pbuf similarity index 63% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/canister.pbuf rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/canister.pbuf index bbf45c02..d8fd0b79 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/canister.pbuf and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/canister.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/software.wasm similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/software.wasm rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/software.wasm diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/stable_memory.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/stable_memory.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/stable_memory.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/vmemory_0.bin similarity index 99% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/vmemory_0.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/vmemory_0.bin index d9872ffb..032a9230 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/wasm_chunk_store.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/wasm_chunk_store.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000000101/wasm_chunk_store.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000000101/wasm_chunk_store.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/canister.pbuf similarity index 95% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/canister.pbuf rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/canister.pbuf index e937d5b6..f9c84677 100644 --- a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/canister.pbuf +++ b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/canister.pbuf @@ -1,12 +1,12 @@ -Š (Ðöÿÿÿÿÿÿÿ:‡J +„':†J ˜ÝR  ÝR €€@ -Ñþè¸ +Øèæ¸ icrc1_transfer!__get_candid_interface_tmp_hack archives  get_blocksget_data_certificateget_transactions http_requesticrc1_balance_oficrc1_decimals  icrc1_feeicrc1_metadataicrc1_minting_account  -icrc1_nameicrc1_supported_standards icrc1_symbolicrc1_total_supply Š *úF +icrc1_nameicrc1_supported_standards icrc1_symbolicrc1_total_supply „'*úF •F candid:service‚FÛEtype BlockIndex = nat; type Subaccount = blob; @@ -288,14 +288,13 @@ service : (ledger_arg : LedgerArg) -> { ` git_commit_idO)b3b00ba59c366384e3e0cd53a69457e9053ec987  }Ÿoáù½>§#c,‹%´ ÇgNÔ]{íï Ç'øG\2 ×% äÍC.QÍÚföL4ìb("ɬS…é‰28Z -x -ˆùŸ’¢ î6Œv(tŠW<·ÆǬ:"Š3mc aôILD^|½éûÖ²ëÖ´¸€šžÊ +xˆñ&›¢ ¾4Ò=5=B^o“nnfU |2ë‘P5z(AÏÿTt²á¶Ö‚¸€šžÊ €Ê -mxFìû¬ÄË%Á&Zˆ L@‹,G±,–1U0aÒ•ì¸äÏú -ùŽŒÌ¥‹ºØ‚¢ ñ„ü¢ ë‹ÒW¢ £¬é^¢ +œùE«h¿î#7l#†Ÿ¡ ò€˜âå7±U²^ÒŸ|æÏú +þÓœëØó³Ù‚¢÷þ¢ ÓÇ’W¢ «ÖµW¢ ì™ýÓª¦ -KëÓº¹ø‰€Ø" +Kµ§×–ó›±Ù" €*/ @@ -303,12 +302,12 @@ K €  -mxFìû¬ÄË%Á&Zˆ L@‹,G±,–1U0a -Uö¾ý÷Њ€Ø! +œùE«h¿î#7l#†Ÿ¡ ò€˜âå7±U²^ +U뽸ì±Ù!  -mxFìû¬ÄË%Á&Zˆ L@‹,G±,–1U0a:$ ×% äÍC.QÍÚföL4ìb("ɬS…é‰2²ºP9'ŒÂÊP +œùE«h¿î#7l#†Ÿ¡ ò€˜âå7±U²^:$ ×% äÍC.QÍÚföL4ìb("ɬS…é‰2²ºP9'ŒÂÊP    " - \ No newline at end of file +Ð \ No newline at end of file diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/software.wasm similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/software.wasm rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/software.wasm diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/stable_memory.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/stable_memory.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/stable_memory.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/vmemory_0.bin similarity index 97% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/vmemory_0.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/vmemory_0.bin index 5f56e873..55b69da0 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/wasm_chunk_store.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/wasm_chunk_store.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000010101/wasm_chunk_store.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000010101/wasm_chunk_store.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/canister.pbuf new file mode 100644 index 00000000..5d21f868 Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/canister.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/software.wasm new file mode 100644 index 00000000..4947bd8d Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/software.wasm differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/stable_memory.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/stable_memory.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/stable_memory.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/vmemory_0.bin similarity index 67% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/vmemory_0.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/vmemory_0.bin index c23379c9..39497969 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/wasm_chunk_store.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/wasm_chunk_store.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/wasm_chunk_store.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000020101/wasm_chunk_store.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/canister.pbuf new file mode 100644 index 00000000..4c37c07f Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/canister.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/software.wasm new file mode 100644 index 00000000..f6ca6cc0 Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/software.wasm differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/stable_memory.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/stable_memory.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/stable_memory.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/vmemory_0.bin similarity index 75% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/vmemory_0.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/vmemory_0.bin index 5c24acb3..a935d1c7 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/wasm_chunk_store.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/wasm_chunk_store.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/wasm_chunk_store.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000030101/wasm_chunk_store.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/canister.pbuf similarity index 77% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/canister.pbuf rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/canister.pbuf index 3f1456f0..4f43fb81 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/canister.pbuf and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/canister.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/queues.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/queues.pbuf similarity index 62% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/queues.pbuf rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/queues.pbuf index 2870cc6f..fee1b805 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/queues.pbuf and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/queues.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/software.wasm similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/software.wasm rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/software.wasm diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/stable_memory.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/stable_memory.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/stable_memory.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/vmemory_0.bin similarity index 55% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/vmemory_0.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/vmemory_0.bin index 3b2958e6..25a7278c 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/wasm_chunk_store.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/wasm_chunk_store.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000040101/wasm_chunk_store.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000040101/wasm_chunk_store.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/canister.pbuf similarity index 85% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/canister.pbuf rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/canister.pbuf index 29f49d55..3dc62228 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/canister.pbuf and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/canister.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/software.wasm new file mode 100644 index 00000000..2796c34f Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/software.wasm differ diff --git a/.dfx/network/local/ic-ref.port b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/stable_memory.bin similarity index 100% rename from .dfx/network/local/ic-ref.port rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/stable_memory.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/vmemory_0.bin new file mode 100644 index 00000000..fb826996 Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/wasm_chunk_store.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/wasm_chunk_store.bin similarity index 100% rename from .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/wasm_chunk_store.bin rename to .dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/canister_states/80000000001000050101/wasm_chunk_store.bin diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/system_metadata.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/system_metadata.pbuf new file mode 100644 index 00000000..7e4c59b3 Binary files /dev/null and b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000001388/system_metadata.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/software.wasm deleted file mode 100644 index 5053f0d4..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/00000000000000070101/software.wasm and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/canister.pbuf deleted file mode 100644 index 0199820b..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/canister.pbuf and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/software.wasm deleted file mode 100644 index 1b9bc457..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/software.wasm and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/stable_memory.bin deleted file mode 100644 index 08e7df17..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000020101/stable_memory.bin and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/canister.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/canister.pbuf deleted file mode 100644 index 496a4b3b..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/canister.pbuf and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/software.wasm deleted file mode 100644 index 9458baa7..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000030101/software.wasm and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/software.wasm deleted file mode 100644 index db405979..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/software.wasm and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/vmemory_0.bin deleted file mode 100644 index 55df6295..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/canister_states/80000000001000050101/vmemory_0.bin and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/system_metadata.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/system_metadata.pbuf deleted file mode 100644 index 67ef73d4..00000000 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/checkpoints/0000000000005014/system_metadata.pbuf and /dev/null differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/states_metadata.pbuf b/.dfx/network/local/state/replicated_state/node-100/state/states_metadata.pbuf index 2c8a04c2..b551d418 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/states_metadata.pbuf and b/.dfx/network/local/state/replicated_state/node-100/state/states_metadata.pbuf differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/software.wasm index 5053f0d4..1faabd86 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/software.wasm and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/software.wasm differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/stable_memory.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/stable_memory.bin index 6228f9c7..784ffa60 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/stable_memory.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/stable_memory.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/vmemory_0.bin index 869b906c..afbd6f2d 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/00000000000000070101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000000101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000000101/vmemory_0.bin index d9872ffb..032a9230 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000000101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000000101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000010101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000010101/vmemory_0.bin index 5f56e873..55b69da0 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000010101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000010101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/software.wasm index 1b9bc457..4947bd8d 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/software.wasm and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/software.wasm differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/vmemory_0.bin index 6ab8ea4f..39da4046 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000020101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/software.wasm index 9458baa7..f6ca6cc0 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/software.wasm and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/software.wasm differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/vmemory_0.bin index 5c24acb3..a935d1c7 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000030101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000040101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000040101/vmemory_0.bin index 9ac9f2b2..716ac4d9 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000040101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000040101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/software.wasm b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/software.wasm index db405979..2796c34f 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/software.wasm and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/software.wasm differ diff --git a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/vmemory_0.bin b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/vmemory_0.bin index 55df6295..fb826996 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/vmemory_0.bin and b/.dfx/network/local/state/replicated_state/node-100/state/tip/canister_states/80000000001000050101/vmemory_0.bin differ diff --git a/.dfx/network/local/state/replicated_state/node-100/transport_tls_certificate b/.dfx/network/local/state/replicated_state/node-100/transport_tls_certificate index ff5255be..ae787225 100644 Binary files a/.dfx/network/local/state/replicated_state/node-100/transport_tls_certificate and b/.dfx/network/local/state/replicated_state/node-100/transport_tls_certificate differ diff --git a/.dfx/network/local/state/replicated_state/registry.proto b/.dfx/network/local/state/replicated_state/registry.proto index b52854a4..d64fbd5c 100644 Binary files a/.dfx/network/local/state/replicated_state/registry.proto and b/.dfx/network/local/state/replicated_state/registry.proto differ diff --git a/.env b/.env index e7fd7846..33e977dc 100644 --- a/.env +++ b/.env @@ -1,26 +1,13 @@ # DFX CANISTER ENVIRONMENT VARIABLES -DFX_VERSION='0.15.1' +DFX_VERSION='0.16.1' DFX_NETWORK='local' -CANISTER_CANDID_PATH_backend='/home/cosmas/harambeeapps/ic-payroll/.dfx/local/canisters/backend/backend.did' -CANISTER_CANDID_PATH_BACKEND='/home/cosmas/harambeeapps/ic-payroll/.dfx/local/canisters/backend/backend.did' -CANISTER_CANDID_PATH_internet_identity='/home/cosmas/harambeeapps/ic-payroll/deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did' -CANISTER_CANDID_PATH_INTERNET_IDENTITY='/home/cosmas/harambeeapps/ic-payroll/deps/candid/rdmx6-jaaaa-aaaaa-aaadq-cai.did' -INTERNET_IDENTITY_CANISTER_ID='rdmx6-jaaaa-aaaaa-aaadq-cai' -CANISTER_ID_INTERNET_IDENTITY='rdmx6-jaaaa-aaaaa-aaadq-cai' -CANISTER_ID_internet_identity='rdmx6-jaaaa-aaaaa-aaadq-cai' -ICRC1_INDEX_CANISTER_ID='br5f7-7uaaa-aaaaa-qaaca-cai' -CANISTER_ID_ICRC1_INDEX='br5f7-7uaaa-aaaaa-qaaca-cai' -CANISTER_ID_icrc1_index='br5f7-7uaaa-aaaaa-qaaca-cai' CKBTC_LEDGER_CANISTER_ID='bkyz2-fmaaa-aaaaa-qaaaq-cai' CANISTER_ID_CKBTC_LEDGER='bkyz2-fmaaa-aaaaa-qaaaq-cai' CANISTER_ID_ckbtc_ledger='bkyz2-fmaaa-aaaaa-qaaaq-cai' BACKEND_CANISTER_ID='bd3sg-teaaa-aaaaa-qaaba-cai' CANISTER_ID_BACKEND='bd3sg-teaaa-aaaaa-qaaba-cai' CANISTER_ID_backend='bd3sg-teaaa-aaaaa-qaaba-cai' -ASSETS_CANISTER_ID='bw4dl-smaaa-aaaaa-qaacq-cai' -CANISTER_ID_ASSETS='bw4dl-smaaa-aaaaa-qaacq-cai' -CANISTER_ID_assets='bw4dl-smaaa-aaaaa-qaacq-cai' -CANISTER_ID='bw4dl-smaaa-aaaaa-qaacq-cai' -CANISTER_CANDID_PATH='/home/cosmas/harambeeapps/ic-payroll/.dfx/local/canisters/assets/assetstorage.did' +CANISTER_ID='bkyz2-fmaaa-aaaaa-qaaaq-cai' +CANISTER_CANDID_PATH='/home/cosmas/harambeeapps/ic-payroll/icrc1.public.did' # END DFX CANISTER ENVIRONMENT VARIABLES \ No newline at end of file diff --git a/README.md b/README.md index 89749716..5e45daa8 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,19 @@ The frontend interacts with the following IC canisters: - [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/index.mdx). - [x] Install [Node.js](https://nodejs.org/en/). +### Use the package,,json scripts to automate the whole process or run the subsequent commands manually +```bash +npm run start +``` + ### Step 1: Start a local instance of the Internet Computer ```bash dfx start --clean --background ``` + + + ### Step 2: Deploy the Internet Identity canister Integration with the [Internet Identity](https://internetcomputer.org/internet-identity/) allows store owners to securely setup and manage their store. The Internet Identity canister is already deployed on the IC mainnet. For local development, you need to deploy it to your local instance of the IC. @@ -136,7 +144,7 @@ The backend canister manages the user configuration and sends notifications when The `--argument '(0)'` argument is used to initialize the canister with `startBlock` set to 0. This is used to tell the canister to start monitoring the ledger from block 0. When deploying to the IC mainnet, this should be set to the current block height to prevent the canister from processing old transactions. ```bash -dfx deploy --network local icpos --argument '(0)' +dfx deploy --network local backend --argument '(0)' ``` ### Step 6: Configure the backend canister diff --git a/canisters/backend/Account.mo b/canisters/backend/Account.mo new file mode 100644 index 00000000..824b92bf --- /dev/null +++ b/canisters/backend/Account.mo @@ -0,0 +1,60 @@ +import CRC32 "./CRC32"; +import SHA224 "./SHA224"; + +import Array "mo:base/Array"; +import Blob "mo:base/Blob"; +import Buffer "mo:base/Buffer"; +import Nat32 "mo:base/Nat32"; +import Nat8 "mo:base/Nat8"; +import Principal "mo:base/Principal"; +import Text "mo:base/Text"; + +module { + // 32-byte array. + public type AccountIdentifier = Blob; + // 32-byte array. + public type Subaccount = Blob; + + public func beBytes(n : Nat32) : [Nat8] { + func byte(n : Nat32) : Nat8 { + Nat8.fromNat(Nat32.toNat(n & 0xff)) + }; + [byte(n >> 24), byte(n >> 16), byte(n >> 8), byte(n)] + }; + + public func defaultSubaccount() : Subaccount { + Blob.fromArrayMut(Array.init(32, 0 : Nat8)) + }; + + public func accountIdentifier(principal : Principal, subaccount : Subaccount) : AccountIdentifier { + let hash = SHA224.Digest(); + hash.write([0x0A]); + hash.write(Blob.toArray(Text.encodeUtf8("account-id"))); + hash.write(Blob.toArray(Principal.toBlob(principal))); + hash.write(Blob.toArray(subaccount)); + let hashSum = hash.sum(); + let crc32Bytes = beBytes(CRC32.ofArray(hashSum)); + let buf = Buffer.Buffer(32); + Blob.fromArray(Array.append(crc32Bytes, hashSum)) + }; + + public func validateAccountIdentifier(accountIdentifier : AccountIdentifier) : Bool { + if (accountIdentifier.size() != 32) { + return false; + }; + let a = Blob.toArray(accountIdentifier); + let accIdPart = Array.tabulate(28, func(i : Nat) : Nat8 { a[i + 4] }); + let checksumPart = Array.tabulate(4, func(i : Nat) : Nat8 { a[i] }); + let crc32 = CRC32.ofArray(accIdPart); + Array.equal(beBytes(crc32), checksumPart, Nat8.equal) + }; + + public func principalToSubaccount(principal : Principal) : Blob { + let idHash = SHA224.Digest(); + idHash.write(Blob.toArray(Principal.toBlob(principal))); + let hashSum = idHash.sum(); + let crc32Bytes = beBytes(CRC32.ofArray(hashSum)); + let buf = Buffer.Buffer(32); + Blob.fromArray(Array.append(crc32Bytes, hashSum)); + }; +} diff --git a/canisters/backend/Hex.mo b/canisters/backend/Hex.mo new file mode 100644 index 00000000..310b72d6 --- /dev/null +++ b/canisters/backend/Hex.mo @@ -0,0 +1,105 @@ +/** + * Module : Hex.mo + * Description : Hexadecimal encoding and decoding routines. + * Copyright : 2022 Dfinity + * License : Apache 2.0> + */ + +import Array "mo:base/Array"; +import Iter "mo:base/Iter"; +import Option "mo:base/Option"; +import Nat8 "mo:base/Nat8"; +import Char "mo:base/Char"; +import Result "mo:base/Result"; +import Text "mo:base/Text"; +import Prim "mo:â›”"; + +module { + + private type Result = Result.Result; + + private let base : Nat8 = 0x10; + + private let symbols = [ + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', + ]; + + /** + * Define a type to indicate that the decoder has failed. + */ + public type DecodeError = { + #msg : Text; + }; + + /** + * Encode an array of unsigned 8-bit integers in hexadecimal format. + */ + public func encode(array : [Nat8]) : Text { + let encoded = Array.foldLeft(array, "", func (accum, w8) { + accum # encodeW8(w8); + }); + // encode as lowercase + return Text.map(encoded, Prim.charToLower); + }; + + /** + * Encode an unsigned 8-bit integer in hexadecimal format. + */ + private func encodeW8(w8 : Nat8) : Text { + let c1 = symbols[Nat8.toNat(w8 / base)]; + let c2 = symbols[Nat8.toNat(w8 % base)]; + Char.toText(c1) # Char.toText(c2); + }; + + /** + * Decode an array of unsigned 8-bit integers in hexadecimal format. + */ + public func decode(text : Text) : Result<[Nat8], DecodeError> { + // Transform to uppercase for uniform decoding + let upper = Text.map(text, Prim.charToUpper); + let next = upper.chars().next; + func parse() : Result { + Option.get>( + do ? { + let c1 = next()!; + let c2 = next()!; + Result.chain(decodeW4(c1), func (x1) { + Result.chain(decodeW4(c2), func (x2) { + #ok (x1 * base + x2); + }) + }) + }, + #err (#msg "Not enough input!"), + ); + }; + var i = 0; + let n = upper.size() / 2 + upper.size() % 2; + let array = Array.init(n, 0); + while (i != n) { + switch (parse()) { + case (#ok w8) { + array[i] := w8; + i += 1; + }; + case (#err err) { + return #err err; + }; + }; + }; + #ok (Array.freeze(array)); + }; + + /** + * Decode an unsigned 4-bit integer in hexadecimal format. + */ + private func decodeW4(char : Char) : Result { + for (i in Iter.range(0, 15)) { + if (symbols[i] == char) { + return #ok (Nat8.fromNat(i)); + }; + }; + let str = "Unexpected character: " # Char.toText(char); + #err (#msg str); + }; +}; diff --git a/canisters/backend/main.mo b/canisters/backend/main.mo index 7810376d..94fd0248 100644 --- a/canisters/backend/main.mo +++ b/canisters/backend/main.mo @@ -8,7 +8,7 @@ import Blob "mo:base/Blob"; import Char "mo:base/Char"; import CkBtcLedger "canister:ckbtc_ledger"; import Types "./types"; -import { toAccount; toSubaccount;defaultSubaccount } "./utils"; +import { toAccount; toSubaccount; defaultSubaccount } "./utils"; import Error "mo:base/Error"; import Nat "mo:base/Nat"; import Debug "mo:base/Debug"; @@ -25,48 +25,52 @@ import Cycles "mo:base/ExperimentalCycles"; import Buffer "mo:base/Buffer"; import Nat8 "mo:base/Nat8"; import Iter "mo:base/Iter"; -import SHA224 "./SHA224"; -import CRC32 "./CRC32"; - - +import SHA224 "./SHA224"; +import CRC32 "./CRC32"; +import Hash "mo:base/Hash"; +import Hex "./Hex"; shared (actorContext) actor class Backend(_startBlock : Nat) = this { + // #region Types + type Account = Types.Account; + type AccountIdentifier = Types.AccountIdentifier; + type Transaction = Types.Transaction; + type User = Types.User; + type Notification = Types.Notification; + public type TransactionId = Nat32; +// #endregion + let addressConverter_ = Utils.addressConverter; - // The type of a user identifier. - public type UserId = Nat32; - public type TransactionId = Nat32; +// The next available transaction identifier. private stable var latestTransactionIndex : Nat = 0; private stable var courierApiKey : Text = ""; private var logData = Buffer.Buffer(0); - private stable var next : UserId = 0; + // The user data store. The key is the user's principal ID. + private stable var userStore : Trie.Trie = Trie.empty(); -public shared ({ caller }) func getAddress() : async Text { - let acc : Types.Account = { - owner = Principal.fromActor(this); - subaccount = ?toSubaccount(caller); + + public shared ({ caller }) func getAddress() : async Text { + let acc : Types.Account = { + owner = Principal.fromActor(this); + subaccount = ?toSubaccount(caller); + }; + let address = addressConverter_.toText(acc); + Debug.print("address: is " # debug_show (address)); + return address; }; - let address = addressConverter_.toText(acc); - Debug.print("address: is " # debug_show (address)); - return address; -}; - // The user data store. - //private stable var users : Trie.Trie = Trie.empty(); - private stable var userStore : Trie.Trie = Trie.empty(); - private stable var transactions : Trie.Trie = Trie.empty(); - // private stable var userlist : TrieMap.TrieMap(1, Principal.equal, Principal.hash); /** * High-Level API */ - /** + /** * Get the merchant's information */ - public query (context) func getUser() : async Types.Response { + public query (context) func getUser() : async Types.Response { let caller : Principal = context.caller; switch (Trie.get(userStore, userKey(Principal.toText(caller)), Text.equal)) { @@ -89,15 +93,35 @@ public shared ({ caller }) func getAddress() : async Text { }; }; - /** + + /** + * Check if user exists and return Bool + */ + public query (context) func userExists() : async Bool { + let caller : Principal = context.caller; + + switch (Trie.get(userStore, userKey(Principal.toText(caller)), Text.equal)) { + case (?user) { + return true; + }; + case null { + return false; + }; + }; + }; + + + + + /** * Update the merchant's information */ - public shared (context) func updateUser(user : Types.User) : async Types.Response { + public shared (context) func updateUser(user : User) : async Types.Response { let caller : Principal = context.caller; userStore := Trie.replace( userStore, - userKey(user.wallet), + userKey(Principal.toText(caller)), Text.equal, ?user, ).0; @@ -109,30 +133,8 @@ public shared ({ caller }) func getAddress() : async Text { }; }; - /** - * Delete the users's information - */ - public shared (context) func deleteUser(wallet : Text) : async Types.Response { - // let caller : Principal = context.caller; - let result = Trie.find(userStore, userKey(wallet), Text.equal); - let exists = Option.isSome(result); - if (exists) { - userStore := Trie.replace( - userStore, - userKey(wallet), - Text.equal, - null, - ).0; - }; - { - status = 200; - status_text = "OK"; - data = ?"User deleted"; - error_text = null; - }; - - - }; + + //no of users public query func userLength() : async Text { @@ -140,29 +142,24 @@ public shared ({ caller }) func getAddress() : async Text { return Nat.toText(size); }; - public query func getUsersList() : async [(Text, Types.User)] { - let usersArray : [(Text, Types.User)] = Iter.toArray(Trie.iter(userStore)); - Debug.print(debug_show(usersArray)); + public query func getUsersList() : async [(Text, User)] { + let usersArray : [(Text, User)] = Iter.toArray(Trie.iter(userStore)); + Debug.print(debug_show (usersArray)); return usersArray; }; - //no of transactions - public query func transactionsLength() : async Text { - var size = Trie.size(transactions); - return Nat.toText(size); - }; + public shared ({ caller }) func whoami() : async Principal { return caller; }; public shared ({ caller }) func getInvoice() : async Types.Account { - Debug.print(debug_show(toAccount({ caller; canister = Principal.fromActor(this) }))); + Debug.print(debug_show (toAccount({ caller; canister = Principal.fromActor(this) }))); return toAccount({ caller; canister = Principal.fromActor(this) }); }; - public shared ({ caller }) func getFundingBalance() : async Text { let balance = await CkBtcLedger.icrc1_balance_of( @@ -177,10 +174,10 @@ public shared ({ caller }) func getAddress() : async Text { public shared ({ caller }) func getTradingBalance() : async Text { let balance = await CkBtcLedger.icrc1_balance_of( - { + { owner = Principal.fromActor(this); subaccount = ?toSubaccount(caller); - }, + } ); return Nat.toText(balance); }; @@ -225,7 +222,7 @@ public shared ({ caller }) func getAddress() : async Text { //transfer funds from the default canister subaccount to the user subaccount //Works - public shared ({ caller }) func transferFromCanistertoSubAccount() : async Result.Result { + public shared ({ caller }) func transferFromCanistertoSubAccount() : async Result.Result { // check ckBTC balance of the callers dedicated account let balance = await CkBtcLedger.icrc1_balance_of( @@ -274,8 +271,8 @@ public shared ({ caller }) func getAddress() : async Text { //transfer from one subaccount to another //works - public shared ({ caller }) func transferFromSubAccountToSubAccount(receiver : Text, amount : Nat) : async Result.Result { - + public shared ({ caller }) func transferFromSubAccountToSubAccount(receiver : Text, amount : Nat) : async Types.Response { + // check ckBTC balance of the callers dedicated account let balance = await CkBtcLedger.icrc1_balance_of( { @@ -284,11 +281,17 @@ public shared ({ caller }) func getAddress() : async Text { } ); - if (balance < 100) { - return #err("Not enough funds available in the Account. Make sure you send at least 100 ckSats."); - }; + let fee = 10; + let total = amount + fee; - Debug.print(" su acc balance: is " # debug_show (balance)); + if (balance < total) { + return { + status = 403; + status_text = "Forbidden"; + data = null; + error_text = ?"Not enough funds available in the Account. You need 10 Sats for the transaction fee."; + }; + }; try { // if enough funds were sent, move them to the canisters default account @@ -306,22 +309,66 @@ public shared ({ caller }) func getAddress() : async Text { } ); - Debug.print("fom subaccount transferresult: is " # debug_show (transferResult)); - switch (transferResult) { case (#Err(transferError)) { - return #err("Couldn't transfer funds to default account:\n" # debug_show (transferError)); + return { + status = 405; + status_text = "Forbidden"; + data = null; + error_text = ?"Couldn't transfer funds to account:\n"; + }; + + // return #err("Couldn't transfer funds to account:\n" # debug_show (transferError)); }; case (_) {}; }; } catch (error : Error) { - return #err("Reject message: " # Error.message(error)); + return { + status = 406; + status_text = "Rejected"; + data = null; + error_text = ?"Reject message: "; + }; + // return #err("Reject message: " # Error.message(error)); }; - return #ok("🥠: " # "success"); - }; +let transaction : Transaction = { + from = Principal.toText(caller); + to= receiver; + amount= Nat.toText(amount); + }; + + // let data = await saveTransaction(transaction); + + // if (data.status == 200) { + // Debug.print("transaction: is successful "); + // return { + // status = 200; + // status_text = "Transfer to " # receiver # " is successful"; + // data = ?transaction; + // error_text = ?""; + // }; + // }else{ + // Debug.print("transaction: is successful "); + // return { + // status = 405; + // status_text = "Forbidden"; + // data = null; + // error_text = ?"Couldn't transfer funds to account:\n"; + // }; + // }; + + return { + status = 200; + status_text = "Transfer to " # receiver # " is successful"; + data = ?transaction; + error_text = ?""; + }; + + }; + //transfer from account to canister subaccount //works public shared ({ caller }) func transferFromSubAccountToCanister(amount : Nat) : async Result.Result { @@ -338,8 +385,6 @@ public shared ({ caller }) func getAddress() : async Text { return #err("Not enough funds available in Personal Account. Make sure you send at least 100 ckSats."); }; - Debug.print("Personal Account Balance: is " # debug_show (balance)); - try { // if enough funds were sent, move them to the canisters default account let transferResult = await CkBtcLedger.icrc1_transfer( @@ -356,8 +401,6 @@ public shared ({ caller }) func getAddress() : async Text { } ); - Debug.print("fom personal account to trading account balance is : " # debug_show (transferResult)); - switch (transferResult) { case (#Err(transferError)) { return #err("Couldn't transfer funds to trading account:\n" # debug_show (transferError)); @@ -368,7 +411,7 @@ public shared ({ caller }) func getAddress() : async Text { return #err("Reject message: " # Error.message(error)); }; - return #ok("🥠: " # "success"); + return #ok("Transfer to trading account is " # "successful"); }; /** @@ -376,17 +419,18 @@ public shared ({ caller }) func getAddress() : async Text { */ // Test two user identifiers for equality. - private func eq(x : UserId, y : UserId) : Bool { + private func eq(x : Nat32, y : Nat32) : Bool { return x == y; }; - /** + /** * Generate a Trie key based on a merchant's principal ID */ private func userKey(x : Text) : Trie.Key { return { hash = Text.hash(x); key = x }; }; + /** * Set the courier API key. Only the owner can set the courier API key. */ @@ -439,7 +483,36 @@ public shared ({ caller }) func getAddress() : async Text { await notify(); }; - /** + // #region get_account_identifier + /* + * Get Caller Identifier + * Allows a caller to the accountIdentifier for a given principal + * for a specific token. + */ + public query func get_account_identifier (args : Types.GetAccountIdentifierArgs) : async Types.GetAccountIdentifierResult { + let principal = args.principal; + let canisterId = Principal.fromActor(this); + + let subaccount = Utils.getDefaultAccount({principal; canisterId;}); + let hexEncoded = Hex.encode( + Blob.toArray(subaccount) + ); + let result : AccountIdentifier = #text(hexEncoded); + #ok({accountIdentifier = result}); + + }; +// #endregion + +// #region Utils + public func accountIdentifierToBlob (accountIdentifier : Types.AccountIdentifier) : async Types.AccountIdentifierToBlobResult { + Utils.accountIdentifierToBlob({ + accountIdentifier; + canisterId = ?Principal.fromActor(this); + }); + }; +// #endregion + + /** * Notify the merchant if a new transaction is found. */ private func notify() : async () { @@ -464,7 +537,7 @@ public shared ({ caller }) func getAddress() : async Text { switch (Trie.get(userStore, userKey(Principal.toText(to)), Text.equal)) { case (?user) { if (user.email_notifications or user.phone_notifications) { - log("Sending notification to: " # debug_show (user.email)); + log("Sending notification to: " # debug_show (user.email_address)); await sendNotification(user, t); }; }; @@ -481,11 +554,10 @@ public shared ({ caller }) func getAddress() : async Text { }; }; - /** * Send a notification to a merchant about a received payment */ - private func sendNotification(user : Types.User, transaction : CkBtcLedger.Transaction) : async () { + private func sendNotification(user : User, transaction : CkBtcLedger.Transaction) : async () { // Managment canister let ic : HttpTypes.IC = actor ("aaaaa-aa"); @@ -500,7 +572,7 @@ public shared ({ caller }) func getAddress() : async Text { case null {}; }; let idempotencyKey : Text = Text.concat(user.name, Nat64.toText(transaction.timestamp)); - let requestBodyJson : Text = "{ \"idempotencyKey\": \"" # idempotencyKey # "\", \"email\": \"" # user.email # "\", \"phone\": \"" # user.phone # "\", \"amount\": \"" # amount # "\", \"payer\": \"" # from # "\"}"; + let requestBodyJson : Text = "{ \"idempotencyKey\": \"" # idempotencyKey # "\", \"email\": \"" # user.email_address # "\", \"phone\": \"" # user.phone_number # "\", \"amount\": \"" # amount # "\", \"payer\": \"" # from # "\"}"; let requestBodyAsBlob : Blob = Text.encodeUtf8(requestBodyJson); let requestBodyAsNat8 : [Nat8] = Blob.toArray(requestBodyAsBlob); @@ -508,6 +580,7 @@ public shared ({ caller }) func getAddress() : async Text { let httpRequest : HttpTypes.HttpRequestArgs = { // The notification service is hosted on Netlify and the URL is hardcoded // in this example. In a real application, the URL would be configurable. + // url = "https://icpos-notifications.xyz/.netlify/functions/notify"; url = "https://icpos-notifications.xyz/.netlify/functions/notify"; max_response_bytes = ?Nat64.fromNat(1000); headers = [ diff --git a/canisters/backend/types.mo b/canisters/backend/types.mo index a7b2954c..d0327443 100644 --- a/canisters/backend/types.mo +++ b/canisters/backend/types.mo @@ -1,8 +1,19 @@ import Principal "mo:base/Principal"; import Time "mo:base/Time"; import Nat32 "mo:base/Nat32"; +import Blob "mo:base/Blob"; +import Text "mo:base/Text"; +import Result "mo:base/Result"; + module { public type Subaccount = Blob; + + public type AccountIdentifier = { + #text : Text; + #principal : Principal; + #blob : Blob; + }; + public type Account = { owner : Principal; subaccount : ?Subaccount; @@ -23,23 +34,38 @@ module { modified_at : Int; }; - public type Transaction = { - from : Principal; - to : Principal; - amount : Nat; - memo : Text; - created_at : Int; + // public type Transaction = { + // id : Text; + // from : Principal; + // to : Principal; + // amount : Nat; + // memo : Text; + // created_at : Int; + // }; + public type Transaction = { + from : Text; + to : Text; + amount : Text; }; // New type for User - public type User = { + // public type User = { + // // admin : Principal; + // name : Text; + // email : Text; + // email_notifications : Bool; + // phone : Text; + // phone_notifications : Bool; + // wallet : Text; + // created_at : Int; + // }; + + public type User = { name : Text; - email : Text; email_notifications : Bool; - phone : Text; + email_address : Text; phone_notifications : Bool; - wallet : Text; - created_at : Int; + phone_number : Text; }; public type Response = { @@ -53,6 +79,52 @@ module { receiver : Text; amount : Nat; time : Text; + isSuccessful : Bool; + }; + + // #region get_caller_identifier + public type GetAccountIdentifierArgs = { + principal : Principal; + }; + public type GetAccountIdentifierResult = Result.Result; + public type GetAccountIdentifierSuccess = { + accountIdentifier : AccountIdentifier; + }; + public type GetAccountIdentifierErr = { + message : ?Text; + }; +// #endregion + + // #region accountIdentifierToBlob + public type AccountIdentifierToBlobArgs = { + accountIdentifier : AccountIdentifier; + canisterId : ?Principal; + }; + public type AccountIdentifierToBlobResult = Result.Result; + public type AccountIdentifierToBlobSuccess = Blob; + public type AccountIdentifierToBlobErr = { + message : ?Text; + kind : { + #InvalidAccountIdentifier; + #Other; + }; + }; +// #endregion + +// #region accountIdentifierToText + public type AccountIdentifierToTextArgs = { + accountIdentifier : AccountIdentifier; + canisterId : ?Principal; + }; + public type AccountIdentifierToTextResult = Result.Result; + public type AccountIdentifierToTextSuccess = Text; + public type AccountIdentifierToTextErr = { + message : ?Text; + kind : { + #InvalidAccountIdentifier; + #Other; + }; }; +// #endregion }; diff --git a/canisters/backend/utils.mo b/canisters/backend/utils.mo index aa7a68eb..db24fbb6 100644 --- a/canisters/backend/utils.mo +++ b/canisters/backend/utils.mo @@ -10,9 +10,13 @@ import Prelude "mo:base/Prelude"; import Time "mo:base/Time"; import Sha256 "mo:sha2/Sha256"; import ICRC1_AccountConverter "./icrc1-account-converter"; +import Hex "./Hex"; +import Account "./Account"; module { + type AccountIdentifier = Types.AccountIdentifier; + /// Convert Principal to ICRC1.Subaccount // from https://github.com/research-ag/motoko-lib/blob/2772d029c1c5087c2f57b022c84882f2ac16b79d/src/TokenHandler.mo#L51 public func toSubaccount(p : Principal) : Types.Subaccount { @@ -45,15 +49,6 @@ module { }; }; - // public func createInvoice(from:Principal, to: Principal, amount : Nat, memo:Text) : Types.Invoice { - // { - // from; - // to; - // amount; - // memo; - // }; - // }; - /** Decodes an ICRC1 account from text if valid, otherwise returns #InvalidAddressText. */ func icrc1AccountFromText(textAddress : Text) : Result.Result { switch (ICRC1_AccountConverter.fromText(textAddress)) { @@ -98,4 +93,109 @@ module { Blob.fromArrayMut(Array.init(32, 0 : Nat8)); }; + + /** + * args : { accountIdentifier : AccountIdentifier, canisterId : ?Principal } + * Takes an account identifier and returns a Blob + * + * Canister ID is required only for Principal, and will return an account identifier using that principal as a subaccount for the provided canisterId + */ + public func accountIdentifierToBlob (args : Types.AccountIdentifierToBlobArgs) : Types.AccountIdentifierToBlobResult { + let accountIdentifier = args.accountIdentifier; + let canisterId = args.canisterId; + let err = { + kind = #InvalidAccountIdentifier; + message = ?"Invalid account identifier"; + }; + switch (accountIdentifier) { + case(#text(identifier)){ + switch (Hex.decode(identifier)) { + case(#ok v){ + let blob = Blob.fromArray(v); + if(Account.validateAccountIdentifier(blob)){ + #ok(blob); + } else { + #err(err); + } + }; + case(#err _){ + #err(err); + }; + }; + }; + case(#principal principal){ + switch(canisterId){ + case (null){ + #err({ + kind = #Other; + message = ?"Canister Id is required for account identifiers of type principal"; + }) + }; + case (? id){ + let identifier = Account.accountIdentifier(id, Account.principalToSubaccount(principal)); + if(Account.validateAccountIdentifier(identifier)){ + #ok(identifier); + } else { + #err(err); + } + }; + } + }; + case(#blob(identifier)){ + if(Account.validateAccountIdentifier(identifier)){ + #ok(identifier); + } else { + #err(err); + } + }; + }; + }; + + /** + * args : { accountIdentifier : AccountIdentifier, canisterId : ?Principal } + * Takes an account identifier and returns Hex-encoded Text + * + * Canister ID is required only for Principal, and will return an account identifier using that principal as a subaccount for the provided canisterId + */ + public func accountIdentifierToText (args : Types.AccountIdentifierToTextArgs) : Types.AccountIdentifierToTextResult { + let accountIdentifier = args.accountIdentifier; + let canisterId = args.canisterId; + switch (accountIdentifier) { + case(#text(identifier)){ + #ok(identifier); + }; + case(#principal(identifier)){ + let blobResult = accountIdentifierToBlob(args); + switch(blobResult){ + case(#ok(blob)){ + #ok(Hex.encode(Blob.toArray(blob))); + }; + case(#err(err)){ + #err(err); + }; + }; + }; + case(#blob(identifier)){ + let blobResult = accountIdentifierToBlob(args); + switch(blobResult){ + case(#ok(blob)){ + #ok(Hex.encode(Blob.toArray(blob))); + }; + case(#err(err)){ + #err(err); + }; + }; + }; + }; + }; + + type DefaultAccountArgs = { + // Hex-encoded AccountIdentifier + canisterId : Principal; + principal : Principal; + }; + public func getDefaultAccount(args : DefaultAccountArgs) : Blob { + Account.accountIdentifier(args.canisterId, Account.principalToSubaccount(args.principal)); + }; + }; diff --git a/deps/init.json b/deps/init.json deleted file mode 100644 index 6322b190..00000000 --- a/deps/init.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "canisters": { - "rdmx6-jaaaa-aaaaa-aaadq-cai": { - "arg_str": "(null)", - "arg_raw": "4449444c0a6e016c069ad9a8dc0402caed93df0403c8d99dab0702dfe1a5de0705f7f5cbfb0702f8d995c60f086e786e046c02007801786e066c04c3f9fca002788beea8c5047881cfaef40a0787eb979d0d7a6d7b6e096c02d5f5c5e909789fedfdc50d78010000" - } - } -} \ No newline at end of file diff --git a/deps/pulled.json b/deps/pulled.json deleted file mode 100644 index a5998fdc..00000000 --- a/deps/pulled.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "canisters": { - "rdmx6-jaaaa-aaaaa-aaadq-cai": { - "name": "internet-identity", - "wasm_hash": "b70f38cd483596a4d000e4391e3ef89075b9ded1a43b10fffb6c59f4690d33bc", - "init_guide": "Use '(null)' for sensible defaults. See the candid interface for more details.", - "candid_args": "(opt InternetIdentityInit)", - "gzip": true - } - } -} \ No newline at end of file diff --git a/dfx.json b/dfx.json index 7a095b8d..a3a84b08 100644 --- a/dfx.json +++ b/dfx.json @@ -12,8 +12,7 @@ }, "assets": { "dependencies": [ - "backend", - "internet-identity" + "backend" ], "frontend": { "entrypoint": "dist/index.html" diff --git a/dist/index.html b/dist/index.html index c7aa2b7b..ea41e44b 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,12 +1,12 @@ - + - Vite App - - + IC-Payroll + +
diff --git a/frontend/App.vue b/frontend/App.vue index 39d8ab7c..bc7cf0c5 100644 --- a/frontend/App.vue +++ b/frontend/App.vue @@ -21,16 +21,12 @@ import Home from "./Home.vue"; import SignIn from "./components/auth/SignIn.vue"; import { storeToRefs } from "pinia"; import { useAuthStore } from "./store/auth"; -import { useledger } from "./store/useledger"; - -const ledgerStore = useledger(); const authStore = useAuthStore(); -const { isReady, isAuthenticated } = storeToRefs(authStore); +const { isReady, isAuthenticated, isConfigured } = storeToRefs(authStore); if (isReady.value === false) { authStore.init(); - ledgerStore.init(); } else { router.push("/home/dashboard"); } diff --git a/frontend/Home.vue b/frontend/Home.vue index 11c8d0de..729a3050 100644 --- a/frontend/Home.vue +++ b/frontend/Home.vue @@ -1,9 +1,6 @@ diff --git a/frontend/components/Modal.vue b/frontend/components/Modal.vue new file mode 100644 index 00000000..db948c81 --- /dev/null +++ b/frontend/components/Modal.vue @@ -0,0 +1,98 @@ + + + diff --git a/frontend/components/NotificationCard.vue b/frontend/components/NotificationCard.vue index c2da9d20..28182fdb 100644 --- a/frontend/components/NotificationCard.vue +++ b/frontend/components/NotificationCard.vue @@ -12,10 +12,10 @@ defineProps({ @@ -39,8 +49,8 @@ const props = defineProps([ "currency2", "bgcolor", "headercolor", - "fiatColor", "currency1color", "currency2color", + "balance", ]); diff --git a/frontend/components/SettingsCard.vue b/frontend/components/SettingsCard.vue index f625fb1d..1344865f 100644 --- a/frontend/components/SettingsCard.vue +++ b/frontend/components/SettingsCard.vue @@ -12,15 +12,17 @@ defineProps({