@auths-dev/sdk 0.0.1 → 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/Cargo.toml +45 -0
- package/README.md +163 -4
- package/__test__/client.spec.ts +78 -0
- package/__test__/exports.spec.ts +57 -0
- package/__test__/integration.spec.ts +407 -0
- package/__test__/policy.spec.ts +202 -0
- package/__test__/verify.spec.ts +88 -0
- package/build.rs +5 -0
- package/index.d.ts +259 -0
- package/index.js +622 -1
- package/lib/artifacts.ts +124 -0
- package/lib/attestations.ts +126 -0
- package/lib/audit.ts +189 -0
- package/lib/client.ts +293 -0
- package/lib/commits.ts +70 -0
- package/lib/devices.ts +178 -0
- package/lib/errors.ts +306 -0
- package/lib/identity.ts +280 -0
- package/lib/index.ts +125 -0
- package/lib/native.ts +255 -0
- package/lib/org.ts +235 -0
- package/lib/pairing.ts +271 -0
- package/lib/policy.ts +669 -0
- package/lib/signing.ts +204 -0
- package/lib/trust.ts +152 -0
- package/lib/types.ts +179 -0
- package/lib/verify.ts +241 -0
- package/lib/witness.ts +91 -0
- package/npm/darwin-arm64/README.md +3 -0
- package/npm/darwin-arm64/package.json +23 -0
- package/npm/linux-arm64-gnu/README.md +3 -0
- package/npm/linux-arm64-gnu/package.json +26 -0
- package/npm/linux-x64-gnu/README.md +3 -0
- package/npm/linux-x64-gnu/package.json +26 -0
- package/npm/win32-arm64-msvc/README.md +3 -0
- package/npm/win32-arm64-msvc/package.json +23 -0
- package/npm/win32-x64-msvc/README.md +3 -0
- package/npm/win32-x64-msvc/package.json +23 -0
- package/package.json +51 -16
- package/src/artifact.rs +217 -0
- package/src/attestation_query.rs +104 -0
- package/src/audit.rs +128 -0
- package/src/commit_sign.rs +63 -0
- package/src/device.rs +212 -0
- package/src/diagnostics.rs +106 -0
- package/src/error.rs +5 -0
- package/src/helpers.rs +60 -0
- package/src/identity.rs +467 -0
- package/src/lib.rs +26 -0
- package/src/org.rs +430 -0
- package/src/pairing.rs +454 -0
- package/src/policy.rs +147 -0
- package/src/sign.rs +215 -0
- package/src/trust.rs +189 -0
- package/src/types.rs +205 -0
- package/src/verify.rs +447 -0
- package/src/witness.rs +138 -0
- package/tsconfig.json +19 -0
- package/typedoc.json +18 -0
- package/vitest.config.ts +12 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export declare class NapiPairingHandle {
|
|
4
|
+
static createSession(repoPath: string, capabilitiesJson?: string | undefined | null, timeoutSecs?: number | undefined | null, bindAddress?: string | undefined | null, enableMdns?: boolean | undefined | null, passphrase?: string | undefined | null): Promise<NapiPairingHandle>
|
|
5
|
+
get session(): NapiPairingSession
|
|
6
|
+
waitForResponse(timeoutSecs?: number | undefined | null): Promise<NapiPairingResponse>
|
|
7
|
+
complete(deviceDid: string, devicePublicKeyHex: string, repoPath: string, capabilitiesJson?: string | undefined | null, passphrase?: string | undefined | null): Promise<NapiPairingResult>
|
|
8
|
+
stop(): Promise<void>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare function addOrgMember(orgDid: string, memberDid: string, role: string, repoPath: string, capabilitiesJson?: string | undefined | null, passphrase?: string | undefined | null, note?: string | undefined | null, memberPublicKeyHex?: string | undefined | null): NapiOrgMember
|
|
12
|
+
|
|
13
|
+
export declare function addWitness(urlStr: string, repoPath: string, label?: string | undefined | null): NapiWitnessResult
|
|
14
|
+
|
|
15
|
+
export declare function compilePolicy(policyJson: string): string
|
|
16
|
+
|
|
17
|
+
export declare function createAgentIdentity(agentName: string, capabilities: Array<string>, repoPath: string, passphrase?: string | undefined | null): NapiAgentIdentityBundle
|
|
18
|
+
|
|
19
|
+
export declare function createIdentity(keyAlias: string, repoPath: string, passphrase?: string | undefined | null): NapiIdentityResult
|
|
20
|
+
|
|
21
|
+
export declare function createOrg(label: string, repoPath: string, passphrase?: string | undefined | null): NapiOrgResult
|
|
22
|
+
|
|
23
|
+
export declare function delegateAgent(agentName: string, capabilities: Array<string>, parentRepoPath: string, passphrase?: string | undefined | null, expiresIn?: number | undefined | null, identityDid?: string | undefined | null): NapiDelegatedAgentBundle
|
|
24
|
+
|
|
25
|
+
export declare function evaluatePolicy(policyJson: string, issuer: string, subject: string, capabilities?: Array<string> | undefined | null, role?: string | undefined | null, revoked?: boolean | undefined | null, expiresAt?: string | undefined | null, repo?: string | undefined | null, environment?: string | undefined | null, signerType?: string | undefined | null, delegatedBy?: string | undefined | null, chainDepth?: number | undefined | null): NapiPolicyDecision
|
|
26
|
+
|
|
27
|
+
export declare function extendDeviceAuthorization(deviceDid: string, identityKeyAlias: string, expiresIn: number, repoPath: string, passphrase?: string | undefined | null): NapiExtensionResult
|
|
28
|
+
|
|
29
|
+
export declare function generateAuditReport(targetRepoPath: string, authsRepoPath: string, since?: string | undefined | null, until?: string | undefined | null, author?: string | undefined | null, limit?: number | undefined | null): string
|
|
30
|
+
|
|
31
|
+
export declare function getIdentityPublicKey(identityDid: string, repoPath: string, passphrase?: string | undefined | null): string
|
|
32
|
+
|
|
33
|
+
export declare function getLatestAttestation(repoPath: string, deviceDid: string): NapiAttestation | null
|
|
34
|
+
|
|
35
|
+
export declare function getPinnedIdentity(did: string, repoPath: string): NapiPinnedIdentity | null
|
|
36
|
+
|
|
37
|
+
export declare function joinPairingSession(shortCode: string, endpoint: string, token: string, repoPath: string, deviceName?: string | undefined | null, passphrase?: string | undefined | null): Promise<NapiPairingResponse>
|
|
38
|
+
|
|
39
|
+
export declare function linkDeviceToIdentity(identityKeyAlias: string, capabilities: Array<string>, repoPath: string, passphrase?: string | undefined | null, expiresIn?: number | undefined | null): NapiLinkResult
|
|
40
|
+
|
|
41
|
+
export declare function listAttestations(repoPath: string): Array<NapiAttestation>
|
|
42
|
+
|
|
43
|
+
export declare function listAttestationsByDevice(repoPath: string, deviceDid: string): Array<NapiAttestation>
|
|
44
|
+
|
|
45
|
+
export declare function listOrgMembers(orgDid: string, includeRevoked: boolean, repoPath: string): string
|
|
46
|
+
|
|
47
|
+
export declare function listPinnedIdentities(repoPath: string): string
|
|
48
|
+
|
|
49
|
+
export declare function listWitnesses(repoPath: string): string
|
|
50
|
+
|
|
51
|
+
export interface NapiActionEnvelope {
|
|
52
|
+
envelopeJson: string
|
|
53
|
+
signatureHex: string
|
|
54
|
+
signerDid: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface NapiAgentIdentityBundle {
|
|
58
|
+
agentDid: string
|
|
59
|
+
keyAlias: string
|
|
60
|
+
attestationJson: string
|
|
61
|
+
publicKeyHex: string
|
|
62
|
+
repoPath?: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface NapiArtifactResult {
|
|
66
|
+
attestationJson: string
|
|
67
|
+
rid: string
|
|
68
|
+
digest: string
|
|
69
|
+
fileSize: number
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface NapiAttestation {
|
|
73
|
+
rid: string
|
|
74
|
+
issuer: string
|
|
75
|
+
subject: string
|
|
76
|
+
deviceDid: string
|
|
77
|
+
capabilities: Array<string>
|
|
78
|
+
signerType?: string
|
|
79
|
+
expiresAt?: string
|
|
80
|
+
revokedAt?: string
|
|
81
|
+
createdAt?: string
|
|
82
|
+
delegatedBy?: string
|
|
83
|
+
json: string
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface NapiChainLink {
|
|
87
|
+
issuer: string
|
|
88
|
+
subject: string
|
|
89
|
+
valid: boolean
|
|
90
|
+
error?: string
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface NapiCommitSignPemResult {
|
|
94
|
+
signaturePem: string
|
|
95
|
+
method: string
|
|
96
|
+
namespace: string
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface NapiCommitSignResult {
|
|
100
|
+
signature: string
|
|
101
|
+
signerDid: string
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface NapiDelegatedAgentBundle {
|
|
105
|
+
agentDid: string
|
|
106
|
+
keyAlias: string
|
|
107
|
+
attestationJson: string
|
|
108
|
+
publicKeyHex: string
|
|
109
|
+
repoPath?: string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface NapiExtensionResult {
|
|
113
|
+
deviceDid: string
|
|
114
|
+
newExpiresAt: string
|
|
115
|
+
previousExpiresAt?: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface NapiIdentityResult {
|
|
119
|
+
did: string
|
|
120
|
+
keyAlias: string
|
|
121
|
+
publicKeyHex: string
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface NapiLinkResult {
|
|
125
|
+
deviceDid: string
|
|
126
|
+
attestationId: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface NapiOrgMember {
|
|
130
|
+
memberDid: string
|
|
131
|
+
role: string
|
|
132
|
+
capabilitiesJson: string
|
|
133
|
+
issuerDid: string
|
|
134
|
+
attestationRid: string
|
|
135
|
+
revoked: boolean
|
|
136
|
+
expiresAt?: string
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface NapiOrgResult {
|
|
140
|
+
orgPrefix: string
|
|
141
|
+
orgDid: string
|
|
142
|
+
label: string
|
|
143
|
+
repoPath: string
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface NapiPairingResponse {
|
|
147
|
+
deviceDid: string
|
|
148
|
+
deviceName?: string
|
|
149
|
+
devicePublicKeyHex: string
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface NapiPairingResult {
|
|
153
|
+
deviceDid: string
|
|
154
|
+
deviceName?: string
|
|
155
|
+
attestationRid: string
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface NapiPairingSession {
|
|
159
|
+
sessionId: string
|
|
160
|
+
shortCode: string
|
|
161
|
+
endpoint: string
|
|
162
|
+
token: string
|
|
163
|
+
controllerDid: string
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface NapiPinnedIdentity {
|
|
167
|
+
did: string
|
|
168
|
+
label?: string
|
|
169
|
+
trustLevel: string
|
|
170
|
+
firstSeen: string
|
|
171
|
+
kelSequence?: number
|
|
172
|
+
pinnedAt: string
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface NapiPolicyDecision {
|
|
176
|
+
outcome: string
|
|
177
|
+
reason: string
|
|
178
|
+
message: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface NapiRotationResult {
|
|
182
|
+
controllerDid: string
|
|
183
|
+
newKeyFingerprint: string
|
|
184
|
+
previousKeyFingerprint: string
|
|
185
|
+
sequence: number
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface NapiVerificationReport {
|
|
189
|
+
status: NapiVerificationStatus
|
|
190
|
+
chain: Array<NapiChainLink>
|
|
191
|
+
warnings: Array<string>
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface NapiVerificationResult {
|
|
195
|
+
valid: boolean
|
|
196
|
+
error?: string
|
|
197
|
+
errorCode?: string
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface NapiVerificationStatus {
|
|
201
|
+
statusType: string
|
|
202
|
+
at?: string
|
|
203
|
+
step?: number
|
|
204
|
+
missingLink?: string
|
|
205
|
+
required?: number
|
|
206
|
+
verified?: number
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface NapiWitnessResult {
|
|
210
|
+
url: string
|
|
211
|
+
did?: string
|
|
212
|
+
label?: string
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export declare function pinIdentity(did: string, repoPath: string, label?: string | undefined | null, trustLevel?: string | undefined | null): NapiPinnedIdentity
|
|
216
|
+
|
|
217
|
+
export declare function removePinnedIdentity(did: string, repoPath: string): void
|
|
218
|
+
|
|
219
|
+
export declare function removeWitness(urlStr: string, repoPath: string): void
|
|
220
|
+
|
|
221
|
+
export declare function revokeDeviceFromIdentity(deviceDid: string, identityKeyAlias: string, repoPath: string, passphrase?: string | undefined | null, note?: string | undefined | null): void
|
|
222
|
+
|
|
223
|
+
export declare function revokeOrgMember(orgDid: string, memberDid: string, repoPath: string, passphrase?: string | undefined | null, note?: string | undefined | null, memberPublicKeyHex?: string | undefined | null): NapiOrgMember
|
|
224
|
+
|
|
225
|
+
export declare function rotateIdentityKeys(repoPath: string, identityKeyAlias?: string | undefined | null, nextKeyAlias?: string | undefined | null, passphrase?: string | undefined | null): NapiRotationResult
|
|
226
|
+
|
|
227
|
+
export declare function runDiagnostics(repoPath: string, passphrase?: string | undefined | null): string
|
|
228
|
+
|
|
229
|
+
export declare function signActionAsAgent(actionType: string, payloadJson: string, keyAlias: string, agentDid: string, repoPath: string, passphrase?: string | undefined | null): NapiActionEnvelope
|
|
230
|
+
|
|
231
|
+
export declare function signActionAsIdentity(actionType: string, payloadJson: string, identityDid: string, repoPath: string, passphrase?: string | undefined | null): NapiActionEnvelope
|
|
232
|
+
|
|
233
|
+
export declare function signArtifact(filePath: string, identityKeyAlias: string, repoPath: string, passphrase?: string | undefined | null, expiresIn?: number | undefined | null, note?: string | undefined | null): NapiArtifactResult
|
|
234
|
+
|
|
235
|
+
export declare function signArtifactBytes(data: Buffer, identityKeyAlias: string, repoPath: string, passphrase?: string | undefined | null, expiresIn?: number | undefined | null, note?: string | undefined | null): NapiArtifactResult
|
|
236
|
+
|
|
237
|
+
export declare function signAsAgent(message: Buffer, keyAlias: string, repoPath: string, passphrase?: string | undefined | null): NapiCommitSignResult
|
|
238
|
+
|
|
239
|
+
export declare function signAsIdentity(message: Buffer, identityDid: string, repoPath: string, passphrase?: string | undefined | null): NapiCommitSignResult
|
|
240
|
+
|
|
241
|
+
export declare function signCommit(data: Buffer, identityKeyAlias: string, repoPath: string, passphrase?: string | undefined | null): NapiCommitSignPemResult
|
|
242
|
+
|
|
243
|
+
export declare function verifyAttestation(attestationJson: string, issuerPkHex: string): Promise<NapiVerificationResult>
|
|
244
|
+
|
|
245
|
+
export declare function verifyAttestationWithCapability(attestationJson: string, issuerPkHex: string, requiredCapability: string): Promise<NapiVerificationResult>
|
|
246
|
+
|
|
247
|
+
export declare function verifyAtTime(attestationJson: string, issuerPkHex: string, atRfc3339: string): Promise<NapiVerificationResult>
|
|
248
|
+
|
|
249
|
+
export declare function verifyAtTimeWithCapability(attestationJson: string, issuerPkHex: string, atRfc3339: string, requiredCapability: string): Promise<NapiVerificationResult>
|
|
250
|
+
|
|
251
|
+
export declare function verifyChain(attestationsJson: Array<string>, rootPkHex: string): Promise<NapiVerificationReport>
|
|
252
|
+
|
|
253
|
+
export declare function verifyChainWithCapability(attestationsJson: Array<string>, rootPkHex: string, requiredCapability: string): Promise<NapiVerificationReport>
|
|
254
|
+
|
|
255
|
+
export declare function verifyChainWithWitnesses(attestationsJson: Array<string>, rootPkHex: string, receiptsJson: Array<string>, witnessKeysJson: Array<string>, threshold: number): Promise<NapiVerificationReport>
|
|
256
|
+
|
|
257
|
+
export declare function verifyDeviceAuthorization(identityDid: string, deviceDid: string, attestationsJson: Array<string>, identityPkHex: string): Promise<NapiVerificationReport>
|
|
258
|
+
|
|
259
|
+
export declare function version(): string
|