kokio-sdk 0.1.2 → 0.1.4
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/{src/abis/BeaconProxy.json → dist/esm/abis/BeaconProxy.js} +3 -2
- package/dist/esm/abis/DeviceWallet.js +913 -0
- package/{src/abis/DeviceWalletFactory.json → dist/esm/abis/DeviceWalletFactory.js} +3 -2
- package/{src/abis/ESIMWallet.json → dist/esm/abis/ESIMWallet.js} +3 -2
- package/{src/abis/ESIMWalletFactory.json → dist/esm/abis/ESIMWalletFactory.js} +3 -2
- package/{src/abis/LazyWalletRegistry.json → dist/esm/abis/LazyWalletRegistry.js} +3 -2
- package/{src/abis/P256Verifier.json → dist/esm/abis/P256Verifier.js} +3 -2
- package/{src/abis/Registry.json → dist/esm/abis/Registry.js} +3 -2
- package/{src/abis/RegistryHelper.json → dist/esm/abis/RegistryHelper.js} +3 -2
- package/dist/esm/abis/index.js +10 -0
- package/dist/esm/config.js +52 -0
- package/dist/esm/interface/P256VerifierClass.js +10 -0
- package/dist/esm/interface/constantsClass.js +38 -0
- package/{src/interface/deviceWalletClass.ts → dist/esm/interface/deviceWalletClass.js} +12 -36
- package/dist/esm/interface/deviceWalletFactoryClass.js +18 -0
- package/dist/esm/interface/eSIMWalletClass.js +33 -0
- package/dist/esm/interface/eSIMWalletFactoryClass.js +21 -0
- package/dist/esm/interface/lazyWalletRegistryClass.js +19 -0
- package/{src/interface/smartAccountClass.ts → dist/esm/interface/smartAccountClass.js} +3 -11
- package/dist/esm/interface/utilsClass.js +13 -0
- package/{src/logic/P256Verifier.ts → dist/esm/logic/P256Verifier.js} +6 -17
- package/dist/esm/logic/account-kit/createSmartAccount.js +298 -0
- package/{src/logic/constants.ts → dist/esm/logic/constants.js} +42 -103
- package/{src/logic/deviceWallet.ts → dist/esm/logic/deviceWallet.js} +46 -74
- package/{src/logic/deviceWalletFactory.ts → dist/esm/logic/deviceWalletFactory.js} +22 -43
- package/{src/logic/eSIMWallet.ts → dist/esm/logic/eSIMWallet.js} +41 -59
- package/{src/logic/eSIMWalletFactory.ts → dist/esm/logic/eSIMWalletFactory.js} +28 -41
- package/{src/logic/lazyWalletRegistry.ts → dist/esm/logic/lazyWalletRegistry.js} +29 -60
- package/dist/esm/logic/utils.js +100 -0
- package/dist/esm/types-export.js +1 -0
- package/dist/esm/types.js +1 -0
- package/dist/types/abis/BeaconProxy.d.ts +3 -0
- package/dist/types/abis/DeviceWallet.d.ts +3 -0
- package/dist/types/abis/DeviceWalletFactory.d.ts +3 -0
- package/dist/types/abis/ESIMWallet.d.ts +3 -0
- package/dist/types/abis/ESIMWalletFactory.d.ts +3 -0
- package/dist/types/abis/LazyWalletRegistry.d.ts +3 -0
- package/dist/types/abis/P256Verifier.d.ts +3 -0
- package/dist/types/abis/Registry.d.ts +3 -0
- package/dist/types/abis/RegistryHelper.d.ts +3 -0
- package/dist/types/abis/index.d.ts +10 -0
- package/dist/types/config.d.ts +37 -0
- package/dist/types/interface/P256VerifierClass.d.ts +7 -0
- package/dist/types/interface/constantsClass.d.ts +27 -0
- package/dist/types/interface/deviceWalletClass.d.ts +2577 -0
- package/dist/types/interface/deviceWalletFactoryClass.d.ts +2570 -0
- package/dist/types/interface/eSIMWalletClass.d.ts +16 -0
- package/dist/types/interface/eSIMWalletFactoryClass.d.ts +2571 -0
- package/dist/types/interface/lazyWalletRegistryClass.d.ts +11 -0
- package/dist/types/interface/smartAccountClass.d.ts +2574 -0
- package/dist/types/interface/utilsClass.d.ts +2567 -0
- package/dist/types/logic/P256Verifier.d.ts +3 -0
- package/dist/types/logic/account-kit/createSmartAccount.d.ts +6 -0
- package/dist/types/logic/constants.d.ts +32 -0
- package/dist/types/logic/deviceWallet.d.ts +12 -0
- package/dist/types/logic/deviceWalletFactory.d.ts +5 -0
- package/dist/types/logic/eSIMWallet.d.ts +11 -0
- package/dist/types/logic/eSIMWalletFactory.d.ts +6 -0
- package/dist/types/logic/lazyWalletRegistry.d.ts +7 -0
- package/dist/types/logic/utils.d.ts +18 -0
- package/dist/types/types-export.d.ts +1 -0
- package/{src/types.ts → dist/types/types.d.ts} +19 -21
- package/package.json +24 -14
- package/.github/workflows/npm_publish.yaml +0 -45
- package/src/abis/DeviceWallet.json +0 -912
- package/src/abis/index.ts +0 -21
- package/src/config.ts +0 -58
- package/src/interface/P256VerifierClass.ts +0 -19
- package/src/interface/constantsClass.ts +0 -36
- package/src/interface/deviceWalletFactoryClass.ts +0 -35
- package/src/interface/eSIMWalletClass.ts +0 -55
- package/src/interface/eSIMWalletFactoryClass.ts +0 -36
- package/src/interface/lazyWalletRegistryClass.ts +0 -34
- package/src/interface/utilsClass.ts +0 -21
- package/src/logic/account-kit/createSmartAccount.ts +0 -401
- package/src/logic/utils.ts +0 -123
- package/src/types-export.ts +0 -7
- package/tsconfig.json +0 -114
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AccountOp, createSmartAccountClient, getEntryPoint, SmartContractAccount,
|
|
3
|
-
toSmartContractAccount, split, SmartAccountClient
|
|
4
|
-
} from "@aa-sdk/core";
|
|
5
|
-
import {
|
|
6
|
-
http, type SignableMessage, type Hash, WalletClient, Hex, encodeFunctionData,
|
|
7
|
-
Address, encodePacked, encodeAbiParameters, getContract,
|
|
8
|
-
TypedDataDefinition, TypedData, hashMessage, stringToBytes, toHex, hashTypedData, hexToBytes, bytesToHex
|
|
9
|
-
} from "viem";
|
|
10
|
-
import { BytesLike, ethers, hexlify, toBeHex, toBigInt, zeroPadValue } from "ethers";
|
|
11
|
-
import { _getChainSpecificConstants, ZERO, SIGNATURE_VALIDITY_SECONDS } from "../constants.js";
|
|
12
|
-
import { _add0x, _concatUint8Arrays, _remove0x, _shouldRemoveLeadingZero } from "../utils.js";
|
|
13
|
-
import { P256Key, WebAuthnSignature } from "../../types.js";
|
|
14
|
-
import { DeviceWallet, DeviceWalletFactory } from "../../abis/index.js";
|
|
15
|
-
import { alchemyGasManagerMiddleware } from "@account-kit/infra";
|
|
16
|
-
|
|
17
|
-
import { decodeAttestationObject, decodeClientDataJSON, isoBase64URL, parseAuthenticatorData } from "@simplewebauthn/server/helpers";
|
|
18
|
-
import { Passkey, PasskeyGetRequest, PasskeyGetResult } from "react-native-passkey";
|
|
19
|
-
import { p256 } from "@noble/curves/nist.js";
|
|
20
|
-
|
|
21
|
-
type BrokenPasskeyGetResult = PasskeyGetResult | string;
|
|
22
|
-
|
|
23
|
-
enum AuthenticatorTransport {
|
|
24
|
-
usb = "usb",
|
|
25
|
-
nfc = "nfc",
|
|
26
|
-
ble = "ble",
|
|
27
|
-
smartCard = "smart-card",
|
|
28
|
-
hybrid = "hybrid",
|
|
29
|
-
internal = "internal"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/*
|
|
33
|
-
** Stamp is client-side authentication. Since the passkeys are one the user's mobile device
|
|
34
|
-
** react-native-passkey helps fetch passkey for the user (provided credentialId, rpId).
|
|
35
|
-
** This is exactly how the WebAuthn.sol contract needs it to be.
|
|
36
|
-
*/
|
|
37
|
-
export const _stamp = async (credentialId: string, rpId: string, payload: Hex): Promise<WebAuthnSignature> => {
|
|
38
|
-
const signingOptions: PasskeyGetRequest = {
|
|
39
|
-
challenge: isoBase64URL.fromBuffer(
|
|
40
|
-
(hexToBytes(payload) as unknown) as Uint8Array<ArrayBuffer>
|
|
41
|
-
),
|
|
42
|
-
allowCredentials: [{
|
|
43
|
-
id: credentialId,
|
|
44
|
-
type: "public-key",
|
|
45
|
-
transports: [AuthenticatorTransport.internal]
|
|
46
|
-
}],
|
|
47
|
-
rpId,
|
|
48
|
-
userVerification: "required"
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
let authenticationResult;
|
|
52
|
-
try {
|
|
53
|
-
authenticationResult = await Passkey.get(signingOptions);
|
|
54
|
-
} catch (e) {
|
|
55
|
-
console.log("Failed to get authenticationResult");
|
|
56
|
-
console.error(JSON.stringify(e, Object.getOwnPropertyNames(e)))
|
|
57
|
-
throw e;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// See https://github.com/f-23/react-native-passkey/issues/54
|
|
61
|
-
// On Android the typedef lies. Authentication result is actually a string!
|
|
62
|
-
// TODO: remove me once the above is resolved.
|
|
63
|
-
const brokenAuthenticationResult =
|
|
64
|
-
authenticationResult as BrokenPasskeyGetResult;
|
|
65
|
-
if (typeof brokenAuthenticationResult === "string") {
|
|
66
|
-
authenticationResult = JSON.parse(brokenAuthenticationResult);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const { clientDataJSON, authenticatorData, signature } = authenticationResult.response;
|
|
70
|
-
|
|
71
|
-
// 1. Decode clientDataJSON
|
|
72
|
-
const clientDataJSONBuffer = isoBase64URL.toBuffer(clientDataJSON);
|
|
73
|
-
const clientDataJSONString = new TextDecoder().decode(clientDataJSONBuffer);
|
|
74
|
-
|
|
75
|
-
// 2. Calculate indices for the contract (byte offsets)
|
|
76
|
-
const typeSearchString = '"type":"webauthn.get"';
|
|
77
|
-
const challengeSearchString = '"challenge":';
|
|
78
|
-
|
|
79
|
-
const rawTypeIndex = clientDataJSONString.indexOf(typeSearchString);
|
|
80
|
-
const challengeIndex = clientDataJSONString.indexOf(challengeSearchString);
|
|
81
|
-
|
|
82
|
-
let typeIndex = rawTypeIndex;
|
|
83
|
-
if (rawTypeIndex === -1) {
|
|
84
|
-
console.warn("typeIndex not found", {
|
|
85
|
-
expected: typeSearchString,
|
|
86
|
-
clientDataSnippet: clientDataJSONString.slice(0, 200),
|
|
87
|
-
});
|
|
88
|
-
typeIndex = 0;
|
|
89
|
-
}
|
|
90
|
-
if (challengeIndex === -1) {
|
|
91
|
-
throw new Error(`Could not find challenge substring '${challengeSearchString}' in clientDataJSON for index calculation.`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// 3. Decode authenticatorData
|
|
95
|
-
const authenticatorDataBytes = isoBase64URL.toBuffer(authenticatorData);
|
|
96
|
-
const authenticatorDataHex = bytesToHex(authenticatorDataBytes);
|
|
97
|
-
|
|
98
|
-
// 4. Decode signature (ASN.1 DER encoded)
|
|
99
|
-
const signatureBytes = isoBase64URL.toBuffer(signature);
|
|
100
|
-
// let parsedSignature = p256.Signature.fromDER(signatureBytes);
|
|
101
|
-
let parsedSignature = p256.Signature.fromBytes(
|
|
102
|
-
signatureBytes instanceof Uint8Array
|
|
103
|
-
? signatureBytes
|
|
104
|
-
: new Uint8Array(signatureBytes),
|
|
105
|
-
"der"
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
// Normalize s
|
|
109
|
-
const n = p256.Point.CURVE().n;
|
|
110
|
-
const halfN = n >> 1n;
|
|
111
|
-
|
|
112
|
-
const r = parsedSignature.r;
|
|
113
|
-
const s = parsedSignature.s > halfN
|
|
114
|
-
? n - parsedSignature.s
|
|
115
|
-
: parsedSignature.s;
|
|
116
|
-
|
|
117
|
-
const webAuthnSig = {
|
|
118
|
-
authenticatorData: authenticatorDataHex,
|
|
119
|
-
clientDataJSON: clientDataJSONString,
|
|
120
|
-
challengeIndex: BigInt(challengeIndex),
|
|
121
|
-
typeIndex: BigInt(typeIndex),
|
|
122
|
-
r: r,
|
|
123
|
-
s: s
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
return webAuthnSig;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const _encodeExecute = async (tx: AccountOp) => {
|
|
130
|
-
|
|
131
|
-
return encodeFunctionData({
|
|
132
|
-
abi: DeviceWallet,
|
|
133
|
-
functionName: "execute",
|
|
134
|
-
args: [{
|
|
135
|
-
dest: tx.target,
|
|
136
|
-
value: tx.value ?? ZERO,
|
|
137
|
-
data: tx.data
|
|
138
|
-
}]
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const _encodeBatchExecute = async (txs: AccountOp[]) => {
|
|
143
|
-
|
|
144
|
-
const new_txs:{dest:Address, value:bigint, data: Hex | '0x'}[] = [];
|
|
145
|
-
|
|
146
|
-
for (let i=0; i<txs.length; ++i) {
|
|
147
|
-
new_txs.push({
|
|
148
|
-
dest: txs[i].target,
|
|
149
|
-
value: txs[i].value ?? ZERO,
|
|
150
|
-
data: txs[i].data
|
|
151
|
-
})
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return encodeFunctionData({
|
|
155
|
-
abi: DeviceWallet,
|
|
156
|
-
functionName: "executeBatch",
|
|
157
|
-
args: [new_txs]
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const _getAccountInitCode = async (client: WalletClient, deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key, salt: bigint): Promise<Hex> => {
|
|
162
|
-
|
|
163
|
-
// To send with user operations
|
|
164
|
-
const chainID = await client.getChainId();
|
|
165
|
-
const rpcURL = client.transport.url;
|
|
166
|
-
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
167
|
-
|
|
168
|
-
const callData = encodeFunctionData({
|
|
169
|
-
abi: DeviceWalletFactory,
|
|
170
|
-
functionName: "createAccount",
|
|
171
|
-
args: [deviceUniqueIdentifier, deviceWalletOwnerKey, salt],
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
return values.factoryAddresses.DEVICE_WALLET_FACTORY.concat(_remove0x(callData)) as Hex;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const getInitCodeHash = async (client: WalletClient, deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key): Promise<BytesLike> => {
|
|
178
|
-
|
|
179
|
-
const chainID = await client.getChainId();
|
|
180
|
-
const rpcURL = client.transport.url;
|
|
181
|
-
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
182
|
-
|
|
183
|
-
// off-chain computation of the DeviceWallet address
|
|
184
|
-
const registry = values.factoryAddresses.REGISTRY;
|
|
185
|
-
const deviceWalletFactoryAddress = values.factoryAddresses.DEVICE_WALLET_FACTORY;
|
|
186
|
-
const eSIMWalletFactoryAddress = values.factoryAddresses.ESIM_WALLET_FACTORY;
|
|
187
|
-
|
|
188
|
-
const deviceWalletFactory = getContract({
|
|
189
|
-
abi: DeviceWalletFactory,
|
|
190
|
-
address: deviceWalletFactoryAddress,
|
|
191
|
-
client
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
const beacon = await deviceWalletFactory.read.beacon([]);
|
|
195
|
-
|
|
196
|
-
const abiCoder = ethers.AbiCoder.defaultAbiCoder();
|
|
197
|
-
|
|
198
|
-
// Encode the DeviceWallet.init with the init params
|
|
199
|
-
const deviceWallet = new ethers.Interface(DeviceWallet);
|
|
200
|
-
const deviceWalletInitData = deviceWallet.encodeFunctionData("init", [
|
|
201
|
-
registry,
|
|
202
|
-
deviceWalletOwnerKey,
|
|
203
|
-
deviceUniqueIdentifier,
|
|
204
|
-
eSIMWalletFactoryAddress
|
|
205
|
-
]);
|
|
206
|
-
|
|
207
|
-
const beaconProxyBytecode = "0x60a06040908082526104a8803803809161001982856102ae565b8339810182828203126101e95761002f826102e7565b60208084015191939091906001600160401b0382116101e9570182601f820112156101e957805190610060826102fb565b9361006d875195866102ae565b8285528383830101116101e957829060005b83811061029a57505060009184010152823b1561027a577fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b038581169182179092558551635c60da1b60e01b8082529194928482600481895afa91821561026f57600092610238575b50813b1561021f5750508551847f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e600080a282511561020057508290600487518096819382525afa9283156101f5576000936101b3575b5091600080848461019096519101845af4903d156101aa573d610174816102fb565b90610181885192836102ae565b8152600081943d92013e610316565b505b6080525161012e908161037a82396080518160180152f35b60609250610316565b92508183813d83116101ee575b6101ca81836102ae565b810103126101e9576000806101e1610190956102e7565b945050610152565b600080fd5b503d6101c0565b85513d6000823e3d90fd5b9350505050346102105750610192565b63b398979f60e01b8152600490fd5b8751634c9c8ce360e01b81529116600482015260249150fd5b9091508481813d8311610268575b61025081836102ae565b810103126101e957610261906102e7565b90386100fb565b503d610246565b88513d6000823e3d90fd5b8351631933b43b60e21b81526001600160a01b0384166004820152602490fd5b81810183015186820184015284920161007f565b601f909101601f19168101906001600160401b038211908210176102d157604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036101e957565b6001600160401b0381116102d157601f01601f191660200190565b9061033d575080511561032b57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580610370575b61034e575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561034656fe60806040819052635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa90811560a9576000916054575b5060da565b905060203d60201160a3575b601f8101601f191682019167ffffffffffffffff831181841017608d576088926040520160b5565b38604f565b634e487b7160e01b600052604160045260246000fd5b503d6060565b6040513d6000823e3d90fd5b602090607f19011260d5576080516001600160a01b038116810360d55790565b600080fd5b6000808092368280378136915af43d82803e1560f4573d90f35b3d90fdfea264697066735822122099ba460fd62b3e22c737d15959887e6cae3498f3495d31e43e2bcf1283aec7d264736f6c63430008190033";
|
|
208
|
-
|
|
209
|
-
// Encode BeaconProxy constructor args
|
|
210
|
-
const beaconProxyConstructorArgs = abiCoder.encode(
|
|
211
|
-
["address", "bytes"],
|
|
212
|
-
[beacon, deviceWalletInitData]
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
// Compute initCode
|
|
216
|
-
const initCode:BytesLike = ethers.concat([beaconProxyBytecode, beaconProxyConstructorArgs]);
|
|
217
|
-
|
|
218
|
-
return ethers.keccak256(initCode);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const getCounterFactualAddress = async (client: WalletClient, deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key, salt: bigint):Promise<Hex> => {
|
|
222
|
-
|
|
223
|
-
const chainID = await client.getChainId();
|
|
224
|
-
const rpcURL = client.transport.url;
|
|
225
|
-
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
226
|
-
const deviceWalletFactoryAddress = values.factoryAddresses.DEVICE_WALLET_FACTORY;
|
|
227
|
-
|
|
228
|
-
const uniqueSaltBytes32 = toHex(salt, {size: 32});
|
|
229
|
-
const initCodeHash = await getInitCodeHash(client, deviceUniqueIdentifier, deviceWalletOwnerKey);
|
|
230
|
-
|
|
231
|
-
// Calculate deterministic address from init code hash
|
|
232
|
-
const create2Address = ethers.getCreate2Address(deviceWalletFactoryAddress, uniqueSaltBytes32, initCodeHash);
|
|
233
|
-
|
|
234
|
-
return ethers.getAddress(create2Address) as Address;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const _encodeSignature = async (webAuthnSignature: WebAuthnSignature, validUntil: number): Promise<Hex> => {
|
|
238
|
-
|
|
239
|
-
const encodedWebAuthnSignatureBytes = encodeAbiParameters([
|
|
240
|
-
{
|
|
241
|
-
type: "tuple",
|
|
242
|
-
name: "WebAuthnSignature",
|
|
243
|
-
components: [
|
|
244
|
-
{ name: "authenticatorData", type: "bytes", },
|
|
245
|
-
{ name: "clientDataJSON", type: "string", },
|
|
246
|
-
{ name: "challengeIndex", type: "uint256", },
|
|
247
|
-
{ name: "typeIndex", type: "uint256", },
|
|
248
|
-
{ name: "r", type: "uint256", },
|
|
249
|
-
{ name: "s", type: "uint256", },
|
|
250
|
-
],
|
|
251
|
-
},
|
|
252
|
-
],
|
|
253
|
-
[
|
|
254
|
-
webAuthnSignature
|
|
255
|
-
]);
|
|
256
|
-
|
|
257
|
-
const signature = encodePacked(
|
|
258
|
-
["uint8", "uint48", "bytes"],
|
|
259
|
-
[1, validUntil, encodedWebAuthnSignatureBytes]
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
return signature;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
// message here is the original message data (string or Uint8Array) directly from the app
|
|
266
|
-
const _signMessage = async (message: SignableMessage, credentialId: string, rpId: string): Promise<Hex> => {
|
|
267
|
-
|
|
268
|
-
const validUntil = Math.floor(Date.now() / 1000) + SIGNATURE_VALIDITY_SECONDS;
|
|
269
|
-
|
|
270
|
-
const payload = hashMessage({raw: stringToBytes(message as string)});
|
|
271
|
-
// The original message is passed to the stamp and sign function.
|
|
272
|
-
// The stamp and sign function creates the EIP-191 digest hash using its hashMessage function
|
|
273
|
-
// The result of the hashMessage(message) will be the `payload` used as a challenge
|
|
274
|
-
const webAuthnSignature = await _stamp(credentialId, rpId, payload);
|
|
275
|
-
|
|
276
|
-
return _encodeSignature(webAuthnSignature, validUntil);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
const _signTypedData = async <
|
|
280
|
-
const typedData extends TypedData | Record<string, unknown>,
|
|
281
|
-
primaryType extends keyof typedData | "EIP712Domain" = keyof typedData
|
|
282
|
-
> (typedData: TypedDataDefinition<typedData, primaryType>, organiationId: string, signWith: Address): Promise<Hex> => {
|
|
283
|
-
|
|
284
|
-
// signature valid until, UNIX timestamp in seconds
|
|
285
|
-
const validUntil = Math.floor(Date.now() / 1000) + SIGNATURE_VALIDITY_SECONDS;
|
|
286
|
-
|
|
287
|
-
// TODO: Implement stamping for Typed Data
|
|
288
|
-
let webAuthnSignature = {
|
|
289
|
-
authenticatorData: `0x` as `0x${string}`,
|
|
290
|
-
clientDataJSON: "",
|
|
291
|
-
challengeIndex: BigInt(0),
|
|
292
|
-
typeIndex: BigInt(0),
|
|
293
|
-
r: BigInt(0),
|
|
294
|
-
s: BigInt(0)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return _encodeSignature(webAuthnSignature, validUntil);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const _signUserOperationHash = async (credentialId: string, rpId: string, userOpHash: Hex): Promise<Hex> => {
|
|
301
|
-
|
|
302
|
-
const validUntil = Math.floor(Date.now() / 1000) + SIGNATURE_VALIDITY_SECONDS;
|
|
303
|
-
|
|
304
|
-
const messagePrecursor = encodePacked(["uint8", "uint48", "bytes32"], [
|
|
305
|
-
1,
|
|
306
|
-
validUntil,
|
|
307
|
-
userOpHash
|
|
308
|
-
]);
|
|
309
|
-
|
|
310
|
-
const payload = hashMessage({ raw: messagePrecursor });
|
|
311
|
-
|
|
312
|
-
const webAuthnSignature = await _stamp(credentialId, rpId, payload);
|
|
313
|
-
|
|
314
|
-
return _encodeSignature(webAuthnSignature, validUntil);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export const _getSmartWallet = async (
|
|
318
|
-
client: WalletClient,
|
|
319
|
-
credentialId: string,
|
|
320
|
-
rpId: string,
|
|
321
|
-
organiationId: string,
|
|
322
|
-
deviceUniqueIdentifier: string,
|
|
323
|
-
deviceWalletOwnerKey: P256Key,
|
|
324
|
-
salt: bigint
|
|
325
|
-
): Promise<SmartContractAccount> => {
|
|
326
|
-
|
|
327
|
-
const chainID = await client.getChainId();
|
|
328
|
-
const rpcURL = client.transport.url;
|
|
329
|
-
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
330
|
-
|
|
331
|
-
if (!client.account) throw new Error ('Error: No signer account found with WalletClient')
|
|
332
|
-
const signWith = client.account.address;
|
|
333
|
-
|
|
334
|
-
return toSmartContractAccount({
|
|
335
|
-
/// REQUIRED PARAMS ///
|
|
336
|
-
source: "MyAccount",
|
|
337
|
-
transport: http(values.rpcURL),
|
|
338
|
-
|
|
339
|
-
chain: values.chain,
|
|
340
|
-
|
|
341
|
-
// The EntryPointDef that your account is compatible with
|
|
342
|
-
entryPoint: getEntryPoint(values.chain, {version: "0.7.0"}),
|
|
343
|
-
|
|
344
|
-
getAccountInitCode: async (): Promise<Hex> => await _getAccountInitCode(client, deviceUniqueIdentifier, deviceWalletOwnerKey, salt),
|
|
345
|
-
|
|
346
|
-
// getAccountInitCodeHash: async (): Promise<BytesLike> => await getInitCodeHash(client, deviceUniqueIdentifier, deviceWalletOwnerKey),
|
|
347
|
-
|
|
348
|
-
// an invalid signature that doesn't cause your account to revert during validation
|
|
349
|
-
getDummySignature: async (): Promise<Hash> => "0x",
|
|
350
|
-
|
|
351
|
-
// given a UO in the form of {target, data, value} should output the calldata for calling your contract's execution method
|
|
352
|
-
encodeExecute: async (uo): Promise<Hash> => _encodeExecute(uo),
|
|
353
|
-
|
|
354
|
-
signMessage: async ({ message}): Promise<Hash> => _signMessage(message, credentialId, rpId),
|
|
355
|
-
|
|
356
|
-
signTypedData: async (typedData): Promise<Hash> => _signTypedData(typedData, organiationId, signWith),
|
|
357
|
-
|
|
358
|
-
/// OPTIONAL PARAMS ///
|
|
359
|
-
// if you already know your account's address, pass that in here to avoid generating a new counterfactual
|
|
360
|
-
accountAddress: await getCounterFactualAddress(client, deviceUniqueIdentifier, deviceWalletOwnerKey, salt),
|
|
361
|
-
// if your account supports batching, this should take an array of UOs and return the calldata for calling your contract's batchExecute method
|
|
362
|
-
encodeBatchExecute: async (uos): Promise<Hash> => _encodeBatchExecute(uos),
|
|
363
|
-
// if your contract expects a different signing scheme than the default signMessage scheme, you can override that here
|
|
364
|
-
signUserOperationHash: async (hash): Promise<Hash> => _signUserOperationHash(credentialId, rpId, hash),
|
|
365
|
-
// allows you to define the calldata for upgrading your account
|
|
366
|
-
// encodeUpgradeToAndCall: async (params): Promise<Hash> => "0x...",
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
export const _getSmartWalletClient = async (client: WalletClient, pimlicoAPIKey: string, gasPolicyId: string, account: SmartContractAccount): Promise<SmartAccountClient> => {
|
|
371
|
-
|
|
372
|
-
const chainID = await client.getChainId();
|
|
373
|
-
const rpcURL = client.transport.url;
|
|
374
|
-
const values = _getChainSpecificConstants(chainID, rpcURL, pimlicoAPIKey);
|
|
375
|
-
|
|
376
|
-
const bundlerMethods = [
|
|
377
|
-
"eth_sendUserOperation",
|
|
378
|
-
"eth_estimateUserOperationGas",
|
|
379
|
-
"eth_getUserOperationReceipt",
|
|
380
|
-
"eth_getUserOperationByHash",
|
|
381
|
-
"eth_supportedEntryPoints",
|
|
382
|
-
];
|
|
383
|
-
|
|
384
|
-
// Uses Pimlico paymaster by default for above defined bundler methods and Alchemy as fallback
|
|
385
|
-
return createSmartAccountClient({
|
|
386
|
-
// created above
|
|
387
|
-
account: account,
|
|
388
|
-
chain: values.chain,
|
|
389
|
-
transport: split({
|
|
390
|
-
overrides: [
|
|
391
|
-
{
|
|
392
|
-
methods: bundlerMethods,
|
|
393
|
-
transport: http(`${values.pimlicoRpcURL}`),
|
|
394
|
-
},
|
|
395
|
-
],
|
|
396
|
-
fallback: http(values.rpcURL),
|
|
397
|
-
}),
|
|
398
|
-
// transport: http(values.rpcURL),
|
|
399
|
-
...alchemyGasManagerMiddleware(gasPolicyId)
|
|
400
|
-
});
|
|
401
|
-
}
|
package/src/logic/utils.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { Hex, isHex, toHex } from "viem";
|
|
2
|
-
import { AsnParser } from "@peculiar/asn1-schema";
|
|
3
|
-
import { ECDSASigValue } from "@peculiar/asn1-ecc";
|
|
4
|
-
import { customErrors } from "./constants.js"
|
|
5
|
-
|
|
6
|
-
export const _add0x = (data: Hex | string): Hex => {
|
|
7
|
-
if(!data) {
|
|
8
|
-
throw customErrors.NULL_OR_UNDEFINED_VALUE;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return (data.indexOf('0x') !== -1) ? isHex(data)? data : `0x${data}` : `0x${data}`;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const _remove0x = (data: Hex | string): string => {
|
|
15
|
-
if(!data) {
|
|
16
|
-
throw customErrors.NULL_OR_UNDEFINED_VALUE;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return (data.indexOf('0x') !== -1) ? data.slice(2) : data;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function _shouldRemoveLeadingZero(bytes: Uint8Array): boolean {
|
|
23
|
-
return bytes[0] === 0x0 && (bytes[1] & (1 << 7)) !== 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function _concatUint8Arrays(arrays: Uint8Array[]): Uint8Array {
|
|
27
|
-
let pointer = 0;
|
|
28
|
-
const totalLength = arrays.reduce((prev, curr) => prev + curr.length, 0);
|
|
29
|
-
|
|
30
|
-
const toReturn = new Uint8Array(totalLength);
|
|
31
|
-
|
|
32
|
-
arrays.forEach((arr) => {
|
|
33
|
-
toReturn.set(arr, pointer);
|
|
34
|
-
pointer += arr.length;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return toReturn;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function base64UrlToBuffer(base64url: string): Buffer {
|
|
41
|
-
const base64 = base64url
|
|
42
|
-
.replace(/-/g, "+")
|
|
43
|
-
.replace(/_/g, "/")
|
|
44
|
-
.padEnd((base64url.length + 3) & ~3, "=");
|
|
45
|
-
return Buffer.from(base64, "base64");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function decodeClientDataJSON(base64url: string): any {
|
|
49
|
-
const base64 = base64url
|
|
50
|
-
.replace(/-/g, "+")
|
|
51
|
-
.replace(/_/g, "/")
|
|
52
|
-
.padEnd((base64url.length + 3) & ~3, "=");
|
|
53
|
-
const jsonString = Buffer.from(base64, "base64").toString("utf-8");
|
|
54
|
-
return JSON.parse(jsonString);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function hexToArrayBuffer(hexString: string): ArrayBuffer {
|
|
58
|
-
const cleanHex = hexString.startsWith("0x") ? hexString.slice(2) : hexString;
|
|
59
|
-
const bytes = new Uint8Array(cleanHex.length / 2);
|
|
60
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
61
|
-
bytes[i] = parseInt(cleanHex.substr(i * 2, 2), 16);
|
|
62
|
-
}
|
|
63
|
-
return bytes.buffer;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function parseDEREncodedSignature(signature: Uint8Array): {
|
|
67
|
-
r: string;
|
|
68
|
-
s: string;
|
|
69
|
-
} {
|
|
70
|
-
let offset = 0;
|
|
71
|
-
if (signature[offset++] !== 0x30) throw new Error("Invalid DER sequence");
|
|
72
|
-
|
|
73
|
-
const length = signature[offset++];
|
|
74
|
-
if (signature[offset++] !== 0x02) throw new Error("Expected integer for r");
|
|
75
|
-
|
|
76
|
-
const rLen = signature[offset++];
|
|
77
|
-
const r = signature.slice(offset, offset + rLen);
|
|
78
|
-
offset += rLen;
|
|
79
|
-
|
|
80
|
-
if (signature[offset++] !== 0x02) throw new Error("Expected integer for s");
|
|
81
|
-
const sLen = signature[offset++];
|
|
82
|
-
const s = signature.slice(offset, offset + sLen);
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
r: Buffer.from(r).toString("hex"),
|
|
86
|
-
s: Buffer.from(s).toString("hex"),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function shouldRemoveLeadingZero(bytes: Uint8Array): boolean {
|
|
91
|
-
return bytes[0] === 0x0 && (bytes[1] & (1 << 7)) !== 0;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array {
|
|
95
|
-
let pointer = 0;
|
|
96
|
-
const totalLength = arrays.reduce((prev, curr) => prev + curr.length, 0);
|
|
97
|
-
|
|
98
|
-
const toReturn = new Uint8Array(totalLength);
|
|
99
|
-
|
|
100
|
-
arrays.forEach((arr) => {
|
|
101
|
-
toReturn.set(arr, pointer);
|
|
102
|
-
pointer += arr.length;
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
return toReturn;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function parseSignature(signature: Uint8Array) {
|
|
109
|
-
const parsedSignature = AsnParser.parse(signature, ECDSASigValue);
|
|
110
|
-
let rBytes = new Uint8Array(parsedSignature.r);
|
|
111
|
-
let sBytes = new Uint8Array(parsedSignature.s);
|
|
112
|
-
if (shouldRemoveLeadingZero(rBytes)) {
|
|
113
|
-
rBytes = rBytes.slice(1);
|
|
114
|
-
}
|
|
115
|
-
if (shouldRemoveLeadingZero(sBytes)) {
|
|
116
|
-
sBytes = sBytes.slice(1);
|
|
117
|
-
}
|
|
118
|
-
const finalSignature = concatUint8Arrays([rBytes, sBytes]);
|
|
119
|
-
return {
|
|
120
|
-
r: toHex(finalSignature.slice(0, 32)),
|
|
121
|
-
s: toHex(finalSignature.slice(32)),
|
|
122
|
-
};
|
|
123
|
-
}
|
package/src/types-export.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "ESNext", /* Specify what module code is generated. */
|
|
29
|
-
"rootDir": "./src", /* Specify the root folder within your source files. */
|
|
30
|
-
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
-
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
40
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
41
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
42
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
43
|
-
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
44
|
-
"resolveJsonModule": true, /* Enable importing .json files. */
|
|
45
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
46
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
47
|
-
|
|
48
|
-
/* JavaScript Support */
|
|
49
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
50
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
51
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
52
|
-
|
|
53
|
-
/* Emit */
|
|
54
|
-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
55
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
56
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
57
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
-
"noEmit": false, /* Disable emitting files from a compilation. */
|
|
60
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
61
|
-
"outDir": "./dist/esm", /* Specify an output folder for all emitted files. */
|
|
62
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
63
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
64
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
65
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
66
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
67
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
68
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
69
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
70
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
71
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
72
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
73
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
74
|
-
"declarationDir": "./dist/types", /* Specify the output directory for generated declaration files. */
|
|
75
|
-
|
|
76
|
-
/* Interop Constraints */
|
|
77
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
-
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
80
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
81
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
82
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
83
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
84
|
-
|
|
85
|
-
/* Type Checking */
|
|
86
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
87
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
88
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
89
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
90
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
91
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
92
|
-
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
93
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
94
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
95
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
96
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
97
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
98
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
99
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
100
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
101
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
102
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
103
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
104
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
105
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
106
|
-
|
|
107
|
-
/* Completeness */
|
|
108
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
109
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
110
|
-
},
|
|
111
|
-
"include": [
|
|
112
|
-
"src"
|
|
113
|
-
]
|
|
114
|
-
}
|