@motebit/crypto 0.8.0 → 1.0.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/LICENSE +198 -18
- package/NOTICE +19 -0
- package/README.md +11 -3
- package/dist/artifacts.d.ts +431 -32
- package/dist/artifacts.d.ts.map +1 -1
- package/dist/artifacts.js +694 -42
- package/dist/artifacts.js.map +1 -1
- package/dist/credential-anchor.d.ts +76 -2
- package/dist/credential-anchor.d.ts.map +1 -1
- package/dist/credential-anchor.js +109 -22
- package/dist/credential-anchor.js.map +1 -1
- package/dist/credentials.d.ts +1 -1
- package/dist/credentials.js +1 -1
- package/dist/hardware-attestation.d.ts +238 -0
- package/dist/hardware-attestation.d.ts.map +1 -0
- package/dist/hardware-attestation.js +345 -0
- package/dist/hardware-attestation.js.map +1 -0
- package/dist/index.d.ts +56 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3322 -288
- package/dist/index.js.map +1 -1
- package/dist/signing.d.ts +52 -17
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +67 -35
- package/dist/signing.js.map +1 -1
- package/dist/suite-dispatch.d.ts +103 -0
- package/dist/suite-dispatch.d.ts.map +1 -0
- package/dist/suite-dispatch.js +3233 -0
- package/dist/suite-dispatch.js.map +1 -0
- package/package.json +20 -5
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,11 @@ export interface SuccessionRecord {
|
|
|
75
75
|
new_public_key: string;
|
|
76
76
|
timestamp: number;
|
|
77
77
|
reason?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Cryptosuite discriminator. Always `"motebit-jcs-ed25519-hex-v1"`
|
|
80
|
+
* for this artifact today — same suite as the identity frontmatter.
|
|
81
|
+
*/
|
|
82
|
+
suite: "motebit-jcs-ed25519-hex-v1";
|
|
78
83
|
old_key_signature?: string;
|
|
79
84
|
new_key_signature: string;
|
|
80
85
|
/** True when succession was authorized by guardian, not old key. */
|
|
@@ -102,6 +107,9 @@ export interface ExecutionReceipt {
|
|
|
102
107
|
}
|
|
103
108
|
export type { DataIntegrityProof, VerifiableCredential, VerifiablePresentation, } from "./credentials.js";
|
|
104
109
|
import type { VerifiableCredential, VerifiablePresentation } from "./credentials.js";
|
|
110
|
+
export { verifyHardwareAttestationClaim, canonicalSecureEnclaveBodyForTest, encodeSecureEnclaveReceiptForTest, } from "./hardware-attestation.js";
|
|
111
|
+
export type { AttestationPlatform, HardwareAttestationError, HardwareAttestationVerifyResult, HardwareAttestationVerifiers, DeviceCheckVerifierContext, } from "./hardware-attestation.js";
|
|
112
|
+
import type { HardwareAttestationVerifiers, HardwareAttestationVerifyResult } from "./hardware-attestation.js";
|
|
105
113
|
export interface VerificationError {
|
|
106
114
|
message: string;
|
|
107
115
|
path?: string;
|
|
@@ -135,6 +143,14 @@ export interface CredentialVerifyResult extends BaseResult {
|
|
|
135
143
|
issuer?: string;
|
|
136
144
|
subject?: string;
|
|
137
145
|
expired?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Hardware-attestation verification outcome. Present only when the
|
|
148
|
+
* credential's subject declared a `hardware_attestation` claim. Absent
|
|
149
|
+
* means "no claim" (not "fails closed" — the credential's own
|
|
150
|
+
* signature is independent of the attestation). Populated by the
|
|
151
|
+
* unified `verify()` dispatcher via `verifyHardwareAttestationClaim`.
|
|
152
|
+
*/
|
|
153
|
+
hardware_attestation?: HardwareAttestationVerifyResult;
|
|
138
154
|
}
|
|
139
155
|
export interface PresentationVerifyResult extends BaseResult {
|
|
140
156
|
type: "presentation";
|
|
@@ -148,8 +164,26 @@ export interface VerifyOptions {
|
|
|
148
164
|
expectedType?: ArtifactType;
|
|
149
165
|
/** Clock skew tolerance in seconds for credential expiry checks. Default: 60. */
|
|
150
166
|
clockSkewSeconds?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Optional injection of platform-specific hardware-attestation
|
|
169
|
+
* verifiers. Consumers that need `device_check` / `tpm` /
|
|
170
|
+
* `play_integrity` verification pass the corresponding leaf package's
|
|
171
|
+
* verifier function here (e.g. `deviceCheckVerifier(...)` from
|
|
172
|
+
* `@motebit/crypto-appattest`). Absence keeps the permissive-floor `@motebit/crypto`
|
|
173
|
+
* path pure: unknown platforms fail-closed with a named-missing-adapter
|
|
174
|
+
* error. See `hardware-attestation.ts::HardwareAttestationVerifiers`.
|
|
175
|
+
*/
|
|
176
|
+
hardwareAttestation?: HardwareAttestationVerifiers;
|
|
151
177
|
}
|
|
152
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* @deprecated since 1.0.0, removed in 2.0.0. Use {@link VerifyResult} instead.
|
|
180
|
+
*
|
|
181
|
+
* Reason: pre-0.4.0 return shape with a flat `error: string` field and no
|
|
182
|
+
* type discriminator. The modern {@link VerifyResult} is a discriminated
|
|
183
|
+
* union (`type: "identity" | "receipt" | "credential" | "presentation"`)
|
|
184
|
+
* with a structured `errors: Array<{ message: string }>` — one shape covers
|
|
185
|
+
* every artifact type motebit verifies.
|
|
186
|
+
*/
|
|
153
187
|
export interface LegacyVerifyResult {
|
|
154
188
|
valid: boolean;
|
|
155
189
|
identity: MotebitIdentityFile | null;
|
|
@@ -202,11 +236,30 @@ export declare function verify(artifact: unknown, options?: VerifyOptions): Prom
|
|
|
202
236
|
/**
|
|
203
237
|
* Verify a motebit.md identity file. Backward-compatible with pre-0.4.0.
|
|
204
238
|
*
|
|
205
|
-
* @deprecated Use `verify(content
|
|
239
|
+
* @deprecated since 1.0.0, removed in 2.0.0. Use `verify(content, { expectedType: "identity" })` instead.
|
|
240
|
+
*
|
|
241
|
+
* Reason: `verify()` is the unified dispatcher for every signed artifact
|
|
242
|
+
* type (identity, receipt, credential, presentation) and returns a typed
|
|
243
|
+
* {@link VerifyResult} discriminated union. `verifyIdentityFile` is the
|
|
244
|
+
* pre-0.4.0 identity-only wrapper kept alive for the deprecation window —
|
|
245
|
+
* it reshapes `verify()`'s output into the legacy flat-`error` format.
|
|
246
|
+
*
|
|
247
|
+
* Migration:
|
|
248
|
+
* ```ts
|
|
249
|
+
* // Before:
|
|
250
|
+
* const r = await verifyIdentityFile(content);
|
|
251
|
+
* if (r.valid) console.log(r.did);
|
|
252
|
+
* else console.log(r.error);
|
|
253
|
+
*
|
|
254
|
+
* // After:
|
|
255
|
+
* const r = await verify(content, { expectedType: "identity" });
|
|
256
|
+
* if (r.type === "identity" && r.valid) console.log(r.did);
|
|
257
|
+
* else console.log(r.errors?.[0]?.message);
|
|
258
|
+
* ```
|
|
206
259
|
*/
|
|
207
260
|
export declare function verifyIdentityFile(content: string): Promise<LegacyVerifyResult>;
|
|
208
261
|
export * from "./signing.js";
|
|
209
262
|
export * from "./artifacts.js";
|
|
210
263
|
export { signVerifiableCredential, verifyVerifiableCredential, signVerifiablePresentation, verifyVerifiablePresentation, issueGradientCredential, issueReputationCredential, issueTrustCredential, createPresentation, type GradientCredentialSubject, type ReputationCredentialSubject, type TrustCredentialSubject, } from "./credentials.js";
|
|
211
|
-
export { computeCredentialLeaf, verifyCredentialAnchor, type CredentialAnchorVerifyResult, type CredentialAnchorProofFields, type ChainAnchorVerifier, } from "./credential-anchor.js";
|
|
264
|
+
export { computeCredentialLeaf, verifyCredentialAnchor, verifyRevocationAnchor, type CredentialAnchorVerifyResult, type CredentialAnchorProofFields, type ChainAnchorVerifier, type RevocationAnchorVerifyResult, type RevocationAnchorProof, } from "./credential-anchor.js";
|
|
212
265
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAYH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB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