@cartridge/controller 0.1.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.
- package/dist/account.d.ts +89 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +686 -0
- package/dist/index.js +696 -0
- package/dist/messenger.d.ts +17 -0
- package/dist/messenger.d.ts.map +1 -0
- package/dist/signer.d.ts +39 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/types.d.ts +150 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/webauthn.d.ts +17 -0
- package/dist/webauthn.d.ts.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Request, Response } from "./types";
|
|
2
|
+
export declare type Message<T = Request | Response> = {
|
|
3
|
+
id?: string;
|
|
4
|
+
type: "request" | "response";
|
|
5
|
+
target: string;
|
|
6
|
+
payload: T;
|
|
7
|
+
};
|
|
8
|
+
export declare class Messenger {
|
|
9
|
+
private target;
|
|
10
|
+
private origin;
|
|
11
|
+
private pending;
|
|
12
|
+
private defaultHandler;
|
|
13
|
+
constructor(target?: Window, origin?: string);
|
|
14
|
+
onRequest(cb: (request: Request, reply: <T = Response>(response: T) => void) => void): void;
|
|
15
|
+
send<T = Response>(request: Request): Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=messenger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messenger.d.ts","sourceRoot":"","sources":["../src/messenger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,oBAAY,OAAO,CAAC,CAAC,GAAG,OAAO,GAAG,QAAQ,IAAI;IAC5C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAuC;IAEtD,OAAO,CAAC,cAAc,CAOrB;gBAEW,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,MAA+B;IAcpE,SAAS,CACP,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,QAAQ,EAAE,CAAC,KAAK,IAAI,KAAK,IAAI;IA8C5E,IAAI,CAAC,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAiCjD"}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Abi, Invocation, InvocationsSignerDetails, SignerInterface, Signature, typedData } from "starknet";
|
|
2
|
+
import { Messenger } from "./messenger";
|
|
3
|
+
export declare class Signer implements SignerInterface {
|
|
4
|
+
private messenger;
|
|
5
|
+
private url;
|
|
6
|
+
constructor(messenger: Messenger, options?: {
|
|
7
|
+
url?: string;
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Method to get the public key of the signer
|
|
11
|
+
*
|
|
12
|
+
* @returns public key of signer as hex string with 0x prefix
|
|
13
|
+
*/
|
|
14
|
+
getPubKey(): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Sign an JSON object for off-chain usage with the starknet private key and return the signature
|
|
17
|
+
* This adds a message prefix so it cant be interchanged with transactions
|
|
18
|
+
*
|
|
19
|
+
* @param typedData - JSON object to be signed
|
|
20
|
+
* @param accountAddress - account
|
|
21
|
+
* @returns the signature of the JSON object
|
|
22
|
+
* @throws {Error} if the JSON object is not a valid JSON
|
|
23
|
+
*/
|
|
24
|
+
signMessage(typedData: typedData.TypedData, account: string): Promise<Signature>;
|
|
25
|
+
/**
|
|
26
|
+
* Signs a transaction with the starknet private key and returns the signature
|
|
27
|
+
*
|
|
28
|
+
* @param invocation the invocation object containing:
|
|
29
|
+
* - contractAddress - the address of the contract
|
|
30
|
+
* - entrypoint - the entrypoint of the contract
|
|
31
|
+
* - calldata - (defaults to []) the calldata
|
|
32
|
+
* - signature - (defaults to []) the signature
|
|
33
|
+
* @param abi (optional) the abi of the contract for better displaying
|
|
34
|
+
*
|
|
35
|
+
* @returns signature
|
|
36
|
+
*/
|
|
37
|
+
signTransaction(transactions: Invocation[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): Promise<Signature>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,GAAG,EACH,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,SAAS,EACT,SAAS,EACZ,MAAM,UAAU,CAAC;AAIlB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,qBAAa,MAAO,YAAW,eAAe;IAC1C,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,GAAG,CAAkC;gBAEjC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE;QACxC,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB;IAQD;;;;KAIC;IACM,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC;;;;;;;;OAQG;IACU,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IA6B7F;;;;;;;;;;;OAWG;IACU,eAAe,CACxB,YAAY,EAAE,UAAU,EAAE,EAC1B,kBAAkB,EAAE,wBAAwB,EAC5C,IAAI,CAAC,EAAE,GAAG,EAAE,GACb,OAAO,CAAC,SAAS,CAAC;CA8BxB"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { DeployContractPayload, DeployContractResponse as StarknetDeployContractResponse, Abi, Call, InvocationsDetails, typedData, InvokeFunctionResponse, Signature, Invocation } from "starknet";
|
|
2
|
+
import { BigNumberish } from "starknet/dist/utils/number";
|
|
3
|
+
import { EstimateFee } from "starknet/types/account";
|
|
4
|
+
export declare type Approvals = {
|
|
5
|
+
[origin: string]: {
|
|
6
|
+
scopes: Scope[];
|
|
7
|
+
maxFee: BigNumberish;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare type Scope = {
|
|
11
|
+
target: string;
|
|
12
|
+
method?: string;
|
|
13
|
+
};
|
|
14
|
+
export interface ProbeRequest extends RawRequest {
|
|
15
|
+
method: "probe";
|
|
16
|
+
}
|
|
17
|
+
export interface ProbeResponse extends RawResponse {
|
|
18
|
+
method: "probe";
|
|
19
|
+
result?: {
|
|
20
|
+
address?: string;
|
|
21
|
+
scopes?: Scope[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface ConnectRequest extends RawRequest {
|
|
25
|
+
method: "connect";
|
|
26
|
+
params: {
|
|
27
|
+
id: string;
|
|
28
|
+
scopes: Scope[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ConnectResponse extends RawResponse {
|
|
32
|
+
method: "connect";
|
|
33
|
+
result?: {
|
|
34
|
+
success: boolean;
|
|
35
|
+
address?: string;
|
|
36
|
+
scopes: Scope[];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface DeployContractRequest extends RawRequest {
|
|
40
|
+
method: "deploy-contract";
|
|
41
|
+
params: {
|
|
42
|
+
id: string;
|
|
43
|
+
payload: DeployContractPayload;
|
|
44
|
+
abi?: Abi;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface DeployContractResponse extends RawResponse {
|
|
48
|
+
method: "deploy-contract";
|
|
49
|
+
result?: StarknetDeployContractResponse;
|
|
50
|
+
}
|
|
51
|
+
export interface EstimateFeeRequest extends RawRequest {
|
|
52
|
+
method: "estimate-fee";
|
|
53
|
+
params: {
|
|
54
|
+
invocation: Invocation;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface EstimateFeeResponse extends RawResponse {
|
|
58
|
+
method: "estimate-fee";
|
|
59
|
+
result?: EstimateFee;
|
|
60
|
+
}
|
|
61
|
+
export interface ExecuteRequest extends RawRequest {
|
|
62
|
+
method: "execute";
|
|
63
|
+
params: {
|
|
64
|
+
id?: string;
|
|
65
|
+
transactions: Call | Call[];
|
|
66
|
+
abis?: Abi[];
|
|
67
|
+
transactionsDetail?: InvocationsDetails;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface ExecuteResponse extends RawResponse {
|
|
71
|
+
method: "execute";
|
|
72
|
+
result?: InvokeFunctionResponse;
|
|
73
|
+
scopes?: Scope[];
|
|
74
|
+
}
|
|
75
|
+
export interface SignTransactionRequest extends RawRequest {
|
|
76
|
+
method: "sign-transaction";
|
|
77
|
+
params: {
|
|
78
|
+
id: string;
|
|
79
|
+
transactions: Call | Call[];
|
|
80
|
+
abis?: Abi[];
|
|
81
|
+
transactionsDetail?: InvocationsDetails;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export interface SignTransactionResponse extends RawResponse {
|
|
85
|
+
method: "sign-transaction";
|
|
86
|
+
result?: Signature;
|
|
87
|
+
}
|
|
88
|
+
export interface SignMessageRequest extends RawRequest {
|
|
89
|
+
method: "sign-message";
|
|
90
|
+
params: {
|
|
91
|
+
id: string;
|
|
92
|
+
account?: string;
|
|
93
|
+
typedData: typedData.TypedData;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface SignMessageResponse extends RawResponse {
|
|
97
|
+
method: "sign-message";
|
|
98
|
+
result?: Signature;
|
|
99
|
+
}
|
|
100
|
+
export interface HashMessageRequest extends RawRequest {
|
|
101
|
+
method: "hash-message";
|
|
102
|
+
params: {
|
|
103
|
+
typedData: typedData.TypedData;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export interface HashMessageResponse extends RawResponse {
|
|
107
|
+
method: "hash-message";
|
|
108
|
+
result?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface VerifyMessageRequest extends RawRequest {
|
|
111
|
+
method: "verify-message";
|
|
112
|
+
params: {
|
|
113
|
+
typedData: typedData.TypedData;
|
|
114
|
+
signature: Signature;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface VerifyMessageResponse extends RawResponse {
|
|
118
|
+
method: "verify-message";
|
|
119
|
+
result?: boolean;
|
|
120
|
+
}
|
|
121
|
+
export interface VerifyMessageHashRequest extends RawRequest {
|
|
122
|
+
method: "verify-message-hash";
|
|
123
|
+
params: {
|
|
124
|
+
hash: BigNumberish;
|
|
125
|
+
signature: Signature;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export interface VerifyMessageHashResponse extends RawResponse {
|
|
129
|
+
method: "verify-message-hash";
|
|
130
|
+
result?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface GetNonceRequest extends RawRequest {
|
|
133
|
+
method: "get-nonce";
|
|
134
|
+
}
|
|
135
|
+
export interface GetNonceResponse extends RawResponse {
|
|
136
|
+
method: "get-nonce";
|
|
137
|
+
result?: string;
|
|
138
|
+
}
|
|
139
|
+
export declare type RawRequest = {
|
|
140
|
+
origin?: string;
|
|
141
|
+
method: string;
|
|
142
|
+
params?: object | any[];
|
|
143
|
+
};
|
|
144
|
+
export declare type Request = RawRequest | ProbeRequest | ConnectRequest | DeployContractRequest | EstimateFeeRequest | ExecuteRequest | SignMessageRequest | HashMessageRequest | VerifyMessageHashRequest | VerifyMessageRequest | GetNonceRequest;
|
|
145
|
+
export declare type RawResponse = {
|
|
146
|
+
result?: any;
|
|
147
|
+
error?: unknown;
|
|
148
|
+
};
|
|
149
|
+
export declare type Response = RawResponse | ProbeResponse | DeployContractResponse | EstimateFeeResponse | ConnectResponse | SignMessageResponse | HashMessageResponse | VerifyMessageHashResponse | VerifyMessageResponse | GetNonceResponse;
|
|
150
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,IAAI,8BAA8B,EACxD,GAAG,EACH,IAAI,EACJ,kBAAkB,EAClB,SAAS,EACT,sBAAsB,EACtB,SAAS,EACT,UAAU,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,oBAAY,SAAS,GAAG;IACtB,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,MAAM,EAAE,KAAK,EAAE,CAAC;QAChB,MAAM,EAAE,YAAY,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,oBAAY,KAAK,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE;QACN,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,KAAK,EAAE,CAAC;KACjB,CAAC;CACH;AAED,MAAM,WAAW,eAAgB,SA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EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAMpD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Abi, Invocation, InvocationsSignerDetails, Signature, SignerInterface, typedData } from "starknet";
|
|
2
|
+
declare type Assertion = PublicKeyCredential & {
|
|
3
|
+
response: AuthenticatorAssertionResponse;
|
|
4
|
+
};
|
|
5
|
+
export declare class WebauthnSigner implements SignerInterface {
|
|
6
|
+
private credentialId;
|
|
7
|
+
private publicKey;
|
|
8
|
+
constructor(credentialId: string, publicKey: string);
|
|
9
|
+
getPubKey(): Promise<string>;
|
|
10
|
+
sign(hash: string): Promise<Assertion>;
|
|
11
|
+
formatAssertion(assertion: Assertion): Signature;
|
|
12
|
+
hashTransaction(transactions: Invocation[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): string;
|
|
13
|
+
signTransaction(transactions: Invocation[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): Promise<Signature>;
|
|
14
|
+
signMessage(td: typedData.TypedData, accountAddress: string): Promise<Signature>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=webauthn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn.d.ts","sourceRoot":"","sources":["../src/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,UAAU,EACV,wBAAwB,EACxB,SAAS,EACT,eAAe,EAGf,SAAS,EAEV,MAAM,UAAU,CAAC;AAMlB,aAAK,SAAS,GAAG,mBAAmB,GAAG;IACrC,QAAQ,EAAE,8BAA8B,CAAC;CAC1C,CAAC;AA8BF,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,SAAS,CAAS;gBAEd,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKtC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBnD,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS;IAwDzC,eAAe,CACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,kBAAkB,EAAE,wBAAwB,EAC5C,IAAI,CAAC,EAAE,GAAG,EAAE,GACX,MAAM;IAuBI,eAAe,CAC1B,YAAY,EAAE,UAAU,EAAE,EAC1B,kBAAkB,EAAE,wBAAwB,EAC5C,IAAI,CAAC,EAAE,GAAG,EAAE,GACX,OAAO,CAAC,SAAS,CAAC;IA0BR,WAAW,CACtB,EAAE,EAAE,SAAS,CAAC,SAAS,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,SAAS,CAAC;CAKtB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cartridge/controller",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Cartridge Controller",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.es.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rimraf ./dist && rollup -c",
|
|
10
|
+
"dev": "rollup -c -w",
|
|
11
|
+
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
12
|
+
"test:watch": "jest --watchAll",
|
|
13
|
+
"test": "jest --ci --runInBand"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
20
|
+
"@types/jest": "^26.0.18",
|
|
21
|
+
"@types/node": "^17.0.23",
|
|
22
|
+
"jest": "^26.6.3",
|
|
23
|
+
"rimraf": "^3.0.2",
|
|
24
|
+
"rollup": "^2.61.1",
|
|
25
|
+
"rollup-plugin-typescript2": "^0.30.0",
|
|
26
|
+
"ts-jest": "^26.5.1",
|
|
27
|
+
"ts-node": "^10.4.0",
|
|
28
|
+
"tslib": "^2.3.1",
|
|
29
|
+
"typescript": "^4.5.4"
|
|
30
|
+
},
|
|
31
|
+
"jest": {
|
|
32
|
+
"setupFiles": [],
|
|
33
|
+
"moduleFileExtensions": [
|
|
34
|
+
"ts",
|
|
35
|
+
"js",
|
|
36
|
+
"json"
|
|
37
|
+
],
|
|
38
|
+
"roots": [
|
|
39
|
+
"src",
|
|
40
|
+
"tests"
|
|
41
|
+
],
|
|
42
|
+
"transform": {
|
|
43
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
44
|
+
},
|
|
45
|
+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
|
46
|
+
"moduleNameMapper": {}
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"base64url": "^3.0.1",
|
|
50
|
+
"cuid": "^2.1.8",
|
|
51
|
+
"fast-deep-equal": "^3.1.3",
|
|
52
|
+
"query-string": "^7.1.1",
|
|
53
|
+
"starknet": "4.3.0"
|
|
54
|
+
}
|
|
55
|
+
}
|