@farcaster/miniapp-core 0.0.0-canary-20250816182708 → 0.0.0-canary-20250926142931
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/actions/SignIn.d.ts +3 -4
- package/dist/actions/SignManifest.d.ts +51 -0
- package/dist/actions/SignManifest.js +67 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +2 -1
- package/dist/schemas/manifest.d.ts +28 -28
- package/dist/types.d.ts +4 -2
- package/dist/types.js +1 -0
- package/esm/actions/SignIn.d.ts +3 -4
- package/esm/actions/SignManifest.d.ts +51 -0
- package/esm/actions/SignManifest.js +28 -0
- package/esm/actions/index.d.ts +1 -0
- package/esm/actions/index.js +1 -0
- package/esm/schemas/manifest.d.ts +28 -28
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +4 -2
- package/esm/types.js +1 -0
- package/package.json +1 -1
- package/src/actions/SignIn.ts +3 -4
- package/src/actions/SignManifest.ts +77 -0
- package/src/actions/index.ts +1 -0
- package/src/types.ts +4 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as Errors from '../errors.ts'
|
|
2
|
+
import type { OneOf } from '../internal/types.ts'
|
|
3
|
+
|
|
4
|
+
export type SignManifestOptions = {
|
|
5
|
+
domain: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type SignManifestResult = {
|
|
9
|
+
header: string
|
|
10
|
+
payload: string
|
|
11
|
+
signature: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SignManifest = (
|
|
15
|
+
options: SignManifestOptions,
|
|
16
|
+
) => Promise<SignManifestResult>
|
|
17
|
+
|
|
18
|
+
type RejectedByUserJsonError = {
|
|
19
|
+
type: 'rejected_by_user'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type InvalidDomainJsonError = {
|
|
23
|
+
type: 'invalid_domain'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type GenericErrorJsonError = {
|
|
27
|
+
type: 'generic_error'
|
|
28
|
+
message?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type SignManifestJsonError =
|
|
32
|
+
| RejectedByUserJsonError
|
|
33
|
+
| InvalidDomainJsonError
|
|
34
|
+
| GenericErrorJsonError
|
|
35
|
+
|
|
36
|
+
export type SignManifestRejectedReason = SignManifestJsonError['type']
|
|
37
|
+
|
|
38
|
+
export type SignManifestJsonResult = OneOf<
|
|
39
|
+
{ result: SignManifestResult } | { error: SignManifestJsonError }
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
export type WireSignManifest = (
|
|
43
|
+
options: SignManifestOptions,
|
|
44
|
+
) => Promise<SignManifestJsonResult>
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Thrown when sign manifest action was rejected by the user.
|
|
48
|
+
*/
|
|
49
|
+
export class RejectedByUser extends Errors.BaseError {
|
|
50
|
+
override readonly name = 'SignManifest.RejectedByUser'
|
|
51
|
+
|
|
52
|
+
constructor() {
|
|
53
|
+
super('Sign manifest rejected by user')
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Thrown when the provided domain is invalid.
|
|
59
|
+
*/
|
|
60
|
+
export class InvalidDomain extends Errors.BaseError {
|
|
61
|
+
override readonly name = 'SignManifest.InvalidDomain'
|
|
62
|
+
|
|
63
|
+
constructor() {
|
|
64
|
+
super('Invalid domain provided')
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Thrown when manifest signing fails for generic reasons.
|
|
70
|
+
*/
|
|
71
|
+
export class GenericError extends Errors.BaseError {
|
|
72
|
+
override readonly name = 'SignManifest.GenericError'
|
|
73
|
+
|
|
74
|
+
constructor(message = 'Manifest signing failed') {
|
|
75
|
+
super(message)
|
|
76
|
+
}
|
|
77
|
+
}
|
package/src/actions/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * as Ready from './Ready.ts'
|
|
|
6
6
|
export * as RequestCameraAndMicrophoneAccess from './RequestCameraAndMicrophoneAccess.ts'
|
|
7
7
|
export * as SendToken from './SendToken.ts'
|
|
8
8
|
export * as SignIn from './SignIn.ts'
|
|
9
|
+
export * as SignManifest from './SignManifest.ts'
|
|
9
10
|
export * as SwapToken from './SwapToken.ts'
|
|
10
11
|
export * as ViewCast from './ViewCast.ts'
|
|
11
12
|
export * as ViewProfile from './ViewProfile.ts'
|
package/src/types.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
RequestCameraAndMicrophoneAccess,
|
|
12
12
|
SendToken,
|
|
13
13
|
SignIn,
|
|
14
|
+
SignManifest,
|
|
14
15
|
SwapToken,
|
|
15
16
|
ViewCast,
|
|
16
17
|
ViewProfile,
|
|
@@ -62,6 +63,7 @@ export const miniAppHostCapabilityList = [
|
|
|
62
63
|
'actions.swapToken',
|
|
63
64
|
'actions.openMiniApp',
|
|
64
65
|
'actions.requestCameraAndMicrophoneAccess',
|
|
66
|
+
'experimental.signManifest',
|
|
65
67
|
'haptics.impactOccurred',
|
|
66
68
|
'haptics.notificationOccurred',
|
|
67
69
|
'haptics.selectionChanged',
|
|
@@ -81,6 +83,7 @@ export type WireMiniAppHost = {
|
|
|
81
83
|
ready: Ready.Ready
|
|
82
84
|
openUrl: (url: string) => void
|
|
83
85
|
signIn: SignIn.WireSignIn
|
|
86
|
+
signManifest: SignManifest.WireSignManifest
|
|
84
87
|
setPrimaryButton: SetPrimaryButton
|
|
85
88
|
ethProviderRequest: Ethereum.EthProvideRequest
|
|
86
89
|
ethProviderRequestV2: Ethereum.RpcTransport
|
|
@@ -112,6 +115,7 @@ export type MiniAppHost = {
|
|
|
112
115
|
ready: Ready.Ready
|
|
113
116
|
openUrl: (url: string) => void
|
|
114
117
|
signIn: SignIn.SignIn
|
|
118
|
+
signManifest: SignManifest.SignManifest
|
|
115
119
|
setPrimaryButton: SetPrimaryButton
|
|
116
120
|
ethProviderRequest: Ethereum.EthProvideRequest
|
|
117
121
|
ethProviderRequestV2: Ethereum.RpcTransport
|