@arcblock/did-connect-js 1.29.23 → 4.0.0-beta.2
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/{lib/adapters/detect.d.cts → dist/adapters/detect.d.ts} +3 -5
- package/dist/adapters/detect.d.ts.map +1 -0
- package/dist/adapters/detect.js +13 -0
- package/dist/adapters/detect.js.map +1 -0
- package/dist/adapters/express.d.ts +40 -0
- package/dist/adapters/express.d.ts.map +1 -0
- package/dist/adapters/express.js +30 -0
- package/dist/adapters/express.js.map +1 -0
- package/dist/adapters/hono.d.ts +49 -0
- package/dist/adapters/hono.d.ts.map +1 -0
- package/dist/adapters/hono.js +176 -0
- package/dist/adapters/hono.js.map +1 -0
- package/dist/authenticator/base.d.ts +21 -0
- package/dist/authenticator/base.d.ts.map +1 -0
- package/dist/authenticator/base.js +109 -0
- package/dist/authenticator/base.js.map +1 -0
- package/dist/authenticator/wallet.d.ts +221 -0
- package/dist/authenticator/wallet.d.ts.map +1 -0
- package/dist/authenticator/wallet.js +588 -0
- package/dist/authenticator/wallet.js.map +1 -0
- package/dist/handlers/base.d.ts +25 -0
- package/dist/handlers/base.d.ts.map +1 -0
- package/dist/handlers/base.js +48 -0
- package/dist/handlers/base.js.map +1 -0
- package/dist/handlers/util.d.ts +48 -0
- package/dist/handlers/util.d.ts.map +1 -0
- package/dist/handlers/util.js +812 -0
- package/dist/handlers/util.js.map +1 -0
- package/dist/handlers/wallet.d.ts +96 -0
- package/dist/handlers/wallet.d.ts.map +1 -0
- package/dist/handlers/wallet.js +129 -0
- package/dist/handlers/wallet.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +14 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +37 -0
- package/dist/protocol.js.map +1 -0
- package/dist/schema/claims.d.ts +17 -0
- package/dist/schema/claims.d.ts.map +1 -0
- package/dist/schema/claims.js +205 -0
- package/dist/schema/claims.js.map +1 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +49 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/storage/kv.d.ts +31 -0
- package/dist/storage/kv.d.ts.map +1 -0
- package/dist/storage/kv.js +54 -0
- package/dist/storage/kv.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -104
- package/LICENSE +0 -13
- package/README.md +0 -210
- package/esm/_virtual/rolldown_runtime.mjs +0 -8
- package/esm/adapters/detect.d.mts +0 -11
- package/esm/adapters/detect.mjs +0 -16
- package/esm/adapters/express.d.mts +0 -48
- package/esm/adapters/express.mjs +0 -39
- package/esm/adapters/hono.d.mts +0 -57
- package/esm/adapters/hono.mjs +0 -164
- package/esm/authenticator/base.d.mts +0 -23
- package/esm/authenticator/base.mjs +0 -88
- package/esm/authenticator/wallet.d.mts +0 -270
- package/esm/authenticator/wallet.mjs +0 -556
- package/esm/handlers/base.d.mts +0 -32
- package/esm/handlers/base.mjs +0 -37
- package/esm/handlers/util.d.mts +0 -70
- package/esm/handlers/util.mjs +0 -739
- package/esm/handlers/wallet.d.mts +0 -120
- package/esm/handlers/wallet.mjs +0 -139
- package/esm/index.d.mts +0 -8
- package/esm/index.mjs +0 -8
- package/esm/package.mjs +0 -118
- package/esm/protocol.d.mts +0 -15
- package/esm/protocol.mjs +0 -40
- package/esm/schema/claims.d.mts +0 -18
- package/esm/schema/claims.mjs +0 -154
- package/esm/schema/index.d.mts +0 -9
- package/esm/schema/index.mjs +0 -49
- package/esm/storage/kv.d.mts +0 -33
- package/esm/storage/kv.mjs +0 -55
- package/esm/types.d.mts +0 -55
- package/esm/types.mjs +0 -1
- package/lib/_virtual/rolldown_runtime.cjs +0 -31
- package/lib/adapters/detect.cjs +0 -18
- package/lib/adapters/express.cjs +0 -41
- package/lib/adapters/express.d.cts +0 -48
- package/lib/adapters/hono.cjs +0 -167
- package/lib/adapters/hono.d.cts +0 -57
- package/lib/authenticator/base.cjs +0 -91
- package/lib/authenticator/base.d.cts +0 -23
- package/lib/authenticator/wallet.cjs +0 -564
- package/lib/authenticator/wallet.d.cts +0 -270
- package/lib/handlers/base.cjs +0 -40
- package/lib/handlers/base.d.cts +0 -32
- package/lib/handlers/util.cjs +0 -759
- package/lib/handlers/util.d.cts +0 -70
- package/lib/handlers/wallet.cjs +0 -139
- package/lib/handlers/wallet.d.cts +0 -119
- package/lib/index.cjs +0 -16
- package/lib/index.d.cts +0 -8
- package/lib/package.cjs +0 -121
- package/lib/protocol.cjs +0 -46
- package/lib/protocol.d.cts +0 -15
- package/lib/schema/claims.cjs +0 -156
- package/lib/schema/claims.d.cts +0 -18
- package/lib/schema/index.cjs +0 -52
- package/lib/schema/index.d.cts +0 -9
- package/lib/storage/kv.cjs +0 -57
- package/lib/storage/kv.d.cts +0 -33
- package/lib/types.cjs +0 -0
- package/lib/types.d.cts +0 -55
package/lib/schema/claims.cjs
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
3
|
-
let _arcblock_validator = require("@arcblock/validator");
|
|
4
|
-
let _ocap_mcrypto = require("@ocap/mcrypto");
|
|
5
|
-
|
|
6
|
-
//#region src/schema/claims.ts
|
|
7
|
-
const trustedIssuerSchema = _arcblock_validator.Joi.alternatives().try(_arcblock_validator.Joi.object({
|
|
8
|
-
did: _arcblock_validator.Joi.DID().required(),
|
|
9
|
-
endpoint: _arcblock_validator.Joi.string().uri({ scheme: ["http", "https"] }).required()
|
|
10
|
-
}), _arcblock_validator.Joi.DID().required());
|
|
11
|
-
const optionalUrlSchema = _arcblock_validator.Joi.string().uri({
|
|
12
|
-
scheme: ["http", "https"],
|
|
13
|
-
allowRelative: true
|
|
14
|
-
}).optional().default("").allow("");
|
|
15
|
-
const requirementSchema = _arcblock_validator.Joi.object({
|
|
16
|
-
tokens: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.object({
|
|
17
|
-
address: _arcblock_validator.Joi.DID().required(),
|
|
18
|
-
value: _arcblock_validator.Joi.BN().positive().required()
|
|
19
|
-
})).required(),
|
|
20
|
-
assets: _arcblock_validator.Joi.object({
|
|
21
|
-
address: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional(),
|
|
22
|
-
parent: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional(),
|
|
23
|
-
issuer: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional(),
|
|
24
|
-
amount: _arcblock_validator.Joi.number().positive().min(1)
|
|
25
|
-
}).optional()
|
|
26
|
-
});
|
|
27
|
-
const targetTypeSchema = _arcblock_validator.Joi.object({
|
|
28
|
-
key: _arcblock_validator.Joi.string().valid(...Object.keys(_ocap_mcrypto.types.KeyType).map((x) => x.toLowerCase())).default("ed25519"),
|
|
29
|
-
hash: _arcblock_validator.Joi.string().valid(...Object.keys(_ocap_mcrypto.types.HashType).map((x) => x.toLowerCase())).default("sha3"),
|
|
30
|
-
role: _arcblock_validator.Joi.string().valid(...Object.keys(_ocap_mcrypto.types.RoleType).map((x) => x.toLowerCase().split("_").pop())).default("account"),
|
|
31
|
-
encoding: _arcblock_validator.Joi.string().valid(...Object.keys(_ocap_mcrypto.types.EncodingType).map((x) => x.toLowerCase())).default("base58")
|
|
32
|
-
}).optional();
|
|
33
|
-
var claims_default = (chainInfo) => {
|
|
34
|
-
const options = {
|
|
35
|
-
stripUnknown: true,
|
|
36
|
-
noDefaults: false
|
|
37
|
-
};
|
|
38
|
-
const createStandardFields = (type, description) => ({
|
|
39
|
-
type: _arcblock_validator.Joi.string().valid(type).default(type),
|
|
40
|
-
description: _arcblock_validator.Joi.string().min(1).default(description),
|
|
41
|
-
chainInfo,
|
|
42
|
-
mfaCode: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.number().min(10).max(99).optional()).default([]),
|
|
43
|
-
meta: _arcblock_validator.Joi.any().optional().default({})
|
|
44
|
-
});
|
|
45
|
-
const authPrincipal = _arcblock_validator.Joi.object({
|
|
46
|
-
...createStandardFields("authPrincipal", "Please continue with your account"),
|
|
47
|
-
target: _arcblock_validator.Joi.DID().optional().allow("").default(""),
|
|
48
|
-
supervised: _arcblock_validator.Joi.boolean().default(false),
|
|
49
|
-
targetType: targetTypeSchema
|
|
50
|
-
}).options(options);
|
|
51
|
-
const keyPair = _arcblock_validator.Joi.object({
|
|
52
|
-
...createStandardFields("keyPair", "Please create account to continue."),
|
|
53
|
-
moniker: _arcblock_validator.Joi.string().regex(/^[a-zA-Z0-9][-a-zA-Z0-9_]{2,128}$/).required(),
|
|
54
|
-
declare: _arcblock_validator.Joi.boolean().optional().default(true),
|
|
55
|
-
migrateFrom: _arcblock_validator.Joi.DID().optional().allow("").default(""),
|
|
56
|
-
targetType: targetTypeSchema
|
|
57
|
-
}).options(options);
|
|
58
|
-
const encryptionKey = _arcblock_validator.Joi.object({
|
|
59
|
-
...createStandardFields("encryptionKey", "Please provide encryptionKey to continue."),
|
|
60
|
-
salt: _arcblock_validator.Joi.string().required(),
|
|
61
|
-
delegation: _arcblock_validator.Joi.string().optional().allow("").default("")
|
|
62
|
-
}).options(options);
|
|
63
|
-
return {
|
|
64
|
-
authPrincipal,
|
|
65
|
-
profile: _arcblock_validator.Joi.object({
|
|
66
|
-
...createStandardFields("profile", "Please provide your profile to continue."),
|
|
67
|
-
items: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.string().valid("did", "fullName", "email", "phone", "signature", "avatar", "birthday", "url")).min(1).default(["fullName"])
|
|
68
|
-
}).rename("fields", "items", {
|
|
69
|
-
ignoreUndefined: true,
|
|
70
|
-
override: true
|
|
71
|
-
}).options(options),
|
|
72
|
-
signature: _arcblock_validator.Joi.object({
|
|
73
|
-
...createStandardFields("signature", "Sign this transaction or message to continue."),
|
|
74
|
-
typeUrl: _arcblock_validator.Joi.string().valid("fg:x:delegation", "fg:t:transaction", "mime:text/plain", "mime:text/html", "eth:transaction", "eth:standard-data", "eth:personal-data", "eth:typed-data", "eth:legacy-data").required(),
|
|
75
|
-
display: _arcblock_validator.Joi.string().allow("").default(""),
|
|
76
|
-
method: _arcblock_validator.Joi.string().allow("none", ...Object.keys(_ocap_mcrypto.types.HashType).map((x) => x.toLowerCase())).optional().default("sha3"),
|
|
77
|
-
digest: _arcblock_validator.Joi.string().allow("").default(""),
|
|
78
|
-
origin: _arcblock_validator.Joi.string().allow("").default(""),
|
|
79
|
-
nonce: _arcblock_validator.Joi.string().allow("").default(""),
|
|
80
|
-
requirement: requirementSchema.optional()
|
|
81
|
-
}).options(options),
|
|
82
|
-
prepareTx: _arcblock_validator.Joi.object({
|
|
83
|
-
...createStandardFields("prepareTx", "Prepare and sign this transaction to continue."),
|
|
84
|
-
display: _arcblock_validator.Joi.string().allow("").default(""),
|
|
85
|
-
partialTx: _arcblock_validator.Joi.string().required(),
|
|
86
|
-
nonce: _arcblock_validator.Joi.string().allow("").default(""),
|
|
87
|
-
requirement: requirementSchema.required()
|
|
88
|
-
}).options(options),
|
|
89
|
-
agreement: _arcblock_validator.Joi.object({
|
|
90
|
-
...createStandardFields("agreement", "Confirm your agreement to continue."),
|
|
91
|
-
uri: _arcblock_validator.Joi.string().uri({ scheme: ["http", "https"] }).required().allow(""),
|
|
92
|
-
method: _arcblock_validator.Joi.string().allow(...Object.keys(_ocap_mcrypto.types.HashType).map((x) => x.toLowerCase())).optional().default("sha2"),
|
|
93
|
-
digest: _arcblock_validator.Joi.string().required()
|
|
94
|
-
}).options(options),
|
|
95
|
-
verifiableCredential: _arcblock_validator.Joi.object({
|
|
96
|
-
...createStandardFields("verifiableCredential", "Please present a verifiable credential to continue."),
|
|
97
|
-
optional: _arcblock_validator.Joi.boolean().default(false),
|
|
98
|
-
claimUrl: optionalUrlSchema,
|
|
99
|
-
acquireUrl: optionalUrlSchema,
|
|
100
|
-
item: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.string().min(1).required()).min(1).optional(),
|
|
101
|
-
target: _arcblock_validator.Joi.DID().optional(),
|
|
102
|
-
trustedIssuers: _arcblock_validator.Joi.array().items(trustedIssuerSchema).min(1).optional(),
|
|
103
|
-
tag: _arcblock_validator.Joi.string().min(1).allow("").default(""),
|
|
104
|
-
ownerDid: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional().default([]),
|
|
105
|
-
filters: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.object({
|
|
106
|
-
type: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.string().min(1).required()).min(1).optional(),
|
|
107
|
-
target: _arcblock_validator.Joi.DID().optional(),
|
|
108
|
-
trustedIssuers: _arcblock_validator.Joi.array().items(trustedIssuerSchema).min(1).optional(),
|
|
109
|
-
tag: _arcblock_validator.Joi.string().min(1).allow("").default(""),
|
|
110
|
-
ownerDid: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional().default([]),
|
|
111
|
-
claimUrl: optionalUrlSchema,
|
|
112
|
-
acquireUrl: optionalUrlSchema
|
|
113
|
-
})).optional()
|
|
114
|
-
}).options(options),
|
|
115
|
-
asset: _arcblock_validator.Joi.object({
|
|
116
|
-
...createStandardFields("asset", "Please present an on chain asset to continue."),
|
|
117
|
-
optional: _arcblock_validator.Joi.boolean().default(false),
|
|
118
|
-
address: _arcblock_validator.Joi.DID().optional(),
|
|
119
|
-
trustedIssuers: _arcblock_validator.Joi.array().items(trustedIssuerSchema).min(1).optional(),
|
|
120
|
-
trustedParents: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID().required()).min(1).optional(),
|
|
121
|
-
tag: _arcblock_validator.Joi.string().min(1).allow("").default(""),
|
|
122
|
-
ownerDid: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional().default([]),
|
|
123
|
-
consumed: _arcblock_validator.Joi.boolean().optional(),
|
|
124
|
-
acquireUrl: optionalUrlSchema,
|
|
125
|
-
filters: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.object({
|
|
126
|
-
address: _arcblock_validator.Joi.DID().optional(),
|
|
127
|
-
trustedIssuers: _arcblock_validator.Joi.array().items(trustedIssuerSchema).min(1).optional(),
|
|
128
|
-
trustedParents: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID().required()).min(1).optional(),
|
|
129
|
-
tag: _arcblock_validator.Joi.string().min(1).allow("").default(""),
|
|
130
|
-
ownerDid: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional().default([]),
|
|
131
|
-
consumed: _arcblock_validator.Joi.boolean().optional(),
|
|
132
|
-
acquireUrl: optionalUrlSchema
|
|
133
|
-
})).optional()
|
|
134
|
-
}).options(options),
|
|
135
|
-
assetOrVC: _arcblock_validator.Joi.object({
|
|
136
|
-
...createStandardFields("assetOrVC", "Please present NFT to continue."),
|
|
137
|
-
filters: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.object({
|
|
138
|
-
type: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.string().min(1).required()).min(1).optional(),
|
|
139
|
-
address: _arcblock_validator.Joi.DID().optional(),
|
|
140
|
-
trustedIssuers: _arcblock_validator.Joi.array().items(trustedIssuerSchema).min(1).optional(),
|
|
141
|
-
trustedParents: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID().required()).min(1).optional(),
|
|
142
|
-
tag: _arcblock_validator.Joi.string().min(1).allow("").default(""),
|
|
143
|
-
ownerDid: _arcblock_validator.Joi.array().items(_arcblock_validator.Joi.DID()).optional().default([]),
|
|
144
|
-
consumed: _arcblock_validator.Joi.boolean().optional(),
|
|
145
|
-
claimUrl: optionalUrlSchema,
|
|
146
|
-
acquireUrl: optionalUrlSchema
|
|
147
|
-
})).required().min(1),
|
|
148
|
-
optional: _arcblock_validator.Joi.boolean().default(false)
|
|
149
|
-
}).options(options),
|
|
150
|
-
keyPair,
|
|
151
|
-
encryptionKey
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
//#endregion
|
|
156
|
-
exports.default = claims_default;
|
package/lib/schema/claims.d.cts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ObjectSchema } from "joi";
|
|
2
|
-
|
|
3
|
-
//#region src/schema/claims.d.ts
|
|
4
|
-
interface ClaimsSchema {
|
|
5
|
-
authPrincipal: ObjectSchema;
|
|
6
|
-
profile: ObjectSchema;
|
|
7
|
-
signature: ObjectSchema;
|
|
8
|
-
prepareTx: ObjectSchema;
|
|
9
|
-
agreement: ObjectSchema;
|
|
10
|
-
verifiableCredential: ObjectSchema;
|
|
11
|
-
asset: ObjectSchema;
|
|
12
|
-
assetOrVC: ObjectSchema;
|
|
13
|
-
keyPair: ObjectSchema;
|
|
14
|
-
encryptionKey: ObjectSchema;
|
|
15
|
-
}
|
|
16
|
-
declare const _default: (chainInfo: ObjectSchema) => ClaimsSchema;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { ClaimsSchema, _default as default };
|
package/lib/schema/index.cjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_schema_claims = require('./claims.cjs');
|
|
3
|
-
let _arcblock_validator = require("@arcblock/validator");
|
|
4
|
-
|
|
5
|
-
//#region src/schema/index.ts
|
|
6
|
-
const chainInfo = _arcblock_validator.Joi.object({
|
|
7
|
-
type: _arcblock_validator.Joi.string().optional().valid("arcblock", "ethereum", "solona").default("arcblock"),
|
|
8
|
-
id: _arcblock_validator.Joi.any().when("type", {
|
|
9
|
-
is: "arcblock",
|
|
10
|
-
then: _arcblock_validator.Joi.string().optional().default("none")
|
|
11
|
-
}).when("type", {
|
|
12
|
-
is: "ethereum",
|
|
13
|
-
then: _arcblock_validator.Joi.string().required().pattern(/^[0-9]+$/, "numbers")
|
|
14
|
-
}).when("type", {
|
|
15
|
-
is: "solona",
|
|
16
|
-
then: _arcblock_validator.Joi.string().required().pattern(/^[0-9]+$/, "numbers")
|
|
17
|
-
}),
|
|
18
|
-
host: _arcblock_validator.Joi.string().when("type", {
|
|
19
|
-
is: "ethereum",
|
|
20
|
-
then: _arcblock_validator.Joi.string().optional().allow("")
|
|
21
|
-
}).when("type", {
|
|
22
|
-
is: "solona",
|
|
23
|
-
then: _arcblock_validator.Joi.string().optional().allow("")
|
|
24
|
-
}).when("type", {
|
|
25
|
-
is: "arcblock",
|
|
26
|
-
then: _arcblock_validator.Joi.string().uri({ scheme: ["http", "https"] }).allow("none").default("none")
|
|
27
|
-
})
|
|
28
|
-
}).options({
|
|
29
|
-
stripUnknown: true,
|
|
30
|
-
noDefaults: false
|
|
31
|
-
});
|
|
32
|
-
const appInfo = _arcblock_validator.Joi.object({
|
|
33
|
-
name: _arcblock_validator.Joi.string().required(),
|
|
34
|
-
description: _arcblock_validator.Joi.string().required(),
|
|
35
|
-
icon: _arcblock_validator.Joi.string().uri({ scheme: ["http", "https"] }).required(),
|
|
36
|
-
link: _arcblock_validator.Joi.string().uri({ scheme: ["http", "https"] }).optional(),
|
|
37
|
-
path: _arcblock_validator.Joi.string().uri({ scheme: ["http", "https"] }).default("https://abtwallet.io/i/"),
|
|
38
|
-
publisher: _arcblock_validator.Joi.DID().optional(),
|
|
39
|
-
updateSubEndpoint: _arcblock_validator.Joi.boolean().optional(),
|
|
40
|
-
subscriptionEndpoint: _arcblock_validator.Joi.string().optional(),
|
|
41
|
-
nodeDid: _arcblock_validator.Joi.DID().optional(),
|
|
42
|
-
agentDid: _arcblock_validator.Joi.DID().optional()
|
|
43
|
-
}).options({
|
|
44
|
-
stripUnknown: false,
|
|
45
|
-
noDefaults: false
|
|
46
|
-
});
|
|
47
|
-
const claims = require_schema_claims.default(chainInfo);
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
exports.appInfo = appInfo;
|
|
51
|
-
exports.chainInfo = chainInfo;
|
|
52
|
-
exports.claims = claims;
|
package/lib/schema/index.d.cts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ClaimsSchema } from "./claims.cjs";
|
|
2
|
-
import * as joi0 from "joi";
|
|
3
|
-
|
|
4
|
-
//#region src/schema/index.d.ts
|
|
5
|
-
declare const chainInfo: joi0.ObjectSchema<any>;
|
|
6
|
-
declare const appInfo: joi0.ObjectSchema<any>;
|
|
7
|
-
declare const claims: ClaimsSchema;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { appInfo, chainInfo, claims };
|
package/lib/storage/kv.cjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
3
|
-
let events = require("events");
|
|
4
|
-
|
|
5
|
-
//#region src/storage/kv.ts
|
|
6
|
-
var CloudflareKVStorage = class extends events.EventEmitter {
|
|
7
|
-
constructor(kv, options = {}) {
|
|
8
|
-
super();
|
|
9
|
-
this.kv = kv;
|
|
10
|
-
this.ttl = options.ttl ?? 300;
|
|
11
|
-
this.prefix = options.prefix ?? "";
|
|
12
|
-
}
|
|
13
|
-
key(token) {
|
|
14
|
-
return `${this.prefix}${token}`;
|
|
15
|
-
}
|
|
16
|
-
async create(token, status = "created") {
|
|
17
|
-
const record = {
|
|
18
|
-
token,
|
|
19
|
-
status
|
|
20
|
-
};
|
|
21
|
-
await this.kv.put(this.key(token), JSON.stringify(record), { expirationTtl: this.ttl });
|
|
22
|
-
this.emit("create", record);
|
|
23
|
-
return record;
|
|
24
|
-
}
|
|
25
|
-
async read(token) {
|
|
26
|
-
const raw = await this.kv.get(this.key(token));
|
|
27
|
-
if (!raw) return null;
|
|
28
|
-
return JSON.parse(raw);
|
|
29
|
-
}
|
|
30
|
-
async update(token, updates) {
|
|
31
|
-
const existing = await this.read(token);
|
|
32
|
-
if (!existing) return null;
|
|
33
|
-
delete updates.token;
|
|
34
|
-
const merged = {
|
|
35
|
-
...existing,
|
|
36
|
-
...updates
|
|
37
|
-
};
|
|
38
|
-
await this.kv.put(this.key(token), JSON.stringify(merged), { expirationTtl: this.ttl });
|
|
39
|
-
this.emit("update", merged);
|
|
40
|
-
return merged;
|
|
41
|
-
}
|
|
42
|
-
async delete(token) {
|
|
43
|
-
const existing = await this.read(token);
|
|
44
|
-
if (existing) this.emit("destroy", existing);
|
|
45
|
-
await this.kv.delete(this.key(token));
|
|
46
|
-
}
|
|
47
|
-
async exist(token, did) {
|
|
48
|
-
const record = await this.read(token);
|
|
49
|
-
if (!record) return false;
|
|
50
|
-
if (did) return record.did === did;
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var kv_default = CloudflareKVStorage;
|
|
55
|
-
|
|
56
|
-
//#endregion
|
|
57
|
-
exports.default = kv_default;
|
package/lib/storage/kv.d.cts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
|
|
3
|
-
//#region src/storage/kv.d.ts
|
|
4
|
-
interface KVNamespace {
|
|
5
|
-
get(key: string): Promise<string | null>;
|
|
6
|
-
put(key: string, value: string, options?: {
|
|
7
|
-
expirationTtl?: number;
|
|
8
|
-
}): Promise<void>;
|
|
9
|
-
delete(key: string): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
interface CloudflareKVStorageOptions {
|
|
12
|
-
/** TTL in seconds for KV entries. Default: 300 (5 minutes) */
|
|
13
|
-
ttl?: number;
|
|
14
|
-
/** Key prefix for KV entries. Default: '' */
|
|
15
|
-
prefix?: string;
|
|
16
|
-
}
|
|
17
|
-
declare class CloudflareKVStorage extends EventEmitter {
|
|
18
|
-
private kv;
|
|
19
|
-
private ttl;
|
|
20
|
-
private prefix;
|
|
21
|
-
constructor(kv: KVNamespace, options?: CloudflareKVStorageOptions);
|
|
22
|
-
private key;
|
|
23
|
-
create(token: string, status?: string): Promise<{
|
|
24
|
-
token: string;
|
|
25
|
-
status: string;
|
|
26
|
-
}>;
|
|
27
|
-
read(token: string): Promise<any>;
|
|
28
|
-
update(token: string, updates: Record<string, any>): Promise<any>;
|
|
29
|
-
delete(token: string): Promise<void>;
|
|
30
|
-
exist(token: string, did?: string): Promise<boolean>;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { CloudflareKVStorage as default };
|
package/lib/types.cjs
DELETED
|
File without changes
|
package/lib/types.d.cts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Framework-agnostic request interface for DID Connect handlers.
|
|
4
|
-
*
|
|
5
|
-
* Designed to match Express's `req` shape so that Express requests
|
|
6
|
-
* satisfy it natively (zero-wrapping). Hono adapter creates a wrapper
|
|
7
|
-
* that maps Hono Context to this interface.
|
|
8
|
-
*/
|
|
9
|
-
interface ConnectRequest {
|
|
10
|
-
/** Parsed request body (from body-parser or Hono) */
|
|
11
|
-
body: Record<string, any>;
|
|
12
|
-
/** Parsed query string parameters */
|
|
13
|
-
query: Record<string, any>;
|
|
14
|
-
/** URL path parameters (e.g. :action) */
|
|
15
|
-
params: Record<string, any>;
|
|
16
|
-
/** Raw request headers */
|
|
17
|
-
headers: Record<string, string | string[] | undefined>;
|
|
18
|
-
/** Parsed cookies (from cookie-parser or manual parsing) */
|
|
19
|
-
cookies: Record<string, string>;
|
|
20
|
-
/** Request protocol ('http' or 'https') */
|
|
21
|
-
protocol: string;
|
|
22
|
-
/** Full original URL including query string */
|
|
23
|
-
originalUrl: string;
|
|
24
|
-
/** Session context, populated by ensureContext middleware */
|
|
25
|
-
context?: any;
|
|
26
|
-
/** Flag to prevent double monkey-patching in ensureSignedJson */
|
|
27
|
-
ensureSignedJson?: boolean;
|
|
28
|
-
/** Case-insensitive header getter (matches Express req.get) */
|
|
29
|
-
get(name: string): string | undefined;
|
|
30
|
-
/** Content negotiation for locale (matches Express req.acceptsLanguages) */
|
|
31
|
-
acceptsLanguages(...languages: string[]): string | false;
|
|
32
|
-
/** Original framework-specific request object (Express req or Hono Context) */
|
|
33
|
-
raw?: any;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Framework-agnostic response interface for DID Connect handlers.
|
|
37
|
-
*
|
|
38
|
-
* Express: maps directly to res.jsonp/res.json/res.status().json().
|
|
39
|
-
* Hono: uses a buffer pattern — calls are captured, then the outer
|
|
40
|
-
* Hono handler reads the buffer to return c.json().
|
|
41
|
-
*/
|
|
42
|
-
interface ConnectResponse {
|
|
43
|
-
/** Send JSON response (Express JSONP, Hono json) */
|
|
44
|
-
jsonp(data: any): void;
|
|
45
|
-
/** Send JSON response */
|
|
46
|
-
json(data: any): void;
|
|
47
|
-
/** Set status code and return object with json() method */
|
|
48
|
-
status(code: number): {
|
|
49
|
-
json(data: any): void;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/** Middleware next() callback */
|
|
53
|
-
type NextFunction = () => void;
|
|
54
|
-
//#endregion
|
|
55
|
-
export { ConnectRequest, ConnectResponse, NextFunction };
|