Skip to content

Commit

Permalink
TECH-292 - Fix relying demo declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
TYRONEMICHAEL committed Jul 30, 2024
1 parent fdc5cdd commit 07cd3d6
Show file tree
Hide file tree
Showing 21 changed files with 3,872 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
type u16 = nat16;
type ArgumentValue = variant { Int : int32; String : text };
type Claim = record { claims : vec record { text; ClaimValue } };
type ClaimValue = variant {
Date : text;
Text : text;
Boolean : bool;
Number : int64;
Claim : Claim;
};
type CredentialError = variant {
UnauthorizedSubject : text;
NoCredentialsFound : text;
};
type CredentialSpec = record {
arguments : opt vec record { text; ArgumentValue };
credential_type : text;
};
type DerivationOriginData = record { origin : text };
type DerivationOriginError = variant {
Internal : text;
UnsupportedOrigin : text;
};
type DerivationOriginRequest = record { frontend_hostname : text };
type GetCredentialRequest = record {
signed_id_alias : SignedIdAlias;
prepared_context : opt blob;
credential_spec : CredentialSpec;
};
type HttpRequest = record {
url : text;
method : text;
body : blob;
headers : vec record { text; text };
certificate_version : opt nat16;
};
type HttpResponse = record {
body : blob;
headers : vec record { text; text };
status_code : nat16;
};
type Icrc21ConsentInfo = record { consent_message : text; language : text };
type Icrc21ConsentPreferences = record { language : text };
type Icrc21Error = variant {
GenericError : record { description : text; error_code : nat };
UnsupportedCanisterCall : Icrc21ErrorInfo;
ConsentMessageUnavailable : Icrc21ErrorInfo;
};
type Icrc21ErrorInfo = record { description : text };
type Icrc21VcConsentMessageRequest = record {
preferences : Icrc21ConsentPreferences;
credential_spec : CredentialSpec;
};
type IssueCredentialError = variant {
Internal : text;
SignatureNotFound : text;
InvalidIdAlias : text;
UnauthorizedSubject : text;
UnknownSubject : text;
UnsupportedCredentialSpec : text;
};
type IssuedCredentialData = record { vc_jws : text };
type IssuerInit = record {
derivation_origin : text;
idp_canister_ids : vec principal;
ic_root_key_der : blob;
frontend_hostname : text;
admin: principal;
authorized_issuers: vec principal;
};
type PrepareCredentialRequest = record {
signed_id_alias : SignedIdAlias;
credential_spec : CredentialSpec;
};
type PreparedCredentialData = record { prepared_context : opt blob };
type Result = variant { Ok : text; Err : CredentialError };
type Result_1 = variant {
Ok : DerivationOriginData;
Err : DerivationOriginError;
};
type Result_2 = variant { Ok : vec FullCredential; Err : CredentialError };
type Result_3 = variant {
Ok : IssuedCredentialData;
Err : IssueCredentialError;
};
type Result_4 = variant {
Ok : PreparedCredentialData;
Err : IssueCredentialError;
};
type Result_5 = variant { Ok : Icrc21ConsentInfo; Err : Icrc21Error };
type SignedIdAlias = record { credential_jws : text };
type Credential = record {
id : text;
context : vec text;
type_ : vec text;
claim : vec Claim;
};

type FullCredential = record {
id : text;
context : vec text;
type_ : vec text;
claim : vec Claim;
issuer : text;
};
type StoredCredential = record {
id : text;
context_issuer_id : u16;
type_ : vec text;
claim : vec Claim;
};
service : (opt IssuerInit) -> {
add_credentials : (principal, vec Credential) -> (Result);
remove_credential : (principal, text) -> (Result);
configure : (IssuerInit) -> ();
derivation_origin : (DerivationOriginRequest) -> (Result_1);
get_all_credentials : (principal) -> (Result_2) query;
get_credential : (GetCredentialRequest) -> (Result_3) query;
http_request : (HttpRequest) -> (HttpResponse) query;
prepare_credential : (PrepareCredentialRequest) -> (Result_4);
update_credential : (principal, text, Credential) -> (Result);
vc_consent_message : (Icrc21VcConsentMessageRequest) -> (Result_5);
get_admin : () -> (principal) query;
add_issuer: (principal) -> ();
remove_issuer: (principal) -> ();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import type { Principal } from '@dfinity/principal';
import type { ActorMethod } from '@dfinity/agent';
import type { IDL } from '@dfinity/candid';

export type ArgumentValue = { 'Int' : number } |
{ 'String' : string };
export interface Claim { 'claims' : Array<[string, ClaimValue]> }
export type ClaimValue = { 'Date' : string } |
{ 'Text' : string } |
{ 'Boolean' : boolean } |
{ 'Number' : bigint } |
{ 'Claim' : Claim };
export interface Credential {
'id' : string,
'context' : Array<string>,
'type_' : Array<string>,
'claim' : Array<Claim>,
}
export type CredentialError = { 'UnauthorizedSubject' : string } |
{ 'NoCredentialsFound' : string };
export interface CredentialSpec {
'arguments' : [] | [Array<[string, ArgumentValue]>],
'credential_type' : string,
}
export interface DerivationOriginData { 'origin' : string }
export type DerivationOriginError = { 'Internal' : string } |
{ 'UnsupportedOrigin' : string };
export interface DerivationOriginRequest { 'frontend_hostname' : string }
export interface FullCredential {
'id' : string,
'context' : Array<string>,
'type_' : Array<string>,
'claim' : Array<Claim>,
'issuer' : string,
}
export interface GetCredentialRequest {
'signed_id_alias' : SignedIdAlias,
'prepared_context' : [] | [Uint8Array | number[]],
'credential_spec' : CredentialSpec,
}
export interface HttpRequest {
'url' : string,
'method' : string,
'body' : Uint8Array | number[],
'headers' : Array<[string, string]>,
'certificate_version' : [] | [number],
}
export interface HttpResponse {
'body' : Uint8Array | number[],
'headers' : Array<[string, string]>,
'status_code' : number,
}
export interface Icrc21ConsentInfo {
'consent_message' : string,
'language' : string,
}
export interface Icrc21ConsentPreferences { 'language' : string }
export type Icrc21Error = {
'GenericError' : { 'description' : string, 'error_code' : bigint }
} |
{ 'UnsupportedCanisterCall' : Icrc21ErrorInfo } |
{ 'ConsentMessageUnavailable' : Icrc21ErrorInfo };
export interface Icrc21ErrorInfo { 'description' : string }
export interface Icrc21VcConsentMessageRequest {
'preferences' : Icrc21ConsentPreferences,
'credential_spec' : CredentialSpec,
}
export type IssueCredentialError = { 'Internal' : string } |
{ 'SignatureNotFound' : string } |
{ 'InvalidIdAlias' : string } |
{ 'UnauthorizedSubject' : string } |
{ 'UnknownSubject' : string } |
{ 'UnsupportedCredentialSpec' : string };
export interface IssuedCredentialData { 'vc_jws' : string }
export interface IssuerInit {
'derivation_origin' : string,
'admin' : Principal,
'idp_canister_ids' : Array<Principal>,
'ic_root_key_der' : Uint8Array | number[],
'authorized_issuers' : Array<Principal>,
'frontend_hostname' : string,
}
export interface PrepareCredentialRequest {
'signed_id_alias' : SignedIdAlias,
'credential_spec' : CredentialSpec,
}
export interface PreparedCredentialData {
'prepared_context' : [] | [Uint8Array | number[]],
}
export type Result = { 'Ok' : string } |
{ 'Err' : CredentialError };
export type Result_1 = { 'Ok' : DerivationOriginData } |
{ 'Err' : DerivationOriginError };
export type Result_2 = { 'Ok' : Array<FullCredential> } |
{ 'Err' : CredentialError };
export type Result_3 = { 'Ok' : IssuedCredentialData } |
{ 'Err' : IssueCredentialError };
export type Result_4 = { 'Ok' : PreparedCredentialData } |
{ 'Err' : IssueCredentialError };
export type Result_5 = { 'Ok' : Icrc21ConsentInfo } |
{ 'Err' : Icrc21Error };
export interface SignedIdAlias { 'credential_jws' : string }
export interface StoredCredential {
'id' : string,
'type_' : Array<string>,
'claim' : Array<Claim>,
'context_issuer_id' : u16,
}
export type u16 = number;
export interface _SERVICE {
'add_credentials' : ActorMethod<[Principal, Array<Credential>], Result>,
'add_issuer' : ActorMethod<[Principal], undefined>,
'configure' : ActorMethod<[IssuerInit], undefined>,
'derivation_origin' : ActorMethod<[DerivationOriginRequest], Result_1>,
'get_admin' : ActorMethod<[], Principal>,
'get_all_credentials' : ActorMethod<[Principal], Result_2>,
'get_credential' : ActorMethod<[GetCredentialRequest], Result_3>,
'http_request' : ActorMethod<[HttpRequest], HttpResponse>,
'prepare_credential' : ActorMethod<[PrepareCredentialRequest], Result_4>,
'remove_credential' : ActorMethod<[Principal, string], Result>,
'remove_issuer' : ActorMethod<[Principal], undefined>,
'update_credential' : ActorMethod<[Principal, string, Credential], Result>,
'vc_consent_message' : ActorMethod<[Icrc21VcConsentMessageRequest], Result_5>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
Loading

0 comments on commit 07cd3d6

Please sign in to comment.