@charterlabs/rhinestone-sdk 0.1.6 → 0.1.7
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/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -2
- package/dist/src/modules/validators/index.d.ts +2 -1
- package/dist/src/modules/validators/index.d.ts.map +1 -1
- package/dist/src/modules/validators/index.js +13 -1
- package/dist/src/modules/validators/webauthn-contract.d.ts +232 -0
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -0
- package/dist/src/modules/validators/webauthn-contract.js +308 -0
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
|
3
3
|
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './accounts';
|
|
4
4
|
import { createTransport } from './accounts/utils';
|
|
5
5
|
import { addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery } from './actions';
|
|
6
|
+
import { addCredential, generateCredentialId, getCredentialIds, getCredentialInfo, getCredentials, getThreshold, hasCredential, hasCredentialById, removeCredential, setThreshold, WEBAUTHN_VALIDATOR_ABI } from './modules/validators';
|
|
6
7
|
import type { TransactionResult } from './execution';
|
|
7
8
|
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './execution';
|
|
8
9
|
import { type SessionDetails } from './execution/smart-session';
|
|
@@ -36,6 +37,6 @@ interface RhinestoneAccount {
|
|
|
36
37
|
* @returns account
|
|
37
38
|
*/
|
|
38
39
|
declare function createRhinestoneAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
39
|
-
export { createRhinestoneAccount, createTransport, addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, IntentFailedError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getTokenAddress, getTokenSymbol, getWethAddress, getSupportedTokens, isTokenAddressSupported, getOrchestrator, };
|
|
40
|
+
export { createRhinestoneAccount, createTransport, addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery, addCredential, generateCredentialId, getCredentialIds, getCredentialInfo, getCredentials, getThreshold, hasCredential, hasCredentialById, removeCredential, setThreshold, WEBAUTHN_VALIDATOR_ABI, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, IntentFailedError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getTokenAddress, getTokenSymbol, getWethAddress, getSupportedTokens, isTokenAddressSupported, getOrchestrator, };
|
|
40
41
|
export type { RhinestoneAccount, Session, Call, IntentData, PreparedTransactionData, SignedTransactionData, TransactionResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, };
|
|
41
42
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,uBAAuB,EAAE,MAAM,MAAM,CAAA;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EACL,YAAY,EAEZ,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAE5B,cAAc,EACd,kCAAkC,EAClC,qCAAqC,EACrC,4BAA4B,EAE7B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EACL,QAAQ,EACR,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,E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CAAC,CA6H5B;AAED,OAAO,EACL,uBAAuB,EACvB,eAAe,EAEf,QAAQ,EACR,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EAEb,cAAc,EACd,YAAY,EACZ,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAElC,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,0CAA0C,EAC1C,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EAEzB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EAErB,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EAEvB,eAAe,GAChB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,uBAAuB,EAAE,MAAM,MAAM,CAAA;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EACL,YAAY,EAEZ,8BAA8B,EAC9B,kC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C3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EAErB,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EAEvB,eAAe,GAChB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getOrchestrator = void 0;
|
|
3
|
+
exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainsNotAvailableForUserOpFlowError = exports.ExecutionError = exports.IntentFailedError = exports.isExecutionError = exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = exports.WEBAUTHN_VALIDATOR_ABI = exports.setThreshold = exports.removeCredential = exports.hasCredentialById = exports.hasCredential = exports.getThreshold = exports.getCredentials = exports.getCredentialInfo = exports.getCredentialIds = exports.generateCredentialId = exports.addCredential = exports.setUpRecovery = exports.setSubValidator = exports.removeSubValidator = exports.removeOwner = exports.recover = exports.encodeSmartSessionSignature = exports.enablePasskeys = exports.enableMultiFactor = exports.enableEcdsa = exports.disablePasskeys = exports.disableMultiFactor = exports.disableEcdsa = exports.changeThreshold = exports.changeMultiFactorThreshold = exports.addOwner = exports.createTransport = void 0;
|
|
4
|
+
exports.getOrchestrator = exports.isTokenAddressSupported = exports.getSupportedTokens = exports.getWethAddress = exports.getTokenSymbol = exports.getTokenAddress = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = void 0;
|
|
5
5
|
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
6
6
|
const accounts_1 = require("./accounts");
|
|
7
7
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
@@ -31,6 +31,18 @@ Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function
|
|
|
31
31
|
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
32
32
|
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
33
33
|
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
34
|
+
const validators_1 = require("./modules/validators");
|
|
35
|
+
Object.defineProperty(exports, "addCredential", { enumerable: true, get: function () { return validators_1.addCredential; } });
|
|
36
|
+
Object.defineProperty(exports, "generateCredentialId", { enumerable: true, get: function () { return validators_1.generateCredentialId; } });
|
|
37
|
+
Object.defineProperty(exports, "getCredentialIds", { enumerable: true, get: function () { return validators_1.getCredentialIds; } });
|
|
38
|
+
Object.defineProperty(exports, "getCredentialInfo", { enumerable: true, get: function () { return validators_1.getCredentialInfo; } });
|
|
39
|
+
Object.defineProperty(exports, "getCredentials", { enumerable: true, get: function () { return validators_1.getCredentials; } });
|
|
40
|
+
Object.defineProperty(exports, "getThreshold", { enumerable: true, get: function () { return validators_1.getThreshold; } });
|
|
41
|
+
Object.defineProperty(exports, "hasCredential", { enumerable: true, get: function () { return validators_1.hasCredential; } });
|
|
42
|
+
Object.defineProperty(exports, "hasCredentialById", { enumerable: true, get: function () { return validators_1.hasCredentialById; } });
|
|
43
|
+
Object.defineProperty(exports, "removeCredential", { enumerable: true, get: function () { return validators_1.removeCredential; } });
|
|
44
|
+
Object.defineProperty(exports, "setThreshold", { enumerable: true, get: function () { return validators_1.setThreshold; } });
|
|
45
|
+
Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ABI", { enumerable: true, get: function () { return validators_1.WEBAUTHN_VALIDATOR_ABI; } });
|
|
34
46
|
const execution_1 = require("./execution");
|
|
35
47
|
Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
|
|
36
48
|
Object.defineProperty(exports, "IntentFailedError", { enumerable: true, get: function () { return execution_1.IntentFailedError; } });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getMockSignature, getOwnerValidator } from './core';
|
|
2
2
|
import { encodeSmartSessionSignature, getEnableSessionCall, getPermissionId, getSmartSessionValidator, isSessionEnabled, SMART_SESSION_MODE_ENABLE, SMART_SESSION_MODE_USE, SMART_SESSIONS_VALIDATOR_ADDRESS } from './smart-sessions';
|
|
3
|
-
|
|
3
|
+
import { addCredential, generateCredentialId, getCredentialIds, getCredentialInfo, getCredentials, getThreshold, hasCredential, hasCredentialById, removeCredential, setThreshold, WEBAUTHN_VALIDATOR_ABI } from './webauthn-contract';
|
|
4
|
+
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS, getOwnerValidator, getSmartSessionValidator, getEnableSessionCall, encodeSmartSessionSignature, getPermissionId, getMockSignature, isSessionEnabled, addCredential, generateCredentialId, getCredentialIds, getCredentialInfo, getCredentials, getThreshold, hasCredential, hasCredentialById, removeCredential, setThreshold, WEBAUTHN_VALIDATOR_ABI, };
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACvB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,gCAAgC,EAChC,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAEhB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,GACvB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSessionEnabled = exports.getMockSignature = exports.getPermissionId = exports.encodeSmartSessionSignature = exports.getEnableSessionCall = exports.getSmartSessionValidator = exports.getOwnerValidator = exports.SMART_SESSIONS_VALIDATOR_ADDRESS = exports.SMART_SESSION_MODE_ENABLE = exports.SMART_SESSION_MODE_USE = void 0;
|
|
3
|
+
exports.WEBAUTHN_VALIDATOR_ABI = exports.setThreshold = exports.removeCredential = exports.hasCredentialById = exports.hasCredential = exports.getThreshold = exports.getCredentials = exports.getCredentialInfo = exports.getCredentialIds = exports.generateCredentialId = exports.addCredential = exports.isSessionEnabled = exports.getMockSignature = exports.getPermissionId = exports.encodeSmartSessionSignature = exports.getEnableSessionCall = exports.getSmartSessionValidator = exports.getOwnerValidator = exports.SMART_SESSIONS_VALIDATOR_ADDRESS = exports.SMART_SESSION_MODE_ENABLE = exports.SMART_SESSION_MODE_USE = void 0;
|
|
4
4
|
const core_1 = require("./core");
|
|
5
5
|
Object.defineProperty(exports, "getMockSignature", { enumerable: true, get: function () { return core_1.getMockSignature; } });
|
|
6
6
|
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return core_1.getOwnerValidator; } });
|
|
@@ -13,3 +13,15 @@ Object.defineProperty(exports, "isSessionEnabled", { enumerable: true, get: func
|
|
|
13
13
|
Object.defineProperty(exports, "SMART_SESSION_MODE_ENABLE", { enumerable: true, get: function () { return smart_sessions_1.SMART_SESSION_MODE_ENABLE; } });
|
|
14
14
|
Object.defineProperty(exports, "SMART_SESSION_MODE_USE", { enumerable: true, get: function () { return smart_sessions_1.SMART_SESSION_MODE_USE; } });
|
|
15
15
|
Object.defineProperty(exports, "SMART_SESSIONS_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return smart_sessions_1.SMART_SESSIONS_VALIDATOR_ADDRESS; } });
|
|
16
|
+
const webauthn_contract_1 = require("./webauthn-contract");
|
|
17
|
+
Object.defineProperty(exports, "addCredential", { enumerable: true, get: function () { return webauthn_contract_1.addCredential; } });
|
|
18
|
+
Object.defineProperty(exports, "generateCredentialId", { enumerable: true, get: function () { return webauthn_contract_1.generateCredentialId; } });
|
|
19
|
+
Object.defineProperty(exports, "getCredentialIds", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialIds; } });
|
|
20
|
+
Object.defineProperty(exports, "getCredentialInfo", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialInfo; } });
|
|
21
|
+
Object.defineProperty(exports, "getCredentials", { enumerable: true, get: function () { return webauthn_contract_1.getCredentials; } });
|
|
22
|
+
Object.defineProperty(exports, "getThreshold", { enumerable: true, get: function () { return webauthn_contract_1.getThreshold; } });
|
|
23
|
+
Object.defineProperty(exports, "hasCredential", { enumerable: true, get: function () { return webauthn_contract_1.hasCredential; } });
|
|
24
|
+
Object.defineProperty(exports, "hasCredentialById", { enumerable: true, get: function () { return webauthn_contract_1.hasCredentialById; } });
|
|
25
|
+
Object.defineProperty(exports, "removeCredential", { enumerable: true, get: function () { return webauthn_contract_1.removeCredential; } });
|
|
26
|
+
Object.defineProperty(exports, "setThreshold", { enumerable: true, get: function () { return webauthn_contract_1.setThreshold; } });
|
|
27
|
+
Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ABI", { enumerable: true, get: function () { return webauthn_contract_1.WEBAUTHN_VALIDATOR_ABI; } });
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { type Address, type Chain, type Hex } from 'viem';
|
|
2
|
+
import type { Call, ProviderConfig } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* WebAuthn Validator Contract ABI - Contains the functions we need to interact with
|
|
5
|
+
*/
|
|
6
|
+
declare const WEBAUTHN_VALIDATOR_ABI: readonly [{
|
|
7
|
+
readonly type: "function";
|
|
8
|
+
readonly name: "generateCredentialId";
|
|
9
|
+
readonly inputs: readonly [{
|
|
10
|
+
readonly name: "pubKeyX";
|
|
11
|
+
readonly type: "uint256";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "pubKeyY";
|
|
14
|
+
readonly type: "uint256";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "account";
|
|
17
|
+
readonly type: "address";
|
|
18
|
+
}];
|
|
19
|
+
readonly outputs: readonly [{
|
|
20
|
+
readonly name: "";
|
|
21
|
+
readonly type: "bytes32";
|
|
22
|
+
}];
|
|
23
|
+
readonly stateMutability: "pure";
|
|
24
|
+
}, {
|
|
25
|
+
readonly type: "function";
|
|
26
|
+
readonly name: "getCredentialIds";
|
|
27
|
+
readonly inputs: readonly [{
|
|
28
|
+
readonly name: "account";
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
}];
|
|
31
|
+
readonly outputs: readonly [{
|
|
32
|
+
readonly name: "credentialsIds";
|
|
33
|
+
readonly type: "bytes32[]";
|
|
34
|
+
}];
|
|
35
|
+
readonly stateMutability: "view";
|
|
36
|
+
}, {
|
|
37
|
+
readonly type: "function";
|
|
38
|
+
readonly name: "hasCredentialById";
|
|
39
|
+
readonly inputs: readonly [{
|
|
40
|
+
readonly name: "credentialId";
|
|
41
|
+
readonly type: "bytes32";
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "account";
|
|
44
|
+
readonly type: "address";
|
|
45
|
+
}];
|
|
46
|
+
readonly outputs: readonly [{
|
|
47
|
+
readonly name: "exists";
|
|
48
|
+
readonly type: "bool";
|
|
49
|
+
}];
|
|
50
|
+
readonly stateMutability: "view";
|
|
51
|
+
}, {
|
|
52
|
+
readonly type: "function";
|
|
53
|
+
readonly name: "hasCredential";
|
|
54
|
+
readonly inputs: readonly [{
|
|
55
|
+
readonly name: "pubKeyX";
|
|
56
|
+
readonly type: "uint256";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "pubKeyY";
|
|
59
|
+
readonly type: "uint256";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "account";
|
|
62
|
+
readonly type: "address";
|
|
63
|
+
}];
|
|
64
|
+
readonly outputs: readonly [{
|
|
65
|
+
readonly name: "exists";
|
|
66
|
+
readonly type: "bool";
|
|
67
|
+
}];
|
|
68
|
+
readonly stateMutability: "view";
|
|
69
|
+
}, {
|
|
70
|
+
readonly type: "function";
|
|
71
|
+
readonly name: "addCredential";
|
|
72
|
+
readonly inputs: readonly [{
|
|
73
|
+
readonly name: "pubKeyX";
|
|
74
|
+
readonly type: "uint256";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "pubKeyY";
|
|
77
|
+
readonly type: "uint256";
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "requireUV";
|
|
80
|
+
readonly type: "bool";
|
|
81
|
+
}];
|
|
82
|
+
readonly outputs: readonly [];
|
|
83
|
+
readonly stateMutability: "nonpayable";
|
|
84
|
+
}, {
|
|
85
|
+
readonly type: "function";
|
|
86
|
+
readonly name: "removeCredential";
|
|
87
|
+
readonly inputs: readonly [{
|
|
88
|
+
readonly name: "pubKeyX";
|
|
89
|
+
readonly type: "uint256";
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "pubKeyY";
|
|
92
|
+
readonly type: "uint256";
|
|
93
|
+
}];
|
|
94
|
+
readonly outputs: readonly [];
|
|
95
|
+
readonly stateMutability: "nonpayable";
|
|
96
|
+
}, {
|
|
97
|
+
readonly type: "function";
|
|
98
|
+
readonly name: "setThreshold";
|
|
99
|
+
readonly inputs: readonly [{
|
|
100
|
+
readonly name: "_threshold";
|
|
101
|
+
readonly type: "uint256";
|
|
102
|
+
}];
|
|
103
|
+
readonly outputs: readonly [];
|
|
104
|
+
readonly stateMutability: "nonpayable";
|
|
105
|
+
}, {
|
|
106
|
+
readonly type: "function";
|
|
107
|
+
readonly name: "getCredentialInfo";
|
|
108
|
+
readonly inputs: readonly [{
|
|
109
|
+
readonly name: "credentialId";
|
|
110
|
+
readonly type: "bytes32";
|
|
111
|
+
}, {
|
|
112
|
+
readonly name: "account";
|
|
113
|
+
readonly type: "address";
|
|
114
|
+
}];
|
|
115
|
+
readonly outputs: readonly [{
|
|
116
|
+
readonly name: "pubKeyX";
|
|
117
|
+
readonly type: "uint256";
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "pubKeyY";
|
|
120
|
+
readonly type: "uint256";
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "requireUV";
|
|
123
|
+
readonly type: "bool";
|
|
124
|
+
}];
|
|
125
|
+
readonly stateMutability: "view";
|
|
126
|
+
}, {
|
|
127
|
+
readonly type: "function";
|
|
128
|
+
readonly name: "threshold";
|
|
129
|
+
readonly inputs: readonly [{
|
|
130
|
+
readonly name: "account";
|
|
131
|
+
readonly type: "address";
|
|
132
|
+
}];
|
|
133
|
+
readonly outputs: readonly [{
|
|
134
|
+
readonly name: "";
|
|
135
|
+
readonly type: "uint256";
|
|
136
|
+
}];
|
|
137
|
+
readonly stateMutability: "view";
|
|
138
|
+
}];
|
|
139
|
+
/**
|
|
140
|
+
* Generates a deterministic credential ID for a WebAuthn credential
|
|
141
|
+
* @param pubKeyX X coordinate of the public key
|
|
142
|
+
* @param pubKeyY Y coordinate of the public key
|
|
143
|
+
* @param accountAddress Address of the account
|
|
144
|
+
* @param chain Chain to query on
|
|
145
|
+
* @param provider Optional provider configuration
|
|
146
|
+
* @returns Promise resolving to the credential ID
|
|
147
|
+
*/
|
|
148
|
+
declare function generateCredentialId(pubKeyX: bigint, pubKeyY: bigint, accountAddress: Address, chain: Chain, provider?: ProviderConfig): Promise<Hex>;
|
|
149
|
+
/**
|
|
150
|
+
* Gets all credential IDs for an account
|
|
151
|
+
* @param accountAddress Address of the account
|
|
152
|
+
* @param chain Chain to query on
|
|
153
|
+
* @param provider Optional provider configuration
|
|
154
|
+
* @returns Promise resolving to array of credential IDs
|
|
155
|
+
*/
|
|
156
|
+
declare function getCredentialIds(accountAddress: Address, chain: Chain, provider?: ProviderConfig): Promise<Hex[]>;
|
|
157
|
+
/**
|
|
158
|
+
* Checks if a credential exists by its ID
|
|
159
|
+
* @param credentialId The credential ID to check
|
|
160
|
+
* @param accountAddress Address of the account
|
|
161
|
+
* @param chain Chain to query on
|
|
162
|
+
* @param provider Optional provider configuration
|
|
163
|
+
* @returns Promise resolving to whether the credential exists
|
|
164
|
+
*/
|
|
165
|
+
declare function hasCredentialById(credentialId: Hex, accountAddress: Address, chain: Chain, provider?: ProviderConfig): Promise<boolean>;
|
|
166
|
+
/**
|
|
167
|
+
* Checks if a credential exists by its public key coordinates
|
|
168
|
+
* @param pubKeyX X coordinate of the public key
|
|
169
|
+
* @param pubKeyY Y coordinate of the public key
|
|
170
|
+
* @param accountAddress Address of the account
|
|
171
|
+
* @param chain Chain to query on
|
|
172
|
+
* @param provider Optional provider configuration
|
|
173
|
+
* @returns Promise resolving to whether the credential exists
|
|
174
|
+
*/
|
|
175
|
+
declare function hasCredential(pubKeyX: bigint, pubKeyY: bigint, accountAddress: Address, chain: Chain, provider?: ProviderConfig): Promise<boolean>;
|
|
176
|
+
/**
|
|
177
|
+
* Creates a transaction call to add a WebAuthn credential to an account
|
|
178
|
+
* @param pubKeyX X coordinate of the public key
|
|
179
|
+
* @param pubKeyY Y coordinate of the public key
|
|
180
|
+
* @param requireUV Whether user verification (biometrics/PIN) is required
|
|
181
|
+
* @returns Call object for adding the credential
|
|
182
|
+
*/
|
|
183
|
+
declare function addCredential(pubKeyX: bigint, pubKeyY: bigint, requireUV?: boolean): Call;
|
|
184
|
+
/**
|
|
185
|
+
* Creates a transaction call to remove a WebAuthn credential from an account
|
|
186
|
+
* @param pubKeyX X coordinate of the public key
|
|
187
|
+
* @param pubKeyY Y coordinate of the public key
|
|
188
|
+
* @returns Call object for removing the credential
|
|
189
|
+
*/
|
|
190
|
+
declare function removeCredential(pubKeyX: bigint, pubKeyY: bigint): Call;
|
|
191
|
+
/**
|
|
192
|
+
* Creates a transaction call to set the threshold for WebAuthn validation
|
|
193
|
+
* @param threshold Number of required signatures for validation
|
|
194
|
+
* @returns Call object for setting the threshold
|
|
195
|
+
*/
|
|
196
|
+
declare function setThreshold(threshold: number): Call;
|
|
197
|
+
/**
|
|
198
|
+
* Gets detailed information about a credential
|
|
199
|
+
* @param credentialId The credential ID to query
|
|
200
|
+
* @param accountAddress Address of the account
|
|
201
|
+
* @param chain Chain to query on
|
|
202
|
+
* @param provider Optional provider configuration
|
|
203
|
+
* @returns Promise resolving to credential details
|
|
204
|
+
*/
|
|
205
|
+
declare function getCredentialInfo(credentialId: Hex, accountAddress: Address, chain: Chain, provider?: ProviderConfig): Promise<{
|
|
206
|
+
pubKeyX: bigint;
|
|
207
|
+
pubKeyY: bigint;
|
|
208
|
+
requireUV: boolean;
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Gets the current threshold for an account
|
|
212
|
+
* @param accountAddress Address of the account
|
|
213
|
+
* @param chain Chain to query on
|
|
214
|
+
* @param provider Optional provider configuration
|
|
215
|
+
* @returns Promise resolving to the current threshold
|
|
216
|
+
*/
|
|
217
|
+
declare function getThreshold(accountAddress: Address, chain: Chain, provider?: ProviderConfig): Promise<number>;
|
|
218
|
+
/**
|
|
219
|
+
* Gets all credentials for an account with their detailed information
|
|
220
|
+
* @param accountAddress Address of the account
|
|
221
|
+
* @param chain Chain to query on
|
|
222
|
+
* @param provider Optional provider configuration
|
|
223
|
+
* @returns Promise resolving to array of credentials with their details
|
|
224
|
+
*/
|
|
225
|
+
declare function getCredentials(accountAddress: Address, chain: Chain, provider?: ProviderConfig): Promise<Array<{
|
|
226
|
+
credentialId: Hex;
|
|
227
|
+
pubKeyX: bigint;
|
|
228
|
+
pubKeyY: bigint;
|
|
229
|
+
requireUV: boolean;
|
|
230
|
+
}>>;
|
|
231
|
+
export { generateCredentialId, getCredentialIds, hasCredentialById, hasCredential, addCredential, removeCredential, setThreshold, getCredentialInfo, getThreshold, getCredentials, WEBAUTHN_VALIDATOR_ABI, };
|
|
232
|
+
//# sourceMappingURL=webauthn-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn-contract.d.ts","sourceRoot":"","sources":["../../../../modules/validators/webauthn-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAC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AC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAUhE;AAED;;;;GAIG;AACH,iBAAS,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAU7C;AAED;;;;;;;GAOG;AACH,iBAAe,iBAAiB,CAC9B,YAAY,EAAE,GAAG,EACjB,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAeD;AAED;;;;;;GAMG;AACH,iBAAe,YAAY,CACzB,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED;;;;;;GAMG;AACH,iBAAe,cAAc,CAC3B,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CACR,KAAK,CAAC;IACJ,YAAY,EAAE,GAAG,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CACH,CAqBA;AAED,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,CAAA"}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WEBAUTHN_VALIDATOR_ABI = void 0;
|
|
4
|
+
exports.generateCredentialId = generateCredentialId;
|
|
5
|
+
exports.getCredentialIds = getCredentialIds;
|
|
6
|
+
exports.hasCredentialById = hasCredentialById;
|
|
7
|
+
exports.hasCredential = hasCredential;
|
|
8
|
+
exports.addCredential = addCredential;
|
|
9
|
+
exports.removeCredential = removeCredential;
|
|
10
|
+
exports.setThreshold = setThreshold;
|
|
11
|
+
exports.getCredentialInfo = getCredentialInfo;
|
|
12
|
+
exports.getThreshold = getThreshold;
|
|
13
|
+
exports.getCredentials = getCredentials;
|
|
14
|
+
const viem_1 = require("viem");
|
|
15
|
+
const utils_1 = require("../../accounts/utils");
|
|
16
|
+
const core_1 = require("./core");
|
|
17
|
+
/**
|
|
18
|
+
* WebAuthn Validator Contract ABI - Contains the functions we need to interact with
|
|
19
|
+
*/
|
|
20
|
+
const WEBAUTHN_VALIDATOR_ABI = [
|
|
21
|
+
{
|
|
22
|
+
type: 'function',
|
|
23
|
+
name: 'generateCredentialId',
|
|
24
|
+
inputs: [
|
|
25
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
26
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
27
|
+
{ name: 'account', type: 'address' },
|
|
28
|
+
],
|
|
29
|
+
outputs: [{ name: '', type: 'bytes32' }],
|
|
30
|
+
stateMutability: 'pure',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'function',
|
|
34
|
+
name: 'getCredentialIds',
|
|
35
|
+
inputs: [{ name: 'account', type: 'address' }],
|
|
36
|
+
outputs: [{ name: 'credentialsIds', type: 'bytes32[]' }],
|
|
37
|
+
stateMutability: 'view',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'function',
|
|
41
|
+
name: 'hasCredentialById',
|
|
42
|
+
inputs: [
|
|
43
|
+
{ name: 'credentialId', type: 'bytes32' },
|
|
44
|
+
{ name: 'account', type: 'address' },
|
|
45
|
+
],
|
|
46
|
+
outputs: [{ name: 'exists', type: 'bool' }],
|
|
47
|
+
stateMutability: 'view',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: 'function',
|
|
51
|
+
name: 'hasCredential',
|
|
52
|
+
inputs: [
|
|
53
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
54
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
55
|
+
{ name: 'account', type: 'address' },
|
|
56
|
+
],
|
|
57
|
+
outputs: [{ name: 'exists', type: 'bool' }],
|
|
58
|
+
stateMutability: 'view',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'function',
|
|
62
|
+
name: 'addCredential',
|
|
63
|
+
inputs: [
|
|
64
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
65
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
66
|
+
{ name: 'requireUV', type: 'bool' },
|
|
67
|
+
],
|
|
68
|
+
outputs: [],
|
|
69
|
+
stateMutability: 'nonpayable',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'function',
|
|
73
|
+
name: 'removeCredential',
|
|
74
|
+
inputs: [
|
|
75
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
76
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
77
|
+
],
|
|
78
|
+
outputs: [],
|
|
79
|
+
stateMutability: 'nonpayable',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: 'function',
|
|
83
|
+
name: 'setThreshold',
|
|
84
|
+
inputs: [{ name: '_threshold', type: 'uint256' }],
|
|
85
|
+
outputs: [],
|
|
86
|
+
stateMutability: 'nonpayable',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'function',
|
|
90
|
+
name: 'getCredentialInfo',
|
|
91
|
+
inputs: [
|
|
92
|
+
{ name: 'credentialId', type: 'bytes32' },
|
|
93
|
+
{ name: 'account', type: 'address' },
|
|
94
|
+
],
|
|
95
|
+
outputs: [
|
|
96
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
97
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
98
|
+
{ name: 'requireUV', type: 'bool' },
|
|
99
|
+
],
|
|
100
|
+
stateMutability: 'view',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: 'function',
|
|
104
|
+
name: 'threshold',
|
|
105
|
+
inputs: [{ name: 'account', type: 'address' }],
|
|
106
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
107
|
+
stateMutability: 'view',
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
exports.WEBAUTHN_VALIDATOR_ABI = WEBAUTHN_VALIDATOR_ABI;
|
|
111
|
+
/**
|
|
112
|
+
* Generates a deterministic credential ID for a WebAuthn credential
|
|
113
|
+
* @param pubKeyX X coordinate of the public key
|
|
114
|
+
* @param pubKeyY Y coordinate of the public key
|
|
115
|
+
* @param accountAddress Address of the account
|
|
116
|
+
* @param chain Chain to query on
|
|
117
|
+
* @param provider Optional provider configuration
|
|
118
|
+
* @returns Promise resolving to the credential ID
|
|
119
|
+
*/
|
|
120
|
+
async function generateCredentialId(pubKeyX, pubKeyY, accountAddress, chain, provider) {
|
|
121
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
122
|
+
chain,
|
|
123
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
124
|
+
});
|
|
125
|
+
const result = await publicClient.readContract({
|
|
126
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
127
|
+
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
128
|
+
functionName: 'generateCredentialId',
|
|
129
|
+
args: [pubKeyX, pubKeyY, accountAddress],
|
|
130
|
+
});
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Gets all credential IDs for an account
|
|
135
|
+
* @param accountAddress Address of the account
|
|
136
|
+
* @param chain Chain to query on
|
|
137
|
+
* @param provider Optional provider configuration
|
|
138
|
+
* @returns Promise resolving to array of credential IDs
|
|
139
|
+
*/
|
|
140
|
+
async function getCredentialIds(accountAddress, chain, provider) {
|
|
141
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
142
|
+
chain,
|
|
143
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
144
|
+
});
|
|
145
|
+
const result = await publicClient.readContract({
|
|
146
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
147
|
+
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
148
|
+
functionName: 'getCredentialIds',
|
|
149
|
+
args: [accountAddress],
|
|
150
|
+
});
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Checks if a credential exists by its ID
|
|
155
|
+
* @param credentialId The credential ID to check
|
|
156
|
+
* @param accountAddress Address of the account
|
|
157
|
+
* @param chain Chain to query on
|
|
158
|
+
* @param provider Optional provider configuration
|
|
159
|
+
* @returns Promise resolving to whether the credential exists
|
|
160
|
+
*/
|
|
161
|
+
async function hasCredentialById(credentialId, accountAddress, chain, provider) {
|
|
162
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
163
|
+
chain,
|
|
164
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
165
|
+
});
|
|
166
|
+
const result = await publicClient.readContract({
|
|
167
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
168
|
+
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
169
|
+
functionName: 'hasCredentialById',
|
|
170
|
+
args: [credentialId, accountAddress],
|
|
171
|
+
});
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Checks if a credential exists by its public key coordinates
|
|
176
|
+
* @param pubKeyX X coordinate of the public key
|
|
177
|
+
* @param pubKeyY Y coordinate of the public key
|
|
178
|
+
* @param accountAddress Address of the account
|
|
179
|
+
* @param chain Chain to query on
|
|
180
|
+
* @param provider Optional provider configuration
|
|
181
|
+
* @returns Promise resolving to whether the credential exists
|
|
182
|
+
*/
|
|
183
|
+
async function hasCredential(pubKeyX, pubKeyY, accountAddress, chain, provider) {
|
|
184
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
185
|
+
chain,
|
|
186
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
187
|
+
});
|
|
188
|
+
const result = await publicClient.readContract({
|
|
189
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
190
|
+
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
191
|
+
functionName: 'hasCredential',
|
|
192
|
+
args: [pubKeyX, pubKeyY, accountAddress],
|
|
193
|
+
});
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Creates a transaction call to add a WebAuthn credential to an account
|
|
198
|
+
* @param pubKeyX X coordinate of the public key
|
|
199
|
+
* @param pubKeyY Y coordinate of the public key
|
|
200
|
+
* @param requireUV Whether user verification (biometrics/PIN) is required
|
|
201
|
+
* @returns Call object for adding the credential
|
|
202
|
+
*/
|
|
203
|
+
function addCredential(pubKeyX, pubKeyY, requireUV = false) {
|
|
204
|
+
return {
|
|
205
|
+
to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
206
|
+
value: 0n,
|
|
207
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
208
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
209
|
+
functionName: 'addCredential',
|
|
210
|
+
args: [pubKeyX, pubKeyY, requireUV],
|
|
211
|
+
}),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Creates a transaction call to remove a WebAuthn credential from an account
|
|
216
|
+
* @param pubKeyX X coordinate of the public key
|
|
217
|
+
* @param pubKeyY Y coordinate of the public key
|
|
218
|
+
* @returns Call object for removing the credential
|
|
219
|
+
*/
|
|
220
|
+
function removeCredential(pubKeyX, pubKeyY) {
|
|
221
|
+
return {
|
|
222
|
+
to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
223
|
+
value: 0n,
|
|
224
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
225
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
226
|
+
functionName: 'removeCredential',
|
|
227
|
+
args: [pubKeyX, pubKeyY],
|
|
228
|
+
}),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Creates a transaction call to set the threshold for WebAuthn validation
|
|
233
|
+
* @param threshold Number of required signatures for validation
|
|
234
|
+
* @returns Call object for setting the threshold
|
|
235
|
+
*/
|
|
236
|
+
function setThreshold(threshold) {
|
|
237
|
+
return {
|
|
238
|
+
to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
239
|
+
value: 0n,
|
|
240
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
241
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
242
|
+
functionName: 'setThreshold',
|
|
243
|
+
args: [BigInt(threshold)],
|
|
244
|
+
}),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Gets detailed information about a credential
|
|
249
|
+
* @param credentialId The credential ID to query
|
|
250
|
+
* @param accountAddress Address of the account
|
|
251
|
+
* @param chain Chain to query on
|
|
252
|
+
* @param provider Optional provider configuration
|
|
253
|
+
* @returns Promise resolving to credential details
|
|
254
|
+
*/
|
|
255
|
+
async function getCredentialInfo(credentialId, accountAddress, chain, provider) {
|
|
256
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
257
|
+
chain,
|
|
258
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
259
|
+
});
|
|
260
|
+
const result = await publicClient.readContract({
|
|
261
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
262
|
+
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
263
|
+
functionName: 'getCredentialInfo',
|
|
264
|
+
args: [credentialId, accountAddress],
|
|
265
|
+
});
|
|
266
|
+
const [pubKeyX, pubKeyY, requireUV] = result;
|
|
267
|
+
return { pubKeyX, pubKeyY, requireUV };
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Gets the current threshold for an account
|
|
271
|
+
* @param accountAddress Address of the account
|
|
272
|
+
* @param chain Chain to query on
|
|
273
|
+
* @param provider Optional provider configuration
|
|
274
|
+
* @returns Promise resolving to the current threshold
|
|
275
|
+
*/
|
|
276
|
+
async function getThreshold(accountAddress, chain, provider) {
|
|
277
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
278
|
+
chain,
|
|
279
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
280
|
+
});
|
|
281
|
+
const result = await publicClient.readContract({
|
|
282
|
+
abi: WEBAUTHN_VALIDATOR_ABI,
|
|
283
|
+
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
284
|
+
functionName: 'threshold',
|
|
285
|
+
args: [accountAddress],
|
|
286
|
+
});
|
|
287
|
+
return Number(result);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Gets all credentials for an account with their detailed information
|
|
291
|
+
* @param accountAddress Address of the account
|
|
292
|
+
* @param chain Chain to query on
|
|
293
|
+
* @param provider Optional provider configuration
|
|
294
|
+
* @returns Promise resolving to array of credentials with their details
|
|
295
|
+
*/
|
|
296
|
+
async function getCredentials(accountAddress, chain, provider) {
|
|
297
|
+
// First get all credential IDs
|
|
298
|
+
const credentialIds = await getCredentialIds(accountAddress, chain, provider);
|
|
299
|
+
// Then get detailed info for each credential
|
|
300
|
+
const credentials = await Promise.all(credentialIds.map(async (credentialId) => {
|
|
301
|
+
const info = await getCredentialInfo(credentialId, accountAddress, chain, provider);
|
|
302
|
+
return {
|
|
303
|
+
credentialId,
|
|
304
|
+
...info,
|
|
305
|
+
};
|
|
306
|
+
}));
|
|
307
|
+
return credentials;
|
|
308
|
+
}
|