@kumiai/mls 0.1.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/README.md +63 -0
- package/lib/authentication.d.ts +2 -0
- package/lib/authentication.js +67 -0
- package/lib/capability.d.ts +47 -0
- package/lib/capability.js +79 -0
- package/lib/codec.d.ts +5 -0
- package/lib/codec.js +10 -0
- package/lib/credential.d.ts +43 -0
- package/lib/credential.js +53 -0
- package/lib/crypto.d.ts +21 -0
- package/lib/crypto.js +387 -0
- package/lib/group.d.ts +233 -0
- package/lib/group.js +653 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +7 -0
- package/lib/types.d.ts +55 -0
- package/lib/types.js +1 -0
- package/package.json +45 -0
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DIDCache, DIDResolver } from '@kokuin/token';
|
|
2
|
+
import type { Capabilities, CryptoProvider, GroupContextExtension, IncomingMessageCallback, KeyPackage, PrivateKeyPackage } from 'ts-mls';
|
|
3
|
+
import type { GroupPermission } from './capability.js';
|
|
4
|
+
export type GroupOptions = {
|
|
5
|
+
/** Custom CryptoProvider for ts-mls. Defaults to nobleCryptoProvider. */
|
|
6
|
+
cryptoProvider?: CryptoProvider;
|
|
7
|
+
/** Ciphersuite name. Defaults to MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519. */
|
|
8
|
+
ciphersuiteName?: string;
|
|
9
|
+
/** Group extensions. */
|
|
10
|
+
extensions?: Array<GroupContextExtension>;
|
|
11
|
+
/**
|
|
12
|
+
* Raw ts-mls leaf-node capabilities. At createGroup, overrides the
|
|
13
|
+
* auto-derived capabilities; at createKeyPackageBundle, sets the invitee
|
|
14
|
+
* leaf's capabilities (default: defaultCapabilities()).
|
|
15
|
+
*/
|
|
16
|
+
capabilities?: Capabilities;
|
|
17
|
+
/**
|
|
18
|
+
* Default commit policy for the resulting GroupHandle. Invoked during
|
|
19
|
+
* processMessage/decrypt for each incoming commit; return 'reject' to refuse
|
|
20
|
+
* a commit (the handle stays at its pre-commit epoch and processMessage
|
|
21
|
+
* throws CommitRejectedError). Overridable per call.
|
|
22
|
+
*/
|
|
23
|
+
commitPolicy?: IncomingMessageCallback;
|
|
24
|
+
/** Optional DID cache for resolving did:peer:4 issuers in capability chains. Default: in-memory. */
|
|
25
|
+
cache?: DIDCache;
|
|
26
|
+
/** Optional resolver for did:peer:4 short forms not in cache. */
|
|
27
|
+
resolver?: DIDResolver;
|
|
28
|
+
};
|
|
29
|
+
export type GroupSyncScope = {
|
|
30
|
+
groupID: string;
|
|
31
|
+
models: Array<{
|
|
32
|
+
modelID: string;
|
|
33
|
+
filter?: Record<string, unknown>;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
export type Invite = {
|
|
37
|
+
/** Group ID the invite is for */
|
|
38
|
+
groupID: string;
|
|
39
|
+
/** Delegated membership capability token (stringified) for the invitee */
|
|
40
|
+
capabilityToken: string;
|
|
41
|
+
/** The full capability chain to validate the invite */
|
|
42
|
+
capabilityChain: Array<string>;
|
|
43
|
+
/** Permission level being granted */
|
|
44
|
+
permission: GroupPermission;
|
|
45
|
+
/** Inviter's DID */
|
|
46
|
+
inviterID: string;
|
|
47
|
+
};
|
|
48
|
+
export type KeyPackageBundle = {
|
|
49
|
+
/** MLS key package (binary) */
|
|
50
|
+
publicPackage: KeyPackage;
|
|
51
|
+
/** Private key material (keep secret) */
|
|
52
|
+
privatePackage: PrivateKeyPackage;
|
|
53
|
+
/** The DID of the key package owner */
|
|
54
|
+
ownerDID: string;
|
|
55
|
+
};
|
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kumiai/mls",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "E2EE group identity and membership for Enkaku using MLS",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mls",
|
|
8
|
+
"e2ee",
|
|
9
|
+
"group",
|
|
10
|
+
"encryption"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/TairuFramework/kumiai",
|
|
15
|
+
"directory": "packages/mls"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "lib/index.js",
|
|
19
|
+
"types": "lib/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./lib/index.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/*"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@kokuin/capability": "^0.1.0",
|
|
29
|
+
"@sozai/runtime": "^0.1.0",
|
|
30
|
+
"@kokuin/token": "^0.1.0",
|
|
31
|
+
"@noble/ciphers": "^2.1.1",
|
|
32
|
+
"@noble/curves": "^2.0.1",
|
|
33
|
+
"@noble/hashes": "^2.0.0",
|
|
34
|
+
"ts-mls": "2.0.0-rc.13"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build:clean": "del lib",
|
|
38
|
+
"build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
|
|
39
|
+
"build:types": "tsc --emitDeclarationOnly --skipLibCheck",
|
|
40
|
+
"build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
|
|
41
|
+
"test:types": "tsc --noEmit --skipLibCheck -p tsconfig.test.json",
|
|
42
|
+
"test:unit": "vitest run",
|
|
43
|
+
"test": "pnpm run test:types && pnpm run test:unit"
|
|
44
|
+
}
|
|
45
|
+
}
|