@phantom/sdk-types 0.1.1 → 0.1.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/README.md +15 -23
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,29 +20,20 @@ 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
|
-
type?: 'PKI';
|
|
26
|
-
idToken?: never;
|
|
27
|
-
salt?: never;
|
|
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; type?: "PKI"; idToken?: never; salt?: never }): Promise<string>;
|
|
24
|
+
stamp(params: { data: Buffer; type: "OIDC"; idToken: string; salt: string }): Promise<string>;
|
|
35
25
|
}
|
|
36
26
|
```
|
|
37
27
|
|
|
38
28
|
**Usage:**
|
|
29
|
+
|
|
39
30
|
```typescript
|
|
40
|
-
import type { Stamper } from
|
|
31
|
+
import type { Stamper } from "@phantom/sdk-types";
|
|
41
32
|
|
|
42
33
|
class MyStamper implements Stamper {
|
|
43
|
-
async stamp(params: { data: Buffer; type?:
|
|
34
|
+
async stamp(params: { data: Buffer; type?: "PKI" }): Promise<string> {
|
|
44
35
|
// Implementation for PKI stamping
|
|
45
|
-
return
|
|
36
|
+
return "stamp-value";
|
|
46
37
|
}
|
|
47
38
|
}
|
|
48
39
|
```
|
|
@@ -72,23 +63,24 @@ interface StamperWithKeyManagement extends Stamper {
|
|
|
72
63
|
```
|
|
73
64
|
|
|
74
65
|
**Usage:**
|
|
66
|
+
|
|
75
67
|
```typescript
|
|
76
|
-
import type { StamperWithKeyManagement } from
|
|
68
|
+
import type { StamperWithKeyManagement } from "@phantom/sdk-types";
|
|
77
69
|
|
|
78
70
|
class MyKeyManagedStamper implements StamperWithKeyManagement {
|
|
79
71
|
async init(): Promise<StamperKeyInfo> {
|
|
80
72
|
// Initialize and return key info
|
|
81
|
-
return { keyId:
|
|
73
|
+
return { keyId: "key-id", publicKey: "public-key" };
|
|
82
74
|
}
|
|
83
|
-
|
|
75
|
+
|
|
84
76
|
getKeyInfo(): StamperKeyInfo | null {
|
|
85
77
|
// Return current key info or null if not initialized
|
|
86
|
-
return { keyId:
|
|
78
|
+
return { keyId: "key-id", publicKey: "public-key" };
|
|
87
79
|
}
|
|
88
|
-
|
|
89
|
-
async stamp(params: { data: Buffer; type?:
|
|
80
|
+
|
|
81
|
+
async stamp(params: { data: Buffer; type?: "PKI" }): Promise<string> {
|
|
90
82
|
// Implementation
|
|
91
|
-
return
|
|
83
|
+
return "stamp-value";
|
|
92
84
|
}
|
|
93
85
|
}
|
|
94
86
|
```
|
|
@@ -105,4 +97,4 @@ This package is used by:
|
|
|
105
97
|
|
|
106
98
|
## License
|
|
107
99
|
|
|
108
|
-
MIT
|
|
100
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ 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>;
|