@phantom/sdk-types 0.1.1 → 0.1.3
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 +19 -23
- package/dist/index.d.ts +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,29 +20,24 @@ Interface for creating X-Phantom-Stamp header values for API authentication.
|
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
interface Stamper {
|
|
23
|
-
stamp(params: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}): Promise<string>;
|
|
29
|
-
stamp(params: {
|
|
30
|
-
data: Buffer;
|
|
31
|
-
type: 'OIDC';
|
|
32
|
-
idToken: string;
|
|
33
|
-
salt: string;
|
|
34
|
-
}): Promise<string>;
|
|
23
|
+
stamp(params: { data: Buffer }): Promise<string>;
|
|
24
|
+
type?: "PKI" | "OIDC"; // Optional, defaults to "PKI"
|
|
25
|
+
idToken?: string; // Required for OIDC type, optional for PKI
|
|
26
|
+
salt?: string; // Required for OIDC type, optional for PKI
|
|
27
|
+
algorithm?: Algorithm; // Optional, defaults to Algorithm.ed25519
|
|
35
28
|
}
|
|
36
29
|
```
|
|
37
30
|
|
|
38
31
|
**Usage:**
|
|
32
|
+
|
|
39
33
|
```typescript
|
|
40
|
-
import type { Stamper } from
|
|
34
|
+
import type { Stamper } from "@phantom/sdk-types";
|
|
41
35
|
|
|
42
36
|
class MyStamper implements Stamper {
|
|
43
|
-
|
|
37
|
+
type = "PKI"; // or "OIDC"
|
|
38
|
+
async stamp(params: { data: Buffer }): Promise<string> {
|
|
44
39
|
// Implementation for PKI stamping
|
|
45
|
-
return
|
|
40
|
+
return "stamp-value";
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
43
|
```
|
|
@@ -72,23 +67,24 @@ interface StamperWithKeyManagement extends Stamper {
|
|
|
72
67
|
```
|
|
73
68
|
|
|
74
69
|
**Usage:**
|
|
70
|
+
|
|
75
71
|
```typescript
|
|
76
|
-
import type { StamperWithKeyManagement } from
|
|
72
|
+
import type { StamperWithKeyManagement } from "@phantom/sdk-types";
|
|
77
73
|
|
|
78
74
|
class MyKeyManagedStamper implements StamperWithKeyManagement {
|
|
79
75
|
async init(): Promise<StamperKeyInfo> {
|
|
80
76
|
// Initialize and return key info
|
|
81
|
-
return { keyId:
|
|
77
|
+
return { keyId: "key-id", publicKey: "public-key" };
|
|
82
78
|
}
|
|
83
|
-
|
|
79
|
+
|
|
84
80
|
getKeyInfo(): StamperKeyInfo | null {
|
|
85
81
|
// Return current key info or null if not initialized
|
|
86
|
-
return { keyId:
|
|
82
|
+
return { keyId: "key-id", publicKey: "public-key" };
|
|
87
83
|
}
|
|
88
|
-
|
|
89
|
-
async stamp(params: { data: Buffer
|
|
84
|
+
|
|
85
|
+
async stamp(params: { data: Buffer }): Promise<string> {
|
|
90
86
|
// Implementation
|
|
91
|
-
return
|
|
87
|
+
return "stamp-value";
|
|
92
88
|
}
|
|
93
89
|
}
|
|
94
90
|
```
|
|
@@ -105,4 +101,4 @@ This package is used by:
|
|
|
105
101
|
|
|
106
102
|
## License
|
|
107
103
|
|
|
108
|
-
MIT
|
|
104
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -5,17 +5,20 @@ export { Algorithm } from '@phantom/openapi-wallet-service';
|
|
|
5
5
|
interface Stamper {
|
|
6
6
|
stamp(params: {
|
|
7
7
|
data: Buffer;
|
|
8
|
-
type?:
|
|
8
|
+
type?: "PKI";
|
|
9
9
|
idToken?: never;
|
|
10
10
|
salt?: never;
|
|
11
11
|
}): Promise<string>;
|
|
12
12
|
stamp(params: {
|
|
13
13
|
data: Buffer;
|
|
14
|
-
type:
|
|
14
|
+
type: "OIDC";
|
|
15
15
|
idToken: string;
|
|
16
16
|
salt: string;
|
|
17
17
|
}): Promise<string>;
|
|
18
18
|
algorithm: Algorithm;
|
|
19
|
+
type: "PKI" | "OIDC";
|
|
20
|
+
idToken?: string;
|
|
21
|
+
salt?: string;
|
|
19
22
|
}
|
|
20
23
|
interface StamperKeyInfo {
|
|
21
24
|
keyId: string;
|