@did-plc/lib 0.0.1
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 +2 -0
- package/build.js +26 -0
- package/dist/client.d.ts +39 -0
- package/dist/data.d.ts +11 -0
- package/dist/document.d.ts +2 -0
- package/dist/error.d.ts +34 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +27867 -0
- package/dist/index.js.map +7 -0
- package/dist/operations.d.ts +58 -0
- package/dist/types.d.ts +1481 -0
- package/jest.config.js +6 -0
- package/package.json +33 -0
- package/src/client.ts +168 -0
- package/src/data.ts +132 -0
- package/src/document.ts +84 -0
- package/src/error.ts +58 -0
- package/src/index.ts +6 -0
- package/src/operations.ts +315 -0
- package/src/types.ts +116 -0
- package/tests/compatibility.test.ts +89 -0
- package/tests/data.test.ts +214 -0
- package/tests/document.test.ts +81 -0
- package/tests/recovery.test.ts +188 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +10 -0
- package/update-pkg.js +14 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CID } from 'multiformats/cid';
|
|
2
|
+
import { Keypair } from '@atproto/crypto';
|
|
3
|
+
import * as t from './types';
|
|
4
|
+
export declare const didForCreateOp: (op: t.CompatibleOp, truncate?: number) => Promise<string>;
|
|
5
|
+
export declare const formatAtprotoOp: (opts: {
|
|
6
|
+
signingKey: string;
|
|
7
|
+
handle: string;
|
|
8
|
+
pds: string;
|
|
9
|
+
rotationKeys: string[];
|
|
10
|
+
prev: CID | null;
|
|
11
|
+
}) => t.UnsignedOperation;
|
|
12
|
+
export declare const atprotoOp: (opts: {
|
|
13
|
+
signingKey: string;
|
|
14
|
+
handle: string;
|
|
15
|
+
pds: string;
|
|
16
|
+
rotationKeys: string[];
|
|
17
|
+
prev: CID | null;
|
|
18
|
+
signer: Keypair;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
type: "plc_operation";
|
|
21
|
+
alsoKnownAs: string[];
|
|
22
|
+
rotationKeys: string[];
|
|
23
|
+
verificationMethods: Record<string, string>;
|
|
24
|
+
services: Record<string, {
|
|
25
|
+
type: string;
|
|
26
|
+
endpoint: string;
|
|
27
|
+
}>;
|
|
28
|
+
prev: string | null;
|
|
29
|
+
} & {
|
|
30
|
+
sig: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const createOp: (opts: {
|
|
33
|
+
signingKey: string;
|
|
34
|
+
handle: string;
|
|
35
|
+
pds: string;
|
|
36
|
+
rotationKeys: string[];
|
|
37
|
+
signer: Keypair;
|
|
38
|
+
}) => Promise<{
|
|
39
|
+
op: t.Operation;
|
|
40
|
+
did: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const createUpdateOp: (lastOp: t.CompatibleOp, signer: Keypair, fn: (normalized: t.UnsignedOperation) => Omit<t.UnsignedOperation, 'prev'>) => Promise<t.Operation>;
|
|
43
|
+
export declare const updateAtprotoKeyOp: (lastOp: t.CompatibleOp, signer: Keypair, atprotoKey: string) => Promise<t.Operation>;
|
|
44
|
+
export declare const updateHandleOp: (lastOp: t.CompatibleOp, signer: Keypair, handle: string) => Promise<t.Operation>;
|
|
45
|
+
export declare const updatePdsOp: (lastOp: t.CompatibleOp, signer: Keypair, endpoint: string) => Promise<t.Operation>;
|
|
46
|
+
export declare const updateRotationKeysOp: (lastOp: t.CompatibleOp, signer: Keypair, rotationKeys: string[]) => Promise<t.Operation>;
|
|
47
|
+
export declare const tombstoneOp: (prev: CID, key: Keypair) => Promise<t.Tombstone>;
|
|
48
|
+
export declare const addSignature: <T extends Record<string, unknown>>(object: T, key: Keypair) => Promise<T & {
|
|
49
|
+
sig: string;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const signOperation: (op: t.UnsignedOperation, signingKey: Keypair) => Promise<t.Operation>;
|
|
52
|
+
export declare const deprecatedSignCreate: (op: t.UnsignedCreateOpV1, signingKey: Keypair) => Promise<t.CreateOpV1>;
|
|
53
|
+
export declare const normalizeOp: (op: t.CompatibleOp) => t.Operation;
|
|
54
|
+
export declare const assureValidOp: (op: t.OpOrTombstone) => Promise<true | undefined>;
|
|
55
|
+
export declare const assureValidCreationOp: (did: string, op: t.CompatibleOpOrTombstone) => Promise<t.DocumentData>;
|
|
56
|
+
export declare const assureValidSig: (allowedDids: string[], op: t.CompatibleOpOrTombstone) => Promise<string>;
|
|
57
|
+
export declare const ensureHttpPrefix: (str: string) => string;
|
|
58
|
+
export declare const ensureAtprotoPrefix: (str: string) => string;
|