@cartridge/controller-wasm 0.9.4 → 0.9.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartridge/controller-wasm",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,6 +51,41 @@ export interface Eip191Signer {
51
51
  address: string;
52
52
  }
53
53
 
54
+ export interface ImportedControllerMetadata {
55
+ username: string;
56
+ classHash: JsFelt;
57
+ rpcUrl: string;
58
+ salt: JsFelt;
59
+ owner: Owner;
60
+ address: JsFelt;
61
+ chainId: JsFelt;
62
+ }
63
+
64
+ export interface ImportedProvedPolicy {
65
+ policy: Policy;
66
+ proof: JsFelt[];
67
+ }
68
+
69
+ export interface ImportedSession {
70
+ requestedPolicies: Policy[];
71
+ provedPolicies: ImportedProvedPolicy[];
72
+ expiresAt: number;
73
+ allowedPoliciesRoot: JsFelt;
74
+ metadataHash: JsFelt;
75
+ sessionKeyGuid: JsFelt;
76
+ guardianKeyGuid: JsFelt;
77
+ metadata: string;
78
+ }
79
+
80
+ export interface ImportedSessionMetadata {
81
+ session: ImportedSession;
82
+ maxFee?: JsFelt;
83
+ credentials?: Credentials;
84
+ isRegistered: boolean;
85
+ appId?: string;
86
+ policies?: Policy[];
87
+ }
88
+
54
89
  export interface JsCall {
55
90
  contractAddress: JsFelt;
56
91
  entrypoint: string;
@@ -143,6 +178,8 @@ export class CartridgeAccount {
143
178
  execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
144
179
  executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
145
180
  executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
181
+ exportAuthorizedSession(app_id?: string | null): Promise<ImportedSessionMetadata | undefined>;
182
+ exportMetadata(): Promise<ImportedControllerMetadata>;
146
183
  static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
147
184
  getNonce(): Promise<any>;
148
185
  hasAuthorizedPoliciesForCalls(app_id: string, calls: JsCall[]): Promise<boolean>;
@@ -158,6 +195,7 @@ export class CartridgeAccount {
158
195
  */
159
196
  hasPoliciesForAppId(app_id: string): Promise<boolean>;
160
197
  hasRequestedSession(app_id: string, policies: Policy[]): Promise<boolean>;
198
+ importSession(imported_session: ImportedSessionMetadata): Promise<void>;
161
199
  isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
162
200
  /**
163
201
  * Creates a new `CartridgeAccount` instance.
@@ -249,6 +287,7 @@ export class ControllerFactory {
249
287
  * This should only be used with webauthn signers
250
288
  */
251
289
  static apiLogin(username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
290
+ static fromMetadata(metadata: ImportedControllerMetadata, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
252
291
  static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
253
292
  /**
254
293
  * Login to an existing controller account.