permissionless 0.2.34 → 0.2.36
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/CHANGELOG.md +12 -0
- package/_cjs/accounts/kernel/toKernelSmartAccount.js +3 -3
- package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signMessage.js +2 -2
- package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_cjs/accounts/nexus/toNexusSmartAccount.js +12 -2
- package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js +1 -1
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/actions/passkeyServer/getCredentials.js +24 -0
- package/_cjs/actions/passkeyServer/getCredentials.js.map +1 -0
- package/_cjs/actions/passkeyServer/startRegistration.js +80 -0
- package/_cjs/actions/passkeyServer/startRegistration.js.map +1 -0
- package/_cjs/actions/passkeyServer/verifyRegistration.js +71 -0
- package/_cjs/actions/passkeyServer/verifyRegistration.js.map +1 -0
- package/_cjs/actions/passkeyServer.js +10 -0
- package/_cjs/actions/passkeyServer.js.map +1 -0
- package/_cjs/clients/decorators/passkeyServer.js +13 -0
- package/_cjs/clients/decorators/passkeyServer.js.map +1 -0
- package/_cjs/clients/passkeyServer.js +15 -0
- package/_cjs/clients/passkeyServer.js.map +1 -0
- package/_cjs/types/passkeyServer.js +3 -0
- package/_cjs/types/passkeyServer.js.map +1 -0
- package/_esm/accounts/kernel/toKernelSmartAccount.js +3 -3
- package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/signMessage.js +2 -2
- package/_esm/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_esm/accounts/nexus/toNexusSmartAccount.js +12 -2
- package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js +1 -1
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/actions/passkeyServer/getCredentials.js +20 -0
- package/_esm/actions/passkeyServer/getCredentials.js.map +1 -0
- package/_esm/actions/passkeyServer/startRegistration.js +85 -0
- package/_esm/actions/passkeyServer/startRegistration.js.map +1 -0
- package/_esm/actions/passkeyServer/verifyRegistration.js +67 -0
- package/_esm/actions/passkeyServer/verifyRegistration.js.map +1 -0
- package/_esm/actions/passkeyServer.js +5 -0
- package/_esm/actions/passkeyServer.js.map +1 -0
- package/_esm/clients/decorators/passkeyServer.js +9 -0
- package/_esm/clients/decorators/passkeyServer.js.map +1 -0
- package/_esm/clients/passkeyServer.js +12 -0
- package/_esm/clients/passkeyServer.js.map +1 -0
- package/_esm/types/passkeyServer.js +2 -0
- package/_esm/types/passkeyServer.js.map +1 -0
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -1
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/actions/passkeyServer/getCredentials.d.ts +11 -0
- package/_types/actions/passkeyServer/getCredentials.d.ts.map +1 -0
- package/_types/actions/passkeyServer/startRegistration.d.ts +9 -0
- package/_types/actions/passkeyServer/startRegistration.d.ts.map +1 -0
- package/_types/actions/passkeyServer/verifyRegistration.d.ts +14 -0
- package/_types/actions/passkeyServer/verifyRegistration.d.ts.map +1 -0
- package/_types/actions/passkeyServer.d.ts +5 -0
- package/_types/actions/passkeyServer.d.ts.map +1 -0
- package/_types/clients/decorators/passkeyServer.d.ts +12 -0
- package/_types/clients/decorators/passkeyServer.d.ts.map +1 -0
- package/_types/clients/passkeyServer.d.ts +7 -0
- package/_types/clients/passkeyServer.d.ts.map +1 -0
- package/_types/types/passkeyServer.d.ts +74 -0
- package/_types/types/passkeyServer.d.ts.map +1 -0
- package/accounts/kernel/toKernelSmartAccount.ts +6 -7
- package/accounts/kernel/utils/signMessage.ts +2 -2
- package/accounts/nexus/toNexusSmartAccount.ts +16 -2
- package/accounts/safe/toSafeSmartAccount.ts +3 -1
- package/actions/passkeyServer/getCredentials.ts +47 -0
- package/actions/passkeyServer/startRegistration.ts +125 -0
- package/actions/passkeyServer/verifyRegistration.ts +114 -0
- package/actions/passkeyServer.ts +29 -0
- package/clients/decorators/passkeyServer.ts +42 -0
- package/clients/passkeyServer.ts +69 -0
- package/package.json +18 -3
- package/types/passkeyServer.ts +82 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Account,
|
|
3
|
+
Chain,
|
|
4
|
+
Client,
|
|
5
|
+
ClientConfig,
|
|
6
|
+
Prettify,
|
|
7
|
+
RpcSchema,
|
|
8
|
+
Transport
|
|
9
|
+
} from "viem"
|
|
10
|
+
import { createClient } from "viem"
|
|
11
|
+
import type { PasskeyServerRpcSchema } from "../types/passkeyServer.js"
|
|
12
|
+
import {
|
|
13
|
+
type PasskeyServerActions,
|
|
14
|
+
passkeyServerActions
|
|
15
|
+
} from "./decorators/passkeyServer.js"
|
|
16
|
+
|
|
17
|
+
export type PasskeyServerClient<
|
|
18
|
+
rpcSchema extends RpcSchema | undefined = undefined
|
|
19
|
+
> = Prettify<
|
|
20
|
+
Client<
|
|
21
|
+
Transport,
|
|
22
|
+
Chain | undefined,
|
|
23
|
+
Account | undefined,
|
|
24
|
+
rpcSchema extends RpcSchema
|
|
25
|
+
? [...PasskeyServerRpcSchema, ...rpcSchema]
|
|
26
|
+
: [...PasskeyServerRpcSchema],
|
|
27
|
+
PasskeyServerActions
|
|
28
|
+
>
|
|
29
|
+
>
|
|
30
|
+
|
|
31
|
+
export type PasskeyServerClientConfig<
|
|
32
|
+
rpcSchema extends RpcSchema | undefined = undefined
|
|
33
|
+
> = Prettify<
|
|
34
|
+
Pick<
|
|
35
|
+
ClientConfig<
|
|
36
|
+
Transport,
|
|
37
|
+
Chain | undefined,
|
|
38
|
+
Account | undefined,
|
|
39
|
+
rpcSchema
|
|
40
|
+
>,
|
|
41
|
+
| "account"
|
|
42
|
+
| "cacheTime"
|
|
43
|
+
| "chain"
|
|
44
|
+
| "key"
|
|
45
|
+
| "name"
|
|
46
|
+
| "pollingInterval"
|
|
47
|
+
| "rpcSchema"
|
|
48
|
+
| "transport"
|
|
49
|
+
>
|
|
50
|
+
>
|
|
51
|
+
|
|
52
|
+
export function createPasskeyServerClient<
|
|
53
|
+
rpcSchema extends RpcSchema | undefined = undefined
|
|
54
|
+
>(
|
|
55
|
+
parameters: PasskeyServerClientConfig<rpcSchema>
|
|
56
|
+
): PasskeyServerClient<rpcSchema>
|
|
57
|
+
|
|
58
|
+
export function createPasskeyServerClient(
|
|
59
|
+
parameters: PasskeyServerClientConfig
|
|
60
|
+
): PasskeyServerClient {
|
|
61
|
+
const { key = "public", name = "Passkey Server Client" } = parameters
|
|
62
|
+
|
|
63
|
+
return createClient({
|
|
64
|
+
...parameters,
|
|
65
|
+
key,
|
|
66
|
+
name,
|
|
67
|
+
type: "passkeyServerClient"
|
|
68
|
+
}).extend(passkeyServerActions)
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "permissionless",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.36",
|
|
4
4
|
"author": "Pimlico",
|
|
5
5
|
"homepage": "https://docs.pimlico.io/permissionless",
|
|
6
6
|
"repository": "github:pimlicolabs/permissionless.js",
|
|
@@ -50,6 +50,11 @@
|
|
|
50
50
|
"import": "./_esm/actions/pimlico.js",
|
|
51
51
|
"default": "./_cjs/actions/pimlico.js"
|
|
52
52
|
},
|
|
53
|
+
"./actions/passkeyServer": {
|
|
54
|
+
"types": "./_types/actions/passkeyServer.d.ts",
|
|
55
|
+
"import": "./_esm/actions/passkeyServer.js",
|
|
56
|
+
"default": "./_cjs/actions/passkeyServer.js"
|
|
57
|
+
},
|
|
53
58
|
"./actions/etherspot": {
|
|
54
59
|
"types": "./_types/actions/etherspot.d.ts",
|
|
55
60
|
"import": "./_esm/actions/etherspot.js",
|
|
@@ -70,6 +75,11 @@
|
|
|
70
75
|
"import": "./_esm/clients/pimlico.js",
|
|
71
76
|
"default": "./_cjs/clients/pimlico.js"
|
|
72
77
|
},
|
|
78
|
+
"./clients/passkeyServer": {
|
|
79
|
+
"types": "./_types/clients/passkeyServer.d.ts",
|
|
80
|
+
"import": "./_esm/clients/passkeyServer.js",
|
|
81
|
+
"default": "./_cjs/clients/passkeyServer.js"
|
|
82
|
+
},
|
|
73
83
|
"./utils": {
|
|
74
84
|
"types": "./_types/utils/index.d.ts",
|
|
75
85
|
"import": "./_esm/utils/index.js",
|
|
@@ -87,7 +97,12 @@
|
|
|
87
97
|
}
|
|
88
98
|
},
|
|
89
99
|
"peerDependencies": {
|
|
90
|
-
"viem": "^2.
|
|
91
|
-
"
|
|
100
|
+
"viem": "^2.23.2",
|
|
101
|
+
"ox": "0.6.7"
|
|
102
|
+
},
|
|
103
|
+
"peerDependenciesMeta": {
|
|
104
|
+
"ox": {
|
|
105
|
+
"optional": true
|
|
106
|
+
}
|
|
92
107
|
}
|
|
93
108
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Hex } from "viem"
|
|
2
|
+
|
|
3
|
+
export type PasskeyServerRpcSchema = [
|
|
4
|
+
{
|
|
5
|
+
Method: "pks_startRegistration"
|
|
6
|
+
Parameters: [context: unknown]
|
|
7
|
+
ReturnType: {
|
|
8
|
+
rp: {
|
|
9
|
+
id: string
|
|
10
|
+
name: string
|
|
11
|
+
}
|
|
12
|
+
user: {
|
|
13
|
+
id: string
|
|
14
|
+
name: string
|
|
15
|
+
displayName: string
|
|
16
|
+
}
|
|
17
|
+
challenge: string
|
|
18
|
+
timeout?: number
|
|
19
|
+
authenticatorSelection?: {
|
|
20
|
+
authenticatorAttachment?: "platform" | "cross-platform"
|
|
21
|
+
requireResidentKey?: boolean
|
|
22
|
+
residentKey?: "required" | "preferred" | "discouraged"
|
|
23
|
+
userVerification?: "required" | "preferred" | "discouraged"
|
|
24
|
+
}
|
|
25
|
+
attestation: "direct" | "enterprise" | "indirect" | "none"
|
|
26
|
+
extensions?: {
|
|
27
|
+
appid?: string
|
|
28
|
+
credProps?: boolean
|
|
29
|
+
hmacCreateSecret?: boolean
|
|
30
|
+
minPinLength?: boolean
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
Method: "pks_verifyRegistration"
|
|
36
|
+
Parameters: [
|
|
37
|
+
{
|
|
38
|
+
id: string
|
|
39
|
+
rawId: string
|
|
40
|
+
response: {
|
|
41
|
+
clientDataJSON: string
|
|
42
|
+
attestationObject: string
|
|
43
|
+
authenticatorData?: string
|
|
44
|
+
transports?: (
|
|
45
|
+
| "ble"
|
|
46
|
+
| "cable"
|
|
47
|
+
| "hybrid"
|
|
48
|
+
| "internal"
|
|
49
|
+
| "nfc"
|
|
50
|
+
| "smart-card"
|
|
51
|
+
| "usb"
|
|
52
|
+
)[]
|
|
53
|
+
publicKeyAlgorithm?: number
|
|
54
|
+
publicKeyType?: string
|
|
55
|
+
}
|
|
56
|
+
authenticatorAttachment: "cross-platform" | "platform"
|
|
57
|
+
clientExtensionResults: {
|
|
58
|
+
appid?: boolean
|
|
59
|
+
credProps?: {
|
|
60
|
+
rk?: boolean
|
|
61
|
+
}
|
|
62
|
+
hmacCreateSecret?: boolean
|
|
63
|
+
}
|
|
64
|
+
type: "public-key"
|
|
65
|
+
},
|
|
66
|
+
context: unknown
|
|
67
|
+
]
|
|
68
|
+
ReturnType: {
|
|
69
|
+
success: boolean
|
|
70
|
+
id: string
|
|
71
|
+
publicKey: Hex
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
Method: "pks_getCredentials"
|
|
76
|
+
Parameters: [context: unknown]
|
|
77
|
+
ReturnType: {
|
|
78
|
+
id: string
|
|
79
|
+
publicKey: Hex
|
|
80
|
+
}[]
|
|
81
|
+
}
|
|
82
|
+
]
|