@junobuild/ic-client 3.1.4 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/actor/api/actor.api.d.ts +2 -2
  2. package/actor/api/agent.api.d.ts +1 -1
  3. package/actor/types/actor.d.ts +2 -2
  4. package/actor/utils/agent.utils.d.ts +1 -1
  5. package/actor.js +1 -1
  6. package/actor.js.map +3 -3
  7. package/actor.mjs +1 -1
  8. package/actor.mjs.map +3 -3
  9. package/declarations/console/console.did.d.ts +128 -3
  10. package/declarations/console/console.factory.certified.did.js +148 -8
  11. package/declarations/console/console.factory.did.js +148 -8
  12. package/declarations/console/console.factory.did.mjs +148 -8
  13. package/declarations/deprecated/console-0-0-14.did.d.ts +3 -3
  14. package/declarations/deprecated/console-0-0-8-patch1.did.d.ts +3 -3
  15. package/declarations/deprecated/mission_control-0-0-13.did.d.ts +3 -3
  16. package/declarations/deprecated/mission_control-0-0-14.did.d.ts +3 -3
  17. package/declarations/deprecated/mission_control-0-0-4.did.d.ts +2 -2
  18. package/declarations/deprecated/mission_control-deprecated-version.did.d.ts +3 -3
  19. package/declarations/deprecated/observatory-0-0-9.did.d.ts +3 -3
  20. package/declarations/deprecated/orbiter-0-0-6.did.d.ts +3 -3
  21. package/declarations/deprecated/orbiter-0-0-7.did.d.ts +3 -3
  22. package/declarations/deprecated/orbiter-0-0-8.did.d.ts +3 -3
  23. package/declarations/deprecated/orbiter-0-2-0.did.d.ts +3 -3
  24. package/declarations/deprecated/orbiter-deprecated-version.did.d.ts +3 -3
  25. package/declarations/deprecated/satellite-0-0-16.did.d.ts +3 -3
  26. package/declarations/deprecated/satellite-0-0-17.did.d.ts +3 -3
  27. package/declarations/deprecated/satellite-0-0-21.did.d.ts +3 -3
  28. package/declarations/deprecated/satellite-0-0-22.did.d.ts +3 -3
  29. package/declarations/deprecated/satellite-0-0-8.did.d.ts +2 -2
  30. package/declarations/deprecated/satellite-0-0-9.did.d.ts +2 -2
  31. package/declarations/deprecated/satellite-deprecated-no-scope.did.d.ts +2 -2
  32. package/declarations/deprecated/satellite-deprecated-version.did.d.ts +3 -3
  33. package/declarations/deprecated/satellite-deprecated.did.d.ts +2 -2
  34. package/declarations/mission_control/mission_control.did.d.ts +3 -3
  35. package/declarations/observatory/observatory.did.d.ts +47 -3
  36. package/declarations/observatory/observatory.factory.certified.did.js +39 -1
  37. package/declarations/observatory/observatory.factory.did.js +43 -1
  38. package/declarations/observatory/observatory.factory.did.mjs +43 -1
  39. package/declarations/orbiter/orbiter.did.d.ts +3 -3
  40. package/declarations/satellite/satellite.did.d.ts +92 -3
  41. package/declarations/satellite/satellite.factory.certified.did.js +106 -7
  42. package/declarations/satellite/satellite.factory.did.js +106 -7
  43. package/declarations/satellite/satellite.factory.did.mjs +106 -7
  44. package/declarations/sputnik/sputnik.did.d.ts +92 -3
  45. package/declarations/sputnik/sputnik.factory.certified.did.js +106 -7
  46. package/declarations/sputnik/sputnik.factory.did.js +106 -7
  47. package/package.json +3 -6
  48. package/utils/principal.utils.d.ts +1 -1
  49. package/utils.js +1 -1
  50. package/utils.js.map +2 -2
  51. package/utils.mjs +1 -1
  52. package/utils.mjs.map +2 -2
  53. package/webauthn/agent-js/cose-key.d.ts +1 -1
  54. package/webauthn/agent-js/cose-utils.d.ts +1 -1
  55. package/webauthn/identity.d.ts +1 -1
  56. package/webauthn/types/identity.d.ts +1 -1
  57. package/webauthn.js +1 -1
  58. package/webauthn.js.map +3 -3
  59. package/webauthn.mjs +1 -1
  60. package/webauthn.mjs.map +3 -3
@@ -13,6 +13,41 @@ export const idlFactory = ({IDL}) => {
13
13
  sent: IDL.Nat64,
14
14
  failed: IDL.Nat64
15
15
  });
16
+ const OpenIdProvider = IDL.Variant({Google: IDL.Null});
17
+ const GetOpenIdCertificateArgs = IDL.Record({provider: OpenIdProvider});
18
+ const JwkType = IDL.Variant({
19
+ EC: IDL.Null,
20
+ OKP: IDL.Null,
21
+ RSA: IDL.Null,
22
+ oct: IDL.Null
23
+ });
24
+ const JwkParamsEc = IDL.Record({
25
+ x: IDL.Text,
26
+ y: IDL.Text,
27
+ crv: IDL.Text
28
+ });
29
+ const JwkParamsOct = IDL.Record({k: IDL.Text});
30
+ const JwkParamsOkp = IDL.Record({x: IDL.Text, crv: IDL.Text});
31
+ const JwkParamsRsa = IDL.Record({e: IDL.Text, n: IDL.Text});
32
+ const JwkParams = IDL.Variant({
33
+ Ec: JwkParamsEc,
34
+ Oct: JwkParamsOct,
35
+ Okp: JwkParamsOkp,
36
+ Rsa: JwkParamsRsa
37
+ });
38
+ const Jwk = IDL.Record({
39
+ alg: IDL.Opt(IDL.Text),
40
+ kid: IDL.Opt(IDL.Text),
41
+ kty: JwkType,
42
+ params: JwkParams
43
+ });
44
+ const Jwks = IDL.Record({keys: IDL.Vec(Jwk)});
45
+ const OpenIdCertificate = IDL.Record({
46
+ updated_at: IDL.Nat64,
47
+ jwks: Jwks,
48
+ created_at: IDL.Nat64,
49
+ version: IDL.Opt(IDL.Nat64)
50
+ });
16
51
  const ControllerScope = IDL.Variant({
17
52
  Write: IDL.Null,
18
53
  Admin: IDL.Null,
@@ -80,11 +115,18 @@ export const idlFactory = ({IDL}) => {
80
115
  return IDL.Service({
81
116
  del_controllers: IDL.Func([DeleteControllersArgs], [], []),
82
117
  get_notify_status: IDL.Func([GetNotifications], [NotifyStatus], ['query']),
118
+ get_openid_certificate: IDL.Func(
119
+ [GetOpenIdCertificateArgs],
120
+ [IDL.Opt(OpenIdCertificate)],
121
+ ['query']
122
+ ),
83
123
  list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']),
84
124
  notify: IDL.Func([NotifyArgs], [], []),
85
125
  ping: IDL.Func([NotifyArgs], [], []),
86
126
  set_controllers: IDL.Func([SetControllersArgs], [], []),
87
- set_env: IDL.Func([Env], [], [])
127
+ set_env: IDL.Func([Env], [], []),
128
+ start_openid_monitoring: IDL.Func([], [], []),
129
+ stop_openid_monitoring: IDL.Func([], [], [])
88
130
  });
89
131
  };
90
132
  // @ts-ignore
@@ -1,6 +1,6 @@
1
- import type { ActorMethod } from '@dfinity/agent';
2
- import type { IDL } from '@dfinity/candid';
3
- import type { Principal } from '@dfinity/principal';
1
+ import type { ActorMethod } from '@icp-sdk/core/agent';
2
+ import type { IDL } from '@icp-sdk/core/candid';
3
+ import type { Principal } from '@icp-sdk/core/principal';
4
4
 
5
5
  export interface AnalyticKey {
6
6
  key: string;
@@ -1,6 +1,6 @@
1
- import type { ActorMethod } from '@dfinity/agent';
2
- import type { IDL } from '@dfinity/candid';
3
- import type { Principal } from '@dfinity/principal';
1
+ import type { ActorMethod } from '@icp-sdk/core/agent';
2
+ import type { IDL } from '@icp-sdk/core/candid';
3
+ import type { Principal } from '@icp-sdk/core/principal';
4
4
 
5
5
  export interface AssetEncodingNoContent {
6
6
  modified: bigint;
@@ -26,8 +26,15 @@ export interface AssetNoContent {
26
26
  export interface AssetsUpgradeOptions {
27
27
  clear_existing_assets: [] | [boolean];
28
28
  }
29
+ export type AuthenticateResultResponse = { Ok: Authentication } | { Err: AuthenticationError };
30
+ export interface Authentication {
31
+ doc: Doc;
32
+ delegation: PreparedDelegation;
33
+ }
34
+ export type AuthenticationArgs = { OpenId: OpenIdPrepareDelegationArgs };
29
35
  export interface AuthenticationConfig {
30
36
  updated_at: [] | [bigint];
37
+ openid: [] | [AuthenticationConfigOpenId];
31
38
  created_at: [] | [bigint];
32
39
  version: [] | [bigint];
33
40
  internet_identity: [] | [AuthenticationConfigInternetIdentity];
@@ -37,6 +44,15 @@ export interface AuthenticationConfigInternetIdentity {
37
44
  derivation_origin: [] | [string];
38
45
  external_alternative_origins: [] | [Array<string>];
39
46
  }
47
+ export interface AuthenticationConfigOpenId {
48
+ observatory_id: [] | [Principal];
49
+ providers: Array<[OpenIdProvider, OpenIdProviderConfig]>;
50
+ }
51
+ export type AuthenticationError =
52
+ | {
53
+ PrepareDelegation: PrepareDelegationError;
54
+ }
55
+ | { RegisterUser: string };
40
56
  export interface AuthenticationRules {
41
57
  allowed_callers: Array<Principal>;
42
58
  }
@@ -85,6 +101,11 @@ export interface DelDoc {
85
101
  export interface DelRule {
86
102
  version: [] | [bigint];
87
103
  }
104
+ export interface Delegation {
105
+ pubkey: Uint8Array | number[];
106
+ targets: [] | [Array<Principal>];
107
+ expiration: bigint;
108
+ }
88
109
  export interface DeleteControllersArgs {
89
110
  controllers: Array<Principal>;
90
111
  }
@@ -103,6 +124,25 @@ export interface Doc {
103
124
  created_at: bigint;
104
125
  version: [] | [bigint];
105
126
  }
127
+ export type GetDelegationArgs = { OpenId: OpenIdGetDelegationArgs };
128
+ export type GetDelegationError =
129
+ | { JwtFindProvider: JwtFindProviderError }
130
+ | { GetCachedJwks: null }
131
+ | { NoSuchDelegation: null }
132
+ | { JwtVerify: JwtVerifyError }
133
+ | { GetOrFetchJwks: GetOrRefreshJwksError }
134
+ | { DeriveSeedFailed: string };
135
+ export type GetDelegationResultResponse = { Ok: SignedDelegation } | { Err: GetDelegationError };
136
+ export type GetOrRefreshJwksError =
137
+ | { InvalidConfig: string }
138
+ | { MissingKid: null }
139
+ | { BadClaim: string }
140
+ | { KeyNotFoundCooldown: null }
141
+ | { CertificateNotFound: null }
142
+ | { BadSig: string }
143
+ | { MissingLastAttempt: string }
144
+ | { KeyNotFound: null }
145
+ | { FetchFailed: string };
106
146
  export interface HttpRequest {
107
147
  url: string;
108
148
  method: string;
@@ -134,6 +174,16 @@ export interface InitStorageArgs {
134
174
  export interface InitUploadResult {
135
175
  batch_id: bigint;
136
176
  }
177
+ export type JwtFindProviderError =
178
+ | { BadClaim: string }
179
+ | { BadSig: string }
180
+ | { NoMatchingProvider: null };
181
+ export type JwtVerifyError =
182
+ | { WrongKeyType: null }
183
+ | { MissingKid: null }
184
+ | { BadClaim: string }
185
+ | { BadSig: string }
186
+ | { NoKeyForKid: null };
137
187
  export interface ListMatcher {
138
188
  key: [] | [string];
139
189
  updated_at: [] | [TimestampMatcher];
@@ -201,11 +251,43 @@ export interface MemorySize {
201
251
  stable: bigint;
202
252
  heap: bigint;
203
253
  }
254
+ export interface OpenIdGetDelegationArgs {
255
+ jwt: string;
256
+ session_key: Uint8Array | number[];
257
+ salt: Uint8Array | number[];
258
+ expiration: bigint;
259
+ }
260
+ export interface OpenIdPrepareDelegationArgs {
261
+ jwt: string;
262
+ session_key: Uint8Array | number[];
263
+ salt: Uint8Array | number[];
264
+ }
265
+ export type OpenIdProvider = { Google: null };
266
+ export interface OpenIdProviderConfig {
267
+ delegation: [] | [OpenIdProviderDelegationConfig];
268
+ client_id: string;
269
+ }
270
+ export interface OpenIdProviderDelegationConfig {
271
+ targets: [] | [Array<Principal>];
272
+ max_time_to_live: [] | [bigint];
273
+ }
204
274
  export type Permission =
205
275
  | { Controllers: null }
206
276
  | { Private: null }
207
277
  | { Public: null }
208
278
  | { Managed: null };
279
+ export type PrepareDelegationError =
280
+ | {
281
+ JwtFindProvider: JwtFindProviderError;
282
+ }
283
+ | { GetCachedJwks: null }
284
+ | { JwtVerify: JwtVerifyError }
285
+ | { GetOrFetchJwks: GetOrRefreshJwksError }
286
+ | { DeriveSeedFailed: string };
287
+ export interface PreparedDelegation {
288
+ user_key: Uint8Array | number[];
289
+ expiration: bigint;
290
+ }
209
291
  export interface Proposal {
210
292
  status: ProposalStatus;
211
293
  updated_at: bigint;
@@ -252,6 +334,7 @@ export interface SegmentsDeploymentOptions {
252
334
  satellite_version: [] | [string];
253
335
  }
254
336
  export interface SetAuthenticationConfig {
337
+ openid: [] | [AuthenticationConfigOpenId];
255
338
  version: [] | [bigint];
256
339
  internet_identity: [] | [AuthenticationConfigInternetIdentity];
257
340
  rules: [] | [AuthenticationRules];
@@ -294,6 +377,10 @@ export interface SetStorageConfig {
294
377
  raw_access: [] | [StorageConfigRawAccess];
295
378
  redirects: [] | [Array<[string, StorageConfigRedirect]>];
296
379
  }
380
+ export interface SignedDelegation {
381
+ signature: Uint8Array | number[];
382
+ delegation: Delegation;
383
+ }
297
384
  export interface StorageConfig {
298
385
  iframe: [] | [StorageConfigIFrame];
299
386
  updated_at: [] | [bigint];
@@ -344,6 +431,7 @@ export interface UploadChunkResult {
344
431
  chunk_id: bigint;
345
432
  }
346
433
  export interface _SERVICE {
434
+ authenticate: ActorMethod<[AuthenticationArgs], AuthenticateResultResponse>;
347
435
  commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
348
436
  commit_proposal: ActorMethod<[CommitProposal], null>;
349
437
  commit_proposal_asset_upload: ActorMethod<[CommitBatch], undefined>;
@@ -370,6 +458,7 @@ export interface _SERVICE {
370
458
  get_auth_config: ActorMethod<[], [] | [AuthenticationConfig]>;
371
459
  get_config: ActorMethod<[], Config>;
372
460
  get_db_config: ActorMethod<[], [] | [DbConfig]>;
461
+ get_delegation: ActorMethod<[GetDelegationArgs], GetDelegationResultResponse>;
373
462
  get_doc: ActorMethod<[string, string], [] | [Doc]>;
374
463
  get_many_assets: ActorMethod<[Array<[string, string]>], Array<[string, [] | [AssetNoContent]]>>;
375
464
  get_many_docs: ActorMethod<[Array<[string, string]>], Array<[string, [] | [Doc]]>>;
@@ -6,6 +6,68 @@ export const idlFactory = ({IDL}) => {
6
6
  controllers: IDL.Vec(IDL.Principal),
7
7
  storage: IDL.Opt(InitStorageArgs)
8
8
  });
9
+ const OpenIdPrepareDelegationArgs = IDL.Record({
10
+ jwt: IDL.Text,
11
+ session_key: IDL.Vec(IDL.Nat8),
12
+ salt: IDL.Vec(IDL.Nat8)
13
+ });
14
+ const AuthenticationArgs = IDL.Variant({
15
+ OpenId: OpenIdPrepareDelegationArgs
16
+ });
17
+ const Doc = IDL.Record({
18
+ updated_at: IDL.Nat64,
19
+ owner: IDL.Principal,
20
+ data: IDL.Vec(IDL.Nat8),
21
+ description: IDL.Opt(IDL.Text),
22
+ created_at: IDL.Nat64,
23
+ version: IDL.Opt(IDL.Nat64)
24
+ });
25
+ const PreparedDelegation = IDL.Record({
26
+ user_key: IDL.Vec(IDL.Nat8),
27
+ expiration: IDL.Nat64
28
+ });
29
+ const Authentication = IDL.Record({
30
+ doc: Doc,
31
+ delegation: PreparedDelegation
32
+ });
33
+ const JwtFindProviderError = IDL.Variant({
34
+ BadClaim: IDL.Text,
35
+ BadSig: IDL.Text,
36
+ NoMatchingProvider: IDL.Null
37
+ });
38
+ const JwtVerifyError = IDL.Variant({
39
+ WrongKeyType: IDL.Null,
40
+ MissingKid: IDL.Null,
41
+ BadClaim: IDL.Text,
42
+ BadSig: IDL.Text,
43
+ NoKeyForKid: IDL.Null
44
+ });
45
+ const GetOrRefreshJwksError = IDL.Variant({
46
+ InvalidConfig: IDL.Text,
47
+ MissingKid: IDL.Null,
48
+ BadClaim: IDL.Text,
49
+ KeyNotFoundCooldown: IDL.Null,
50
+ CertificateNotFound: IDL.Null,
51
+ BadSig: IDL.Text,
52
+ MissingLastAttempt: IDL.Text,
53
+ KeyNotFound: IDL.Null,
54
+ FetchFailed: IDL.Text
55
+ });
56
+ const PrepareDelegationError = IDL.Variant({
57
+ JwtFindProvider: JwtFindProviderError,
58
+ GetCachedJwks: IDL.Null,
59
+ JwtVerify: JwtVerifyError,
60
+ GetOrFetchJwks: GetOrRefreshJwksError,
61
+ DeriveSeedFailed: IDL.Text
62
+ });
63
+ const AuthenticationError = IDL.Variant({
64
+ PrepareDelegation: PrepareDelegationError,
65
+ RegisterUser: IDL.Text
66
+ });
67
+ const AuthenticateResultResponse = IDL.Variant({
68
+ Ok: Authentication,
69
+ Err: AuthenticationError
70
+ });
9
71
  const CommitBatch = IDL.Record({
10
72
  batch_id: IDL.Nat,
11
73
  headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
@@ -89,6 +151,19 @@ export const idlFactory = ({IDL}) => {
89
151
  created_at: IDL.Nat64,
90
152
  version: IDL.Opt(IDL.Nat64)
91
153
  });
154
+ const OpenIdProvider = IDL.Variant({Google: IDL.Null});
155
+ const OpenIdProviderDelegationConfig = IDL.Record({
156
+ targets: IDL.Opt(IDL.Vec(IDL.Principal)),
157
+ max_time_to_live: IDL.Opt(IDL.Nat64)
158
+ });
159
+ const OpenIdProviderConfig = IDL.Record({
160
+ delegation: IDL.Opt(OpenIdProviderDelegationConfig),
161
+ client_id: IDL.Text
162
+ });
163
+ const AuthenticationConfigOpenId = IDL.Record({
164
+ observatory_id: IDL.Opt(IDL.Principal),
165
+ providers: IDL.Vec(IDL.Tuple(OpenIdProvider, OpenIdProviderConfig))
166
+ });
92
167
  const AuthenticationConfigInternetIdentity = IDL.Record({
93
168
  derivation_origin: IDL.Opt(IDL.Text),
94
169
  external_alternative_origins: IDL.Opt(IDL.Vec(IDL.Text))
@@ -98,6 +173,7 @@ export const idlFactory = ({IDL}) => {
98
173
  });
99
174
  const AuthenticationConfig = IDL.Record({
100
175
  updated_at: IDL.Opt(IDL.Nat64),
176
+ openid: IDL.Opt(AuthenticationConfigOpenId),
101
177
  created_at: IDL.Opt(IDL.Nat64),
102
178
  version: IDL.Opt(IDL.Nat64),
103
179
  internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity),
@@ -142,13 +218,33 @@ export const idlFactory = ({IDL}) => {
142
218
  authentication: IDL.Opt(AuthenticationConfig),
143
219
  storage: StorageConfig
144
220
  });
145
- const Doc = IDL.Record({
146
- updated_at: IDL.Nat64,
147
- owner: IDL.Principal,
148
- data: IDL.Vec(IDL.Nat8),
149
- description: IDL.Opt(IDL.Text),
150
- created_at: IDL.Nat64,
151
- version: IDL.Opt(IDL.Nat64)
221
+ const OpenIdGetDelegationArgs = IDL.Record({
222
+ jwt: IDL.Text,
223
+ session_key: IDL.Vec(IDL.Nat8),
224
+ salt: IDL.Vec(IDL.Nat8),
225
+ expiration: IDL.Nat64
226
+ });
227
+ const GetDelegationArgs = IDL.Variant({OpenId: OpenIdGetDelegationArgs});
228
+ const Delegation = IDL.Record({
229
+ pubkey: IDL.Vec(IDL.Nat8),
230
+ targets: IDL.Opt(IDL.Vec(IDL.Principal)),
231
+ expiration: IDL.Nat64
232
+ });
233
+ const SignedDelegation = IDL.Record({
234
+ signature: IDL.Vec(IDL.Nat8),
235
+ delegation: Delegation
236
+ });
237
+ const GetDelegationError = IDL.Variant({
238
+ JwtFindProvider: JwtFindProviderError,
239
+ GetCachedJwks: IDL.Null,
240
+ NoSuchDelegation: IDL.Null,
241
+ JwtVerify: JwtVerifyError,
242
+ GetOrFetchJwks: GetOrRefreshJwksError,
243
+ DeriveSeedFailed: IDL.Text
244
+ });
245
+ const GetDelegationResultResponse = IDL.Variant({
246
+ Ok: SignedDelegation,
247
+ Err: GetDelegationError
152
248
  });
153
249
  const ProposalStatus = IDL.Variant({
154
250
  Initialized: IDL.Null,
@@ -288,6 +384,7 @@ export const idlFactory = ({IDL}) => {
288
384
  });
289
385
  const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
290
386
  const SetAuthenticationConfig = IDL.Record({
387
+ openid: IDL.Opt(AuthenticationConfigOpenId),
291
388
  version: IDL.Opt(IDL.Nat64),
292
389
  internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity),
293
390
  rules: IDL.Opt(AuthenticationRules)
@@ -337,6 +434,7 @@ export const idlFactory = ({IDL}) => {
337
434
  });
338
435
  const UploadChunkResult = IDL.Record({chunk_id: IDL.Nat});
339
436
  return IDL.Service({
437
+ authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []),
340
438
  commit_asset_upload: IDL.Func([CommitBatch], [], []),
341
439
  commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []),
342
440
  commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []),
@@ -367,6 +465,7 @@ export const idlFactory = ({IDL}) => {
367
465
  get_auth_config: IDL.Func([], [IDL.Opt(AuthenticationConfig)], []),
368
466
  get_config: IDL.Func([], [Config], []),
369
467
  get_db_config: IDL.Func([], [IDL.Opt(DbConfig)], []),
468
+ get_delegation: IDL.Func([GetDelegationArgs], [GetDelegationResultResponse], []),
370
469
  get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], []),
371
470
  get_many_assets: IDL.Func(
372
471
  [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
@@ -6,6 +6,68 @@ export const idlFactory = ({IDL}) => {
6
6
  controllers: IDL.Vec(IDL.Principal),
7
7
  storage: IDL.Opt(InitStorageArgs)
8
8
  });
9
+ const OpenIdPrepareDelegationArgs = IDL.Record({
10
+ jwt: IDL.Text,
11
+ session_key: IDL.Vec(IDL.Nat8),
12
+ salt: IDL.Vec(IDL.Nat8)
13
+ });
14
+ const AuthenticationArgs = IDL.Variant({
15
+ OpenId: OpenIdPrepareDelegationArgs
16
+ });
17
+ const Doc = IDL.Record({
18
+ updated_at: IDL.Nat64,
19
+ owner: IDL.Principal,
20
+ data: IDL.Vec(IDL.Nat8),
21
+ description: IDL.Opt(IDL.Text),
22
+ created_at: IDL.Nat64,
23
+ version: IDL.Opt(IDL.Nat64)
24
+ });
25
+ const PreparedDelegation = IDL.Record({
26
+ user_key: IDL.Vec(IDL.Nat8),
27
+ expiration: IDL.Nat64
28
+ });
29
+ const Authentication = IDL.Record({
30
+ doc: Doc,
31
+ delegation: PreparedDelegation
32
+ });
33
+ const JwtFindProviderError = IDL.Variant({
34
+ BadClaim: IDL.Text,
35
+ BadSig: IDL.Text,
36
+ NoMatchingProvider: IDL.Null
37
+ });
38
+ const JwtVerifyError = IDL.Variant({
39
+ WrongKeyType: IDL.Null,
40
+ MissingKid: IDL.Null,
41
+ BadClaim: IDL.Text,
42
+ BadSig: IDL.Text,
43
+ NoKeyForKid: IDL.Null
44
+ });
45
+ const GetOrRefreshJwksError = IDL.Variant({
46
+ InvalidConfig: IDL.Text,
47
+ MissingKid: IDL.Null,
48
+ BadClaim: IDL.Text,
49
+ KeyNotFoundCooldown: IDL.Null,
50
+ CertificateNotFound: IDL.Null,
51
+ BadSig: IDL.Text,
52
+ MissingLastAttempt: IDL.Text,
53
+ KeyNotFound: IDL.Null,
54
+ FetchFailed: IDL.Text
55
+ });
56
+ const PrepareDelegationError = IDL.Variant({
57
+ JwtFindProvider: JwtFindProviderError,
58
+ GetCachedJwks: IDL.Null,
59
+ JwtVerify: JwtVerifyError,
60
+ GetOrFetchJwks: GetOrRefreshJwksError,
61
+ DeriveSeedFailed: IDL.Text
62
+ });
63
+ const AuthenticationError = IDL.Variant({
64
+ PrepareDelegation: PrepareDelegationError,
65
+ RegisterUser: IDL.Text
66
+ });
67
+ const AuthenticateResultResponse = IDL.Variant({
68
+ Ok: Authentication,
69
+ Err: AuthenticationError
70
+ });
9
71
  const CommitBatch = IDL.Record({
10
72
  batch_id: IDL.Nat,
11
73
  headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
@@ -89,6 +151,19 @@ export const idlFactory = ({IDL}) => {
89
151
  created_at: IDL.Nat64,
90
152
  version: IDL.Opt(IDL.Nat64)
91
153
  });
154
+ const OpenIdProvider = IDL.Variant({Google: IDL.Null});
155
+ const OpenIdProviderDelegationConfig = IDL.Record({
156
+ targets: IDL.Opt(IDL.Vec(IDL.Principal)),
157
+ max_time_to_live: IDL.Opt(IDL.Nat64)
158
+ });
159
+ const OpenIdProviderConfig = IDL.Record({
160
+ delegation: IDL.Opt(OpenIdProviderDelegationConfig),
161
+ client_id: IDL.Text
162
+ });
163
+ const AuthenticationConfigOpenId = IDL.Record({
164
+ observatory_id: IDL.Opt(IDL.Principal),
165
+ providers: IDL.Vec(IDL.Tuple(OpenIdProvider, OpenIdProviderConfig))
166
+ });
92
167
  const AuthenticationConfigInternetIdentity = IDL.Record({
93
168
  derivation_origin: IDL.Opt(IDL.Text),
94
169
  external_alternative_origins: IDL.Opt(IDL.Vec(IDL.Text))
@@ -98,6 +173,7 @@ export const idlFactory = ({IDL}) => {
98
173
  });
99
174
  const AuthenticationConfig = IDL.Record({
100
175
  updated_at: IDL.Opt(IDL.Nat64),
176
+ openid: IDL.Opt(AuthenticationConfigOpenId),
101
177
  created_at: IDL.Opt(IDL.Nat64),
102
178
  version: IDL.Opt(IDL.Nat64),
103
179
  internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity),
@@ -142,13 +218,33 @@ export const idlFactory = ({IDL}) => {
142
218
  authentication: IDL.Opt(AuthenticationConfig),
143
219
  storage: StorageConfig
144
220
  });
145
- const Doc = IDL.Record({
146
- updated_at: IDL.Nat64,
147
- owner: IDL.Principal,
148
- data: IDL.Vec(IDL.Nat8),
149
- description: IDL.Opt(IDL.Text),
150
- created_at: IDL.Nat64,
151
- version: IDL.Opt(IDL.Nat64)
221
+ const OpenIdGetDelegationArgs = IDL.Record({
222
+ jwt: IDL.Text,
223
+ session_key: IDL.Vec(IDL.Nat8),
224
+ salt: IDL.Vec(IDL.Nat8),
225
+ expiration: IDL.Nat64
226
+ });
227
+ const GetDelegationArgs = IDL.Variant({OpenId: OpenIdGetDelegationArgs});
228
+ const Delegation = IDL.Record({
229
+ pubkey: IDL.Vec(IDL.Nat8),
230
+ targets: IDL.Opt(IDL.Vec(IDL.Principal)),
231
+ expiration: IDL.Nat64
232
+ });
233
+ const SignedDelegation = IDL.Record({
234
+ signature: IDL.Vec(IDL.Nat8),
235
+ delegation: Delegation
236
+ });
237
+ const GetDelegationError = IDL.Variant({
238
+ JwtFindProvider: JwtFindProviderError,
239
+ GetCachedJwks: IDL.Null,
240
+ NoSuchDelegation: IDL.Null,
241
+ JwtVerify: JwtVerifyError,
242
+ GetOrFetchJwks: GetOrRefreshJwksError,
243
+ DeriveSeedFailed: IDL.Text
244
+ });
245
+ const GetDelegationResultResponse = IDL.Variant({
246
+ Ok: SignedDelegation,
247
+ Err: GetDelegationError
152
248
  });
153
249
  const ProposalStatus = IDL.Variant({
154
250
  Initialized: IDL.Null,
@@ -288,6 +384,7 @@ export const idlFactory = ({IDL}) => {
288
384
  });
289
385
  const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
290
386
  const SetAuthenticationConfig = IDL.Record({
387
+ openid: IDL.Opt(AuthenticationConfigOpenId),
291
388
  version: IDL.Opt(IDL.Nat64),
292
389
  internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity),
293
390
  rules: IDL.Opt(AuthenticationRules)
@@ -337,6 +434,7 @@ export const idlFactory = ({IDL}) => {
337
434
  });
338
435
  const UploadChunkResult = IDL.Record({chunk_id: IDL.Nat});
339
436
  return IDL.Service({
437
+ authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []),
340
438
  commit_asset_upload: IDL.Func([CommitBatch], [], []),
341
439
  commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []),
342
440
  commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []),
@@ -367,6 +465,7 @@ export const idlFactory = ({IDL}) => {
367
465
  get_auth_config: IDL.Func([], [IDL.Opt(AuthenticationConfig)], ['query']),
368
466
  get_config: IDL.Func([], [Config], []),
369
467
  get_db_config: IDL.Func([], [IDL.Opt(DbConfig)], ['query']),
468
+ get_delegation: IDL.Func([GetDelegationArgs], [GetDelegationResultResponse], ['query']),
370
469
  get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
371
470
  get_many_assets: IDL.Func(
372
471
  [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],