@enbox/protocols 0.1.0 → 0.2.0
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/esm/connect.js +36 -0
- package/dist/esm/connect.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/profile.js +12 -2
- package/dist/esm/profile.js.map +1 -1
- package/dist/types/connect.d.ts +56 -0
- package/dist/types/connect.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/profile.d.ts +31 -2
- package/dist/types/profile.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/connect.ts +64 -0
- package/src/index.ts +1 -0
- package/src/profile.ts +17 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connect Protocol — wallet and app discovery information.
|
|
3
|
+
*
|
|
4
|
+
* Stores metadata about which wallet applications and services a DID
|
|
5
|
+
* is associated with. Published so that other apps can discover how
|
|
6
|
+
* to connect to this identity.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { defineProtocol } from '@enbox/api';
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Protocol definition
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
export const ConnectDefinition = {
|
|
15
|
+
protocol: 'https://enbox.org/protocols/connect',
|
|
16
|
+
published: true,
|
|
17
|
+
types: {
|
|
18
|
+
wallet: {
|
|
19
|
+
schema: 'https://enbox.org/schemas/connect/wallet',
|
|
20
|
+
dataFormats: ['application/json'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
structure: {
|
|
24
|
+
wallet: {
|
|
25
|
+
$actions: [
|
|
26
|
+
{ who: 'anyone', can: ['read'] },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Typed protocol export
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
/** Typed Connect protocol for use with `dwn.using()`. */
|
|
35
|
+
export const ConnectProtocol = defineProtocol(ConnectDefinition, {});
|
|
36
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAqB5C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAI,qCAAqC;IACjD,SAAS,EAAG,IAAI;IAChB,KAAK,EAAO;QACV,MAAM,EAAE;YACN,MAAM,EAAQ,0CAA0C;YACxD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;KACF;IACD,SAAS,EAAE;QACT,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;aACjC;SACF;KACF;CACoC,CAAC;AAExC,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAC3C,iBAAiB,EACjB,EAAsB,CACvB,CAAC"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
package/dist/esm/profile.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Profile Protocol — public and semi-private identity information.
|
|
3
3
|
*
|
|
4
|
-
* Supports a published profile record, avatar (binary),
|
|
5
|
-
* private notes visible only to friends (via Social Graph
|
|
4
|
+
* Supports a published profile record, avatar and hero images (binary),
|
|
5
|
+
* links, and private notes visible only to friends (via Social Graph
|
|
6
|
+
* composition).
|
|
6
7
|
*
|
|
7
8
|
* @module
|
|
8
9
|
*/
|
|
@@ -24,6 +25,9 @@ export const ProfileDefinition = {
|
|
|
24
25
|
avatar: {
|
|
25
26
|
dataFormats: ['image/png', 'image/jpeg', 'image/gif', 'image/webp'],
|
|
26
27
|
},
|
|
28
|
+
hero: {
|
|
29
|
+
dataFormats: ['image/png', 'image/jpeg', 'image/gif', 'image/webp'],
|
|
30
|
+
},
|
|
27
31
|
link: {
|
|
28
32
|
schema: 'https://enbox.org/schemas/profile/link',
|
|
29
33
|
dataFormats: ['application/json'],
|
|
@@ -45,6 +49,12 @@ export const ProfileDefinition = {
|
|
|
45
49
|
{ who: 'anyone', can: ['read'] },
|
|
46
50
|
],
|
|
47
51
|
},
|
|
52
|
+
hero: {
|
|
53
|
+
$size: { max: 2097152 },
|
|
54
|
+
$actions: [
|
|
55
|
+
{ who: 'anyone', can: ['read'] },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
48
58
|
link: {
|
|
49
59
|
$actions: [
|
|
50
60
|
{ who: 'anyone', can: ['read'] },
|
package/dist/esm/profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/profile.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAgD5C,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,EAAI,qCAAqC;IACjD,SAAS,EAAG,IAAI;IAChB,IAAI,EAAQ;QACV,MAAM,EAAE,0CAA0C;KACnD;IACD,KAAK,EAAE;QACL,OAAO,EAAE;YACP,MAAM,EAAQ,2CAA2C;YACzD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,MAAM,EAAE;YACN,WAAW,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;SACpE;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;SACpE;QACD,IAAI,EAAE;YACJ,MAAM,EAAQ,wCAAwC;YACtD,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;QACD,WAAW,EAAE;YACX,MAAM,EAAQ,gDAAgD;YAC9D,WAAW,EAAG,CAAC,kBAAkB,CAAC;SACnC;KACF;IACD,SAAS,EAAE;QACT,OAAO,EAAE;YACP,KAAK,EAAM,EAAE,GAAG,EAAE,KAAK,EAAE;YACzB,QAAQ,EAAG;gBACT,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;aACjC;YACD,MAAM,EAAE;gBACN,KAAK,EAAM,EAAE,GAAG,EAAE,OAAO,EAAE;gBAC3B,QAAQ,EAAG;oBACT,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;iBACjC;aACF;YACD,IAAI,EAAE;gBACJ,KAAK,EAAM,EAAE,GAAG,EAAE,OAAO,EAAE;gBAC3B,QAAQ,EAAG;oBACT,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;iBACjC;aACF;YACD,IAAI,EAAE;gBACJ,QAAQ,EAAE;oBACR,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;iBACjC;aACF;SACF;QACD,WAAW,EAAE;YACX,QAAQ,EAAE;gBACR,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE;aACzC;SACF;KACF;CACoC,CAAC;AAExC,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAC3C,iBAAiB,EACjB,EAAsB,CACvB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connect Protocol — wallet and app discovery information.
|
|
3
|
+
*
|
|
4
|
+
* Stores metadata about which wallet applications and services a DID
|
|
5
|
+
* is associated with. Published so that other apps can discover how
|
|
6
|
+
* to connect to this identity.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/** Data shape for wallet connection info. */
|
|
11
|
+
export type WalletData = {
|
|
12
|
+
/** URLs of web wallet applications associated with this DID. */
|
|
13
|
+
webWallets: string[];
|
|
14
|
+
};
|
|
15
|
+
/** Maps protocol type names to their TypeScript data shapes. */
|
|
16
|
+
export type ConnectSchemaMap = {
|
|
17
|
+
wallet: WalletData;
|
|
18
|
+
};
|
|
19
|
+
export declare const ConnectDefinition: {
|
|
20
|
+
readonly protocol: "https://enbox.org/protocols/connect";
|
|
21
|
+
readonly published: true;
|
|
22
|
+
readonly types: {
|
|
23
|
+
readonly wallet: {
|
|
24
|
+
readonly schema: "https://enbox.org/schemas/connect/wallet";
|
|
25
|
+
readonly dataFormats: ["application/json"];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly structure: {
|
|
29
|
+
readonly wallet: {
|
|
30
|
+
readonly $actions: [{
|
|
31
|
+
readonly who: "anyone";
|
|
32
|
+
readonly can: ["read"];
|
|
33
|
+
}];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/** Typed Connect protocol for use with `dwn.using()`. */
|
|
38
|
+
export declare const ConnectProtocol: import("@enbox/api").TypedProtocol<{
|
|
39
|
+
readonly protocol: "https://enbox.org/protocols/connect";
|
|
40
|
+
readonly published: true;
|
|
41
|
+
readonly types: {
|
|
42
|
+
readonly wallet: {
|
|
43
|
+
readonly schema: "https://enbox.org/schemas/connect/wallet";
|
|
44
|
+
readonly dataFormats: ["application/json"];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
readonly structure: {
|
|
48
|
+
readonly wallet: {
|
|
49
|
+
readonly $actions: [{
|
|
50
|
+
readonly who: "anyone";
|
|
51
|
+
readonly can: ["read"];
|
|
52
|
+
}];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}, ConnectSchemaMap>;
|
|
56
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,6CAA6C;AAC7C,MAAM,MAAM,UAAU,GAAG;IACvB,gEAAgE;IAChE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAMF,gEAAgE;AAChE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAMF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAgBS,CAAC;AAMxC,yDAAyD;AACzD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;oBAG3B,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
package/dist/types/profile.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Profile Protocol — public and semi-private identity information.
|
|
3
3
|
*
|
|
4
|
-
* Supports a published profile record, avatar (binary),
|
|
5
|
-
* private notes visible only to friends (via Social Graph
|
|
4
|
+
* Supports a published profile record, avatar and hero images (binary),
|
|
5
|
+
* links, and private notes visible only to friends (via Social Graph
|
|
6
|
+
* composition).
|
|
6
7
|
*
|
|
7
8
|
* @module
|
|
8
9
|
*/
|
|
@@ -10,12 +11,15 @@
|
|
|
10
11
|
export type ProfileData = {
|
|
11
12
|
displayName: string;
|
|
12
13
|
bio?: string;
|
|
14
|
+
tagline?: string;
|
|
13
15
|
location?: string;
|
|
14
16
|
website?: string;
|
|
15
17
|
pronouns?: string;
|
|
16
18
|
};
|
|
17
19
|
/** Avatar is stored as binary data (Blob). */
|
|
18
20
|
export type AvatarData = Blob;
|
|
21
|
+
/** Hero banner is stored as binary data (Blob). */
|
|
22
|
+
export type HeroData = Blob;
|
|
19
23
|
/** Data shape for a link record (e.g. social links). */
|
|
20
24
|
export type LinkData = {
|
|
21
25
|
url: string;
|
|
@@ -31,6 +35,7 @@ export type PrivateNoteData = {
|
|
|
31
35
|
export type ProfileSchemaMap = {
|
|
32
36
|
profile: ProfileData;
|
|
33
37
|
avatar: AvatarData;
|
|
38
|
+
hero: HeroData;
|
|
34
39
|
link: LinkData;
|
|
35
40
|
privateNote: PrivateNoteData;
|
|
36
41
|
};
|
|
@@ -48,6 +53,9 @@ export declare const ProfileDefinition: {
|
|
|
48
53
|
readonly avatar: {
|
|
49
54
|
readonly dataFormats: ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
50
55
|
};
|
|
56
|
+
readonly hero: {
|
|
57
|
+
readonly dataFormats: ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
58
|
+
};
|
|
51
59
|
readonly link: {
|
|
52
60
|
readonly schema: "https://enbox.org/schemas/profile/link";
|
|
53
61
|
readonly dataFormats: ["application/json"];
|
|
@@ -75,6 +83,15 @@ export declare const ProfileDefinition: {
|
|
|
75
83
|
readonly can: ["read"];
|
|
76
84
|
}];
|
|
77
85
|
};
|
|
86
|
+
readonly hero: {
|
|
87
|
+
readonly $size: {
|
|
88
|
+
readonly max: 2097152;
|
|
89
|
+
};
|
|
90
|
+
readonly $actions: [{
|
|
91
|
+
readonly who: "anyone";
|
|
92
|
+
readonly can: ["read"];
|
|
93
|
+
}];
|
|
94
|
+
};
|
|
78
95
|
readonly link: {
|
|
79
96
|
readonly $actions: [{
|
|
80
97
|
readonly who: "anyone";
|
|
@@ -105,6 +122,9 @@ export declare const ProfileProtocol: import("@enbox/api").TypedProtocol<{
|
|
|
105
122
|
readonly avatar: {
|
|
106
123
|
readonly dataFormats: ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
107
124
|
};
|
|
125
|
+
readonly hero: {
|
|
126
|
+
readonly dataFormats: ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
127
|
+
};
|
|
108
128
|
readonly link: {
|
|
109
129
|
readonly schema: "https://enbox.org/schemas/profile/link";
|
|
110
130
|
readonly dataFormats: ["application/json"];
|
|
@@ -132,6 +152,15 @@ export declare const ProfileProtocol: import("@enbox/api").TypedProtocol<{
|
|
|
132
152
|
readonly can: ["read"];
|
|
133
153
|
}];
|
|
134
154
|
};
|
|
155
|
+
readonly hero: {
|
|
156
|
+
readonly $size: {
|
|
157
|
+
readonly max: 2097152;
|
|
158
|
+
};
|
|
159
|
+
readonly $actions: [{
|
|
160
|
+
readonly who: "anyone";
|
|
161
|
+
readonly can: ["read"];
|
|
162
|
+
}];
|
|
163
|
+
};
|
|
135
164
|
readonly link: {
|
|
136
165
|
readonly $actions: [{
|
|
137
166
|
readonly who: "anyone";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/profile.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,8CAA8C;AAC9C,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC;AAE9B,mDAAmD;AACnD,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC;AAE5B,wDAAwD;AACxD,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAMF,gEAAgE;AAChE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAMF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDS,CAAC;AAMxC,yDAAyD;AACzD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAG3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enbox/protocols",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Standard reusable DWN protocol definitions for the Enbox ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"bun": ">=1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@enbox/api": "0.1.
|
|
50
|
-
"@enbox/dwn-sdk-js": "0.0.
|
|
49
|
+
"@enbox/api": "0.1.1",
|
|
50
|
+
"@enbox/dwn-sdk-js": "0.0.6"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@typescript-eslint/eslint-plugin": "8.32.1",
|
package/src/connect.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connect Protocol — wallet and app discovery information.
|
|
3
|
+
*
|
|
4
|
+
* Stores metadata about which wallet applications and services a DID
|
|
5
|
+
* is associated with. Published so that other apps can discover how
|
|
6
|
+
* to connect to this identity.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
|
|
12
|
+
|
|
13
|
+
import { defineProtocol } from '@enbox/api';
|
|
14
|
+
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Data types
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
/** Data shape for wallet connection info. */
|
|
20
|
+
export type WalletData = {
|
|
21
|
+
/** URLs of web wallet applications associated with this DID. */
|
|
22
|
+
webWallets: string[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Schema map
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
/** Maps protocol type names to their TypeScript data shapes. */
|
|
30
|
+
export type ConnectSchemaMap = {
|
|
31
|
+
wallet: WalletData;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
// Protocol definition
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
export const ConnectDefinition = {
|
|
39
|
+
protocol : 'https://enbox.org/protocols/connect',
|
|
40
|
+
published : true,
|
|
41
|
+
types : {
|
|
42
|
+
wallet: {
|
|
43
|
+
schema : 'https://enbox.org/schemas/connect/wallet',
|
|
44
|
+
dataFormats : ['application/json'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
structure: {
|
|
48
|
+
wallet: {
|
|
49
|
+
$actions: [
|
|
50
|
+
{ who: 'anyone', can: ['read'] },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
} as const satisfies ProtocolDefinition;
|
|
55
|
+
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Typed protocol export
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
/** Typed Connect protocol for use with `dwn.using()`. */
|
|
61
|
+
export const ConnectProtocol = defineProtocol(
|
|
62
|
+
ConnectDefinition,
|
|
63
|
+
{} as ConnectSchemaMap,
|
|
64
|
+
);
|
package/src/index.ts
CHANGED
package/src/profile.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Profile Protocol — public and semi-private identity information.
|
|
3
3
|
*
|
|
4
|
-
* Supports a published profile record, avatar (binary),
|
|
5
|
-
* private notes visible only to friends (via Social Graph
|
|
4
|
+
* Supports a published profile record, avatar and hero images (binary),
|
|
5
|
+
* links, and private notes visible only to friends (via Social Graph
|
|
6
|
+
* composition).
|
|
6
7
|
*
|
|
7
8
|
* @module
|
|
8
9
|
*/
|
|
@@ -19,6 +20,7 @@ import { defineProtocol } from '@enbox/api';
|
|
|
19
20
|
export type ProfileData = {
|
|
20
21
|
displayName: string;
|
|
21
22
|
bio?: string;
|
|
23
|
+
tagline?: string;
|
|
22
24
|
location?: string;
|
|
23
25
|
website?: string;
|
|
24
26
|
pronouns?: string;
|
|
@@ -27,6 +29,9 @@ export type ProfileData = {
|
|
|
27
29
|
/** Avatar is stored as binary data (Blob). */
|
|
28
30
|
export type AvatarData = Blob;
|
|
29
31
|
|
|
32
|
+
/** Hero banner is stored as binary data (Blob). */
|
|
33
|
+
export type HeroData = Blob;
|
|
34
|
+
|
|
30
35
|
/** Data shape for a link record (e.g. social links). */
|
|
31
36
|
export type LinkData = {
|
|
32
37
|
url: string;
|
|
@@ -48,6 +53,7 @@ export type PrivateNoteData = {
|
|
|
48
53
|
export type ProfileSchemaMap = {
|
|
49
54
|
profile: ProfileData;
|
|
50
55
|
avatar: AvatarData;
|
|
56
|
+
hero: HeroData;
|
|
51
57
|
link: LinkData;
|
|
52
58
|
privateNote: PrivateNoteData;
|
|
53
59
|
};
|
|
@@ -70,6 +76,9 @@ export const ProfileDefinition = {
|
|
|
70
76
|
avatar: {
|
|
71
77
|
dataFormats: ['image/png', 'image/jpeg', 'image/gif', 'image/webp'],
|
|
72
78
|
},
|
|
79
|
+
hero: {
|
|
80
|
+
dataFormats: ['image/png', 'image/jpeg', 'image/gif', 'image/webp'],
|
|
81
|
+
},
|
|
73
82
|
link: {
|
|
74
83
|
schema : 'https://enbox.org/schemas/profile/link',
|
|
75
84
|
dataFormats : ['application/json'],
|
|
@@ -91,6 +100,12 @@ export const ProfileDefinition = {
|
|
|
91
100
|
{ who: 'anyone', can: ['read'] },
|
|
92
101
|
],
|
|
93
102
|
},
|
|
103
|
+
hero: {
|
|
104
|
+
$size : { max: 2097152 },
|
|
105
|
+
$actions : [
|
|
106
|
+
{ who: 'anyone', can: ['read'] },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
94
109
|
link: {
|
|
95
110
|
$actions: [
|
|
96
111
|
{ who: 'anyone', can: ['read'] },
|