@ixo/credentials-kit 0.0.0-stage → 0.1.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.
Files changed (72) hide show
  1. package/README.md +469 -2
  2. package/dist/chunk-2SF56NEJ.js +1053 -0
  3. package/dist/chunk-2SF56NEJ.js.map +1 -0
  4. package/dist/chunk-46VRPQPD.js +176 -0
  5. package/dist/chunk-46VRPQPD.js.map +1 -0
  6. package/dist/chunk-AQ3IINHC.js +138 -0
  7. package/dist/chunk-AQ3IINHC.js.map +1 -0
  8. package/dist/chunk-FSKCDHZ7.js +613 -0
  9. package/dist/chunk-FSKCDHZ7.js.map +1 -0
  10. package/dist/chunk-I6GBYFIJ.js +89 -0
  11. package/dist/chunk-I6GBYFIJ.js.map +1 -0
  12. package/dist/chunk-JBUX6V2Q.js +210 -0
  13. package/dist/chunk-JBUX6V2Q.js.map +1 -0
  14. package/dist/chunk-Q3MZNMCK.js +183 -0
  15. package/dist/chunk-Q3MZNMCK.js.map +1 -0
  16. package/dist/chunk-RKKRO4ZK.js +133 -0
  17. package/dist/chunk-RKKRO4ZK.js.map +1 -0
  18. package/dist/chunk-STMMFNVW.js +391 -0
  19. package/dist/chunk-STMMFNVW.js.map +1 -0
  20. package/dist/chunk-VXKONZK4.js +189 -0
  21. package/dist/chunk-VXKONZK4.js.map +1 -0
  22. package/dist/chunk-WIEGZFUO.js +337 -0
  23. package/dist/chunk-WIEGZFUO.js.map +1 -0
  24. package/dist/chunk-WND2LZ4O.js +66 -0
  25. package/dist/chunk-WND2LZ4O.js.map +1 -0
  26. package/dist/chunk-XREZY53L.js +260 -0
  27. package/dist/chunk-XREZY53L.js.map +1 -0
  28. package/dist/chunk-ZZY4WGQ6.js +13 -0
  29. package/dist/chunk-ZZY4WGQ6.js.map +1 -0
  30. package/dist/did.d.ts +182 -0
  31. package/dist/did.js +6 -0
  32. package/dist/did.js.map +1 -0
  33. package/dist/display.d.ts +117 -0
  34. package/dist/display.js +5 -0
  35. package/dist/display.js.map +1 -0
  36. package/dist/errors-BKQmNpXX.d.ts +11 -0
  37. package/dist/holder.d.ts +85 -0
  38. package/dist/holder.js +8 -0
  39. package/dist/holder.js.map +1 -0
  40. package/dist/http-BhuJ_-RZ.d.ts +25 -0
  41. package/dist/index.d.ts +15 -0
  42. package/dist/index.js +16 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/jose.d.ts +134 -0
  45. package/dist/jose.js +4 -0
  46. package/dist/jose.js.map +1 -0
  47. package/dist/oid4vci.d.ts +428 -0
  48. package/dist/oid4vci.js +11 -0
  49. package/dist/oid4vci.js.map +1 -0
  50. package/dist/oid4vp.d.ts +416 -0
  51. package/dist/oid4vp.js +11 -0
  52. package/dist/oid4vp.js.map +1 -0
  53. package/dist/profile.d.ts +218 -0
  54. package/dist/profile.js +4 -0
  55. package/dist/profile.js.map +1 -0
  56. package/dist/sdjwt.d.ts +133 -0
  57. package/dist/sdjwt.js +5 -0
  58. package/dist/sdjwt.js.map +1 -0
  59. package/dist/sender.d.ts +8 -0
  60. package/dist/sender.js +7 -0
  61. package/dist/sender.js.map +1 -0
  62. package/dist/status.d.ts +108 -0
  63. package/dist/status.js +7 -0
  64. package/dist/status.js.map +1 -0
  65. package/dist/util-DOTEZgTt.d.ts +3 -0
  66. package/dist/verify.d.ts +144 -0
  67. package/dist/verify.js +9 -0
  68. package/dist/verify.js.map +1 -0
  69. package/dist/webhook.d.ts +62 -0
  70. package/dist/webhook.js +7 -0
  71. package/dist/webhook.js.map +1 -0
  72. package/package.json +168 -4
@@ -0,0 +1,5 @@
1
+ export { CARD_COLOR_PATTERN, CARD_DARK_TEXT, CARD_DISPLAY_MEMBERS, CARD_HUES, CARD_LIGHT_TEXT, CARD_PATTERNS, MAX_CARD_URI_LENGTH, MIN_TEXT_CONTRAST, cardLook, contrastRatio, markLook, parseCardColor, parseCardDisplay, parseCardUri } from './chunk-46VRPQPD.js';
2
+ import './chunk-Q3MZNMCK.js';
3
+ import './chunk-AQ3IINHC.js';
4
+ //# sourceMappingURL=display.js.map
5
+ //# sourceMappingURL=display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"display.js"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The base class of every error the kit throws. `code` is a constant snake_case string from a
3
+ * documented set per module; `message` is a fixed sentence for that code. Neither ever carries
4
+ * credential contents, keys, tokens or other secrets, so both are safe to log.
5
+ */
6
+ declare class CredentialsKitError extends Error {
7
+ readonly code: string;
8
+ constructor(code: string, message: string);
9
+ }
10
+
11
+ export { CredentialsKitError as C };
@@ -0,0 +1,85 @@
1
+ import { CredentialsKitError } from './index.js';
2
+ import { HostPolicy, FetchLike } from './did.js';
3
+ import { BlockSenderResult, SenderBlockList, UnblockSenderResult } from './profile.js';
4
+ export { SenderBlock } from './profile.js';
5
+ import './display.js';
6
+
7
+ /**
8
+ * `@ixo/credentials-kit/holder` — a wallet's calls to the Credentials worker as the person
9
+ * (ability `credentials/hold`, principal = the person). For now: the person's block list (SPEC
10
+ * §16.1): `blockSender`, `unblockSender`, `listBlocks`.
11
+ *
12
+ * Conventions (SPEC §5.1, §13.1), the same as every other call to the worker:
13
+ * - every call carries a FRESH, single-use UCAN invocation, minted by the caller's `authorize`
14
+ * for exactly that request: audience = the worker's did:web (its `/.well-known/did.json`),
15
+ * capability `credentials/hold` on `ixo:credentials`, lifetime at most 300 s, and the
16
+ * request-binding fact `{ method, path }` this module passes in (method upper-case, the full
17
+ * path without the query string). The kit does not depend on a UCAN library: mint it with
18
+ * `@ixo/ucan` (`createInvocation` + `serializeInvocation`) or your own;
19
+ * - the worker's URL must pass the kit's host policy (https on a public host; local development
20
+ * passes `allowHttp` / `allowLocal`); requests never follow redirects, always time out, and the
21
+ * answer is read no further than 64 KB.
22
+ *
23
+ * Errors: `CredentialsServiceError` with the worker's error `code` (`blocked`, `too_many_blocks`,
24
+ * `invalid_request`, `unauthenticated`, `forbidden`, `rate_limited`, `unavailable`, …), the HTTP
25
+ * `status`, and `reference` (the worker's request id, for support); `unreachable` (network,
26
+ * timeout, redirect; status null or the 3xx) and `bad_response` (an answer that is not the
27
+ * documented shape) when the worker did not answer properly. A wrong argument throws `TypeError`.
28
+ */
29
+
30
+ /** The request an invocation is bound to (SPEC §13.1). */
31
+ interface RequestBinding {
32
+ /** Upper-case HTTP method. */
33
+ method: string;
34
+ /** The full request path, without the query string. */
35
+ path: string;
36
+ }
37
+ /** The request-binding fact for `method` + `url` (the path only, never the query). */
38
+ declare function requestBinding(method: string, url: string): RequestBinding;
39
+ interface HolderCallOptions extends HostPolicy {
40
+ /** The Credentials worker's origin, e.g. `https://credentials.ixo.world`. */
41
+ serviceUrl: string;
42
+ /**
43
+ * Mint a fresh, single-use UCAN invocation (base64 CAR) bound to `binding`: issuer = the
44
+ * person (or a key the person delegated `credentials/hold` to), audience = the worker's
45
+ * did:web, capability `credentials/hold` on `ixo:credentials`, at most 300 s, and the fact
46
+ * `{ method, path }` equal to `binding`.
47
+ */
48
+ authorize: (binding: RequestBinding) => Promise<string>;
49
+ fetch: FetchLike;
50
+ /** Default 10 s. */
51
+ timeoutMs?: number;
52
+ }
53
+ /** A call to the Credentials worker that did not succeed. */
54
+ declare class CredentialsServiceError extends CredentialsKitError {
55
+ /** The HTTP status, or null when the worker could not be reached. */
56
+ readonly status: number | null;
57
+ /** The worker's request id (its `reference`), for support. */
58
+ readonly reference?: string | undefined;
59
+ constructor(code: string, message: string,
60
+ /** The HTTP status, or null when the worker could not be reached. */
61
+ status: number | null,
62
+ /** The worker's request id (its `reference`), for support. */
63
+ reference?: string | undefined);
64
+ }
65
+ /**
66
+ * `POST /v1/blocks`: the person blocks `sender` (a did:ixo or did:web in canonical form; the
67
+ * block covers exactly this DID, never another DID on the same host, SPEC §17.4). Idempotent. The worker closes the sender's waiting offers and requests for the person as
68
+ * declined (`closed`) and refuses its later deposits with 403 `blocked`. At most 500 blocks per
69
+ * person (`too_many_blocks`).
70
+ */
71
+ declare function blockSender(opts: HolderCallOptions & {
72
+ sender: string;
73
+ }): Promise<BlockSenderResult>;
74
+ /** `POST /v1/blocks/remove`: the person unblocks `sender`. Idempotent (`removed: false`). */
75
+ declare function unblockSender(opts: HolderCallOptions & {
76
+ sender: string;
77
+ }): Promise<UnblockSenderResult>;
78
+ /** `GET /v1/blocks`: one page of the person's blocks, newest first (`limit` 1–100, `cursor`). */
79
+ declare function listBlocks(opts: HolderCallOptions & {
80
+ cursor?: string;
81
+ limit?: number;
82
+ }): Promise<SenderBlockList>;
83
+
84
+ export { BlockSenderResult, CredentialsServiceError, SenderBlockList, UnblockSenderResult, blockSender, listBlocks, requestBinding, unblockSender };
85
+ export type { HolderCallOptions, RequestBinding };
package/dist/holder.js ADDED
@@ -0,0 +1,8 @@
1
+ export { CredentialsServiceError, blockSender, listBlocks, requestBinding, unblockSender } from './chunk-RKKRO4ZK.js';
2
+ import './chunk-ZZY4WGQ6.js';
3
+ import './chunk-WIEGZFUO.js';
4
+ import './chunk-Q3MZNMCK.js';
5
+ import './chunk-VXKONZK4.js';
6
+ import './chunk-AQ3IINHC.js';
7
+ //# sourceMappingURL=holder.js.map
8
+ //# sourceMappingURL=holder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"holder.js"}
@@ -0,0 +1,25 @@
1
+ /** The subset of `fetch` the kit uses. Pass `globalThis.fetch` (bound) or a test double. */
2
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
3
+ /**
4
+ * True when `hostname` (as `new URL(...).hostname` gives it: IPv4 normalised, IPv6 in brackets)
5
+ * is not a public internet host: a non-public IP literal (also embedded in 6to4, NAT64, Teredo,
6
+ * IPv4-mapped or IPv4-translated IPv6), a single-label name, `localhost`, or a name ending in
7
+ * `.localhost`, `.local`, `.internal`, `.lan`, `.home.arpa`, `.home`, `.corp`, `.intranet`,
8
+ * `.private` or `.localdomain`.
9
+ */
10
+ declare function isPrivateHost(hostname: string): boolean;
11
+ interface HostPolicy {
12
+ /** http on a loopback host (local development only). */
13
+ allowHttp?: boolean;
14
+ /** Loopback / private / link-local / local-name hosts (local development only). */
15
+ allowLocal?: boolean;
16
+ }
17
+ /**
18
+ * An https URL (or, only with `allowHttp`, an http URL on a loopback host) without credentials or
19
+ * fragment, whose host passes the host policy (`allowLocal` lifts it). Local development needs
20
+ * both flags for `http://localhost:…`.
21
+ */
22
+ declare function isFetchableUrl(url: string, policy?: HostPolicy): boolean;
23
+
24
+ export { isPrivateHost as a, isFetchableUrl as i };
25
+ export type { FetchLike as F, HostPolicy as H };
@@ -0,0 +1,15 @@
1
+ export { DecodedJws, ED25519_JWS_ALGS, Ed25519JwsAlg, Ed25519PublicJwk, Ed25519Signer, JoseError, JoseErrorCode, JwsHeader, MAX_JWS_LENGTH, MAX_KEY_STRING_LENGTHS, Signer, base58btc, base64url, decodeJws, ed25519, ed25519SeedFromMnemonic, isEd25519JwsAlg, multibaseToRaw, publicJwkFromRaw, rawFromPublicJwk, rawToMultibase, signJws, signerFromEd25519Seed, verifyEd25519, verifyJws } from './jose.js';
2
+ export { DidDocument, DidResolver, DidWeb, IXO_ENTITY_DID, IXO_PERSON_DID, IxoResolverOptions, KeyRelationship, KeyValueCache, MAX_DID_WEB_LENGTH, MAX_METHODS_PER_RELATIONSHIP, ResolvedKey, ResolverSource, ResolverUnavailable, VerificationMethod, VerificationRelationshipEntry, WebResolverOptions, composeResolvers, createIxoResolver, createMemoryCache, createStaticResolver, createWebResolver, didFromKid, didWebUrl, ed25519KeyOfMethod, findKey, isCanonicalHost, keysFor, normalizeDidDocument, parseDidWeb } from './did.js';
3
+ export { CredentialRecordOptions, Disclosure, MAX_CLAIM_DEPTH, MAX_DISCLOSURES, MAX_SD_JWT_LENGTH, ParsedSdJwt, ProcessedSdJwt, REFUSED_CLAIM_NAMES, SdJwtCredentialRecord, SdJwtError, SdJwtErrorCode, credentialCid, credentialRecordFromSdJwt, parseSdJwt, processDisclosures, sdDigest, sdHash, selectDisclosures, serializeSdJwt } from './sdjwt.js';
4
+ export { CreateStatusListTokenInput, MAX_STATUS_LIST_BYTES, MAX_STATUS_LIST_TOKEN_LENGTH, STATUS_INVALID, STATUS_LIST_MEDIA_TYPE, STATUS_LIST_TYP, STATUS_SUSPENDED, STATUS_VALID, StatusListError, StatusListErrorCode, VerifiedStatusList, VerifyStatusListTokenOptions, createStatusListToken, deflateStatusList, getStatusBit, inflateStatusList, newStatusBits, randomFreeIndex, setStatusBit, statusAt, verifyStatusListToken } from './status.js';
5
+ export { FailedPresentation, NonceCheck, UnavailableSource, VERIFY_FAILURE_DETAILS, VerificationUnavailable, VerifiedPresentation, VerifyDeps, VerifyFailureCode, VerifyIssuedCredentialOptions, VerifyPolicy, VerifyResult, verifyIssuedCredential, verifyPresentation } from './verify.js';
6
+ export { SignWebhookInput, VerifyWebhookInput, WEBHOOK_MAX_AGE_SECONDS, WEBHOOK_MAX_FUTURE_SECONDS, WebhookFailure, WebhookVerification, signWebhook, verifyWebhook } from './webhook.js';
7
+ export { ABILITIES, ABILITY_HOLD, ABILITY_ISSUE, ABILITY_OFFER, ABILITY_PRESENT, ABILITY_VERIFY, AGE_CLAIMS, Ability, AgeClaim, BLOCKED_ERROR, BlockSenderResult, CLIENT_ID_PREFIX, CREDENTIAL_FORMAT, CatalogClaim, CatalogIssuerEntry, CatalogIssuerType, CatalogVerifierAccept, CatalogVerifierEntry, ClaimDisclosure, DcqlQuerySummary, HEADERS, IDENTITY_LEVEL1_CONFIGURATION_ID, IDENTITY_LEVEL1_VCT, KB_JWT_TYP, KYC_AML_LEVEL1_VCT, MAX_BLOCKS_PER_PERSON, MEDIA_TYPES, OfferDisplay, OfferStatus, OfferSummary, PRE_AUTHORIZED_CODE_GRANT, PROOF_JWT_TYP, REGISTERED_CLAIMS, REQUEST_OBJECT_TYP, RequestStatus, RequestSummary, SD_JWT_TYP, STATUS_LIST_JWT_TYP, SenderBlock, SenderBlockList, UCAN_RESOURCE, UnblockSenderResult, VAULT_CREDENTIAL_CONTENT_FIELD, VAULT_CREDENTIAL_EVENT_TYPE, VAULT_CREDENTIAL_INDEX_TYPE, VCT_STATE_KEYS, WEBHOOK_EVENT_TYPES, WEBHOOK_SIGNATURE_HEADER, WebhookEvent, WebhookEventType, entityResource, stateKeyForVct } from './profile.js';
8
+ export { CARD_COLOR_PATTERN, CARD_DARK_TEXT, CARD_DISPLAY_MEMBERS, CARD_HUES, CARD_LIGHT_TEXT, CARD_PATTERNS, CardDisplay, CardDisplayMember, CardLook, MAX_CARD_URI_LENGTH, MIN_TEXT_CONTRAST, MarkLook, cardLook, contrastRatio, markLook, parseCardColor, parseCardDisplay, parseCardUri } from './display.js';
9
+ export { CredentialsServiceError, HolderCallOptions, RequestBinding, blockSender, listBlocks, requestBinding, unblockSender } from './holder.js';
10
+ export { senderKeyOf } from './sender.js';
11
+ export { AuthorizationErrorCode, AuthorizationErrorTarget, AuthorizationRequest, AuthorizationResponse, CreateAuthorizationRequestInput, CreatePresentationInput, DEFAULT_RESPONSE_ENCRYPTION_ENC, DcqlClaimQuery, DcqlCredentialQuery, DcqlQuery, FailedQuery, JweEnc, MAX_CLAIMS_PER_QUERY, MAX_CREDENTIAL_QUERIES, MAX_REQUEST_LIFETIME_SECONDS, MAX_REQUEST_OBJECT_LENGTH, MAX_RESPONSE_BODY_LENGTH, MatchFailure, MatchResult, Oid4vpError, Oid4vpErrorCode, P256PrivateJwk, P256PublicJwk, ParsedAuthorizationResponse, QueryResult, RESPONSE_ENCRYPTION_ENC, RESPONSE_ENCRYPTION_ENCS, ResponseFailureCode, ResponseMode, SELF_ISSUED_AUDIENCE, SendAuthorizationErrorInput, VerifiedAuthorizationResponse, VerifyAuthorizationRequestOptions, VerifyAuthorizationResponseInput, VpToken, WalletLink, authorizationErrorFor, buildWalletLink, createAuthorizationErrorResponse, createAuthorizationRequest, createAuthorizationResponse, createPresentation, decodeOwnAuthorizationRequest, generateResponseKeyPair, matchCredential, parseAuthorizationResponse, parseWalletLink, sendAuthorizationError, summarizeDcql, validateDcql, verifyAuthorizationRequest, verifyAuthorizationResponse } from './oid4vp.js';
12
+ export { AuthorizationServerMetadata, BuildIssuerMetadataInput, ClaimDescription, CredentialConfiguration, CredentialIssuerMetadata, CredentialOffer, CredentialRequest, CredentialResponse, DeferredCredentialRequest, DeferredCredentialResponse, DeferredResult, Display, IssuedResult, IssuerConfigurationInput, NonceResponse, NotificationEvent, NotificationRequest, OAuthErrorResponse, Oid4vciError, Oid4vciErrorCode, PreAuthorizedCodeGrant, RedeemOfferInput, TokenRequest, TokenResponse, TxCode, VerifiedProof, VerifyProofJwtOptions, authorizationServerMetadataUrl, buildAuthorizationServerMetadata, buildCredentialOffer, buildIssuerMetadata, createProofJwt, fetchCredentialOffer, fetchIssuerMetadata, issuerMetadataUrl, pollDeferred, redeemOffer, sendNotification, validateCredentialOffer, verifyProofJwt } from './oid4vci.js';
13
+ export { C as CredentialsKitError } from './errors-BKQmNpXX.js';
14
+ export { F as FetchLike, H as HostPolicy, i as isFetchableUrl, a as isPrivateHost } from './http-BhuJ_-RZ.js';
15
+ export { J as JsonObject } from './util-DOTEZgTt.js';
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ export { WEBHOOK_MAX_AGE_SECONDS, WEBHOOK_MAX_FUTURE_SECONDS, signWebhook, verifyWebhook } from './chunk-WND2LZ4O.js';
2
+ export { CARD_COLOR_PATTERN, CARD_DARK_TEXT, CARD_DISPLAY_MEMBERS, CARD_HUES, CARD_LIGHT_TEXT, CARD_PATTERNS, MAX_CARD_URI_LENGTH, MIN_TEXT_CONTRAST, cardLook, contrastRatio, markLook, parseCardColor, parseCardDisplay, parseCardUri } from './chunk-46VRPQPD.js';
3
+ export { CredentialsServiceError, blockSender, listBlocks, requestBinding, unblockSender } from './chunk-RKKRO4ZK.js';
4
+ export { senderKeyOf } from './chunk-ZZY4WGQ6.js';
5
+ export { Oid4vciError, authorizationServerMetadataUrl, buildAuthorizationServerMetadata, buildCredentialOffer, buildIssuerMetadata, createProofJwt, fetchCredentialOffer, fetchIssuerMetadata, issuerMetadataUrl, pollDeferred, redeemOffer, sendNotification, validateCredentialOffer, verifyProofJwt } from './chunk-FSKCDHZ7.js';
6
+ export { DEFAULT_RESPONSE_ENCRYPTION_ENC, MAX_CLAIMS_PER_QUERY, MAX_CREDENTIAL_QUERIES, MAX_REQUEST_LIFETIME_SECONDS, MAX_REQUEST_OBJECT_LENGTH, MAX_RESPONSE_BODY_LENGTH, Oid4vpError, RESPONSE_ENCRYPTION_ENC, RESPONSE_ENCRYPTION_ENCS, SELF_ISSUED_AUDIENCE, authorizationErrorFor, buildWalletLink, createAuthorizationErrorResponse, createAuthorizationRequest, createAuthorizationResponse, createPresentation, decodeOwnAuthorizationRequest, generateResponseKeyPair, matchCredential, parseAuthorizationResponse, parseWalletLink, sendAuthorizationError, summarizeDcql, validateDcql, verifyAuthorizationRequest, verifyAuthorizationResponse } from './chunk-2SF56NEJ.js';
7
+ export { ABILITIES, ABILITY_HOLD, ABILITY_ISSUE, ABILITY_OFFER, ABILITY_PRESENT, ABILITY_VERIFY, AGE_CLAIMS, BLOCKED_ERROR, CLIENT_ID_PREFIX, CREDENTIAL_FORMAT, HEADERS, IDENTITY_LEVEL1_CONFIGURATION_ID, IDENTITY_LEVEL1_VCT, KB_JWT_TYP, KYC_AML_LEVEL1_VCT, MAX_BLOCKS_PER_PERSON, MEDIA_TYPES, PRE_AUTHORIZED_CODE_GRANT, PROOF_JWT_TYP, REGISTERED_CLAIMS, REQUEST_OBJECT_TYP, SD_JWT_TYP, STATUS_LIST_JWT_TYP, UCAN_RESOURCE, VAULT_CREDENTIAL_CONTENT_FIELD, VAULT_CREDENTIAL_EVENT_TYPE, VAULT_CREDENTIAL_INDEX_TYPE, VCT_STATE_KEYS, WEBHOOK_EVENT_TYPES, WEBHOOK_SIGNATURE_HEADER, entityResource, stateKeyForVct } from './chunk-I6GBYFIJ.js';
8
+ export { VERIFY_FAILURE_DETAILS, VerificationUnavailable, verifyIssuedCredential, verifyPresentation } from './chunk-STMMFNVW.js';
9
+ export { MAX_CLAIM_DEPTH, MAX_DISCLOSURES, MAX_SD_JWT_LENGTH, REFUSED_CLAIM_NAMES, SdJwtError, credentialCid, credentialRecordFromSdJwt, parseSdJwt, processDisclosures, sdDigest, sdHash, selectDisclosures, serializeSdJwt } from './chunk-XREZY53L.js';
10
+ export { MAX_STATUS_LIST_BYTES, MAX_STATUS_LIST_TOKEN_LENGTH, STATUS_INVALID, STATUS_LIST_MEDIA_TYPE, STATUS_LIST_TYP, STATUS_SUSPENDED, STATUS_VALID, StatusListError, createStatusListToken, deflateStatusList, getStatusBit, inflateStatusList, newStatusBits, randomFreeIndex, setStatusBit, statusAt, verifyStatusListToken } from './chunk-JBUX6V2Q.js';
11
+ export { IXO_ENTITY_DID, IXO_PERSON_DID, MAX_DID_WEB_LENGTH, MAX_METHODS_PER_RELATIONSHIP, ResolverUnavailable, composeResolvers, createIxoResolver, createMemoryCache, createStaticResolver, createWebResolver, didFromKid, didWebUrl, ed25519KeyOfMethod, findKey, isCanonicalHost, keysFor, normalizeDidDocument, parseDidWeb } from './chunk-WIEGZFUO.js';
12
+ export { isFetchableUrl, isPrivateHost } from './chunk-Q3MZNMCK.js';
13
+ export { CredentialsKitError, ED25519_JWS_ALGS, JoseError, MAX_JWS_LENGTH, MAX_KEY_STRING_LENGTHS, base58btc, base64url, decodeJws, ed25519, ed25519SeedFromMnemonic, isEd25519JwsAlg, multibaseToRaw, publicJwkFromRaw, rawFromPublicJwk, rawToMultibase, signJws, signerFromEd25519Seed, verifyEd25519, verifyJws } from './chunk-VXKONZK4.js';
14
+ import './chunk-AQ3IINHC.js';
15
+ //# sourceMappingURL=index.js.map
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/dist/jose.d.ts ADDED
@@ -0,0 +1,134 @@
1
+ import { C as CredentialsKitError } from './errors-BKQmNpXX.js';
2
+ import { J as JsonObject } from './util-DOTEZgTt.js';
3
+
4
+ /** base64url without padding (RFC 7515 §2). */
5
+ declare function base64urlEncode(bytes: Uint8Array): string;
6
+ /**
7
+ * Strict base64url decode: only the URL-safe alphabet, no padding, no whitespace, and the
8
+ * canonical encoding only (unused trailing bits must be zero), so one byte string has exactly
9
+ * one accepted text form. Throws on anything else.
10
+ */
11
+ declare function base64urlDecode(s: string): Uint8Array<ArrayBuffer>;
12
+ /** base58btc (Bitcoin alphabet), as used by did:key, multibase `z` and IXO key ids. */
13
+ declare function base58btcEncode(bytes: Uint8Array): string;
14
+ declare function base58btcDecode(s: string): Uint8Array<ArrayBuffer>;
15
+
16
+ /** Signs bytes with one Ed25519 key. `kid` is the key's DID URL (`<did>#<fragment>`). */
17
+ interface Signer {
18
+ kid: string;
19
+ sign(bytes: Uint8Array): Promise<Uint8Array>;
20
+ }
21
+ /** A `Signer` built from a local seed, which also knows its public key. */
22
+ interface Ed25519Signer extends Signer {
23
+ publicKey: Uint8Array;
24
+ publicJwk: Ed25519PublicJwk;
25
+ }
26
+ /** An Ed25519 public key as an OKP JWK (RFC 8037). */
27
+ interface Ed25519PublicJwk {
28
+ kty: 'OKP';
29
+ crv: 'Ed25519';
30
+ x: string;
31
+ }
32
+ /** The JWS `alg` values the kit accepts for an Ed25519 signature (RFC 8037, RFC 9864). */
33
+ declare const ED25519_JWS_ALGS: readonly ["EdDSA", "Ed25519"];
34
+ type Ed25519JwsAlg = (typeof ED25519_JWS_ALGS)[number];
35
+ /** True for `"EdDSA"` and `"Ed25519"`. */
36
+ declare function isEd25519JwsAlg(alg: unknown): alg is Ed25519JwsAlg;
37
+ interface JwsHeader {
38
+ /** The kit's own artefacts use `EdDSA`; `Ed25519` is allowed for callers that need it. */
39
+ alg: Ed25519JwsAlg;
40
+ typ?: string;
41
+ kid?: string;
42
+ [name: string]: unknown;
43
+ }
44
+ interface DecodedJws {
45
+ header: JsonObject;
46
+ payload: JsonObject;
47
+ signature: Uint8Array;
48
+ /** `<base64url header>.<base64url payload>`, the bytes the signature covers. */
49
+ signingInput: string;
50
+ }
51
+ type JoseErrorCode = 'malformed' | 'unsupported_alg' | 'bad_signature' | 'bad_key';
52
+ declare class JoseError extends CredentialsKitError {
53
+ readonly code: JoseErrorCode;
54
+ constructor(code: JoseErrorCode);
55
+ }
56
+ /** Largest compact JWS `decodeJws` accepts (1 MiB). */
57
+ declare const MAX_JWS_LENGTH: number;
58
+ /**
59
+ * Sign `payload` under exactly `header` (`alg` `"EdDSA"` or `"Ed25519"`). The caller sets `typ`
60
+ * and `kid`; nothing is added implicitly.
61
+ */
62
+ declare function signJws(header: JwsHeader, payload: JsonObject, signer: Pick<Signer, 'sign'>): Promise<string>;
63
+ /**
64
+ * Split and decode a compact JWS without verifying it. Throws `JoseError('malformed')`, also for
65
+ * a header carrying `crit` (no extension is understood).
66
+ */
67
+ declare function decodeJws(compact: string): DecodedJws;
68
+ /** Ed25519 signature check (strict RFC 8032). False for any malformed input. */
69
+ declare function verifyEd25519(signature: Uint8Array, message: Uint8Array, publicKey: Uint8Array): boolean;
70
+ /**
71
+ * Decode and verify a compact JWS with an Ed25519 public key. Requires `alg` `"EdDSA"` or
72
+ * `"Ed25519"`.
73
+ * Returns the decoded JWS; throws `JoseError` (`malformed`, `unsupported_alg`,
74
+ * `bad_signature`). Checks nothing in the payload: callers check `typ`, `exp`, `aud`, ….
75
+ */
76
+ declare function verifyJws(compact: string, publicKey: Uint8Array): Promise<DecodedJws>;
77
+ /** The OKP JWK of a raw 32-byte Ed25519 public key. */
78
+ declare function publicJwkFromRaw(raw: Uint8Array): Ed25519PublicJwk;
79
+ /** The raw 32-byte key of an Ed25519 OKP public JWK. Refuses a private JWK (one with `d`). */
80
+ declare function rawFromPublicJwk(jwk: unknown): Uint8Array;
81
+ /**
82
+ * Longest key strings decoded (SPEC §13.3: cap before decoding; base58 decoding is quadratic).
83
+ * A 34-byte multicodec key is at most 47 base58 characters plus `z`; a bare 32-byte key at most
84
+ * 44; hex is exactly 64; a JWK `x` exactly 43.
85
+ */
86
+ declare const MAX_KEY_STRING_LENGTHS: {
87
+ readonly multibase: 60;
88
+ readonly base58: 50;
89
+ readonly hex: 64;
90
+ readonly jwkX: 43;
91
+ };
92
+ /**
93
+ * A multibase (`z` + base58btc) Ed25519 public key to raw bytes. Accepts the multicodec-prefixed
94
+ * form (`z6Mk…`, as did:key and Ed25519VerificationKey2020) and a bare 32-byte key.
95
+ */
96
+ declare function multibaseToRaw(multibase: string): Uint8Array;
97
+ /** A raw Ed25519 public key as multibase with the ed25519-pub multicodec (`z6Mk…`). */
98
+ declare function rawToMultibase(raw: Uint8Array): string;
99
+ declare const base58btc: {
100
+ readonly encode: typeof base58btcEncode;
101
+ readonly decode: typeof base58btcDecode;
102
+ };
103
+ declare const base64url: {
104
+ readonly encode: typeof base64urlEncode;
105
+ readonly decode: typeof base64urlDecode;
106
+ };
107
+ /** Ed25519 helpers (SPEC §4 names), grouped. Each is also exported on its own. */
108
+ declare const ed25519: {
109
+ readonly publicJwkFromRaw: typeof publicJwkFromRaw;
110
+ readonly rawFromPublicJwk: typeof rawFromPublicJwk;
111
+ readonly base58btc: {
112
+ readonly encode: typeof base58btcEncode;
113
+ readonly decode: typeof base58btcDecode;
114
+ };
115
+ readonly multibaseToRaw: typeof multibaseToRaw;
116
+ readonly rawToMultibase: typeof rawToMultibase;
117
+ readonly verify: typeof verifyEd25519;
118
+ /** The raw 32-byte public key of a 32-byte seed. */
119
+ readonly publicKeyFromSeed: (seed: Uint8Array) => Uint8Array;
120
+ };
121
+ /**
122
+ * A `Signer` for a 32-byte Ed25519 seed (RFC 8032 secret key). The seed stays in the closure;
123
+ * `kid` must be the DID URL under which the matching public key is published.
124
+ */
125
+ declare function signerFromEd25519Seed(seed: Uint8Array, kid: string): Ed25519Signer;
126
+ /**
127
+ * The IXO service-key convention (VFS, kyc-server, UCAN store, Self): seed =
128
+ * SHA-256(UTF-8(mnemonic.trim())). Use with `signerFromEd25519Seed`. This is NOT a BIP-39
129
+ * derivation; wallets that derive keys from a mnemonic differently must use their own.
130
+ */
131
+ declare function ed25519SeedFromMnemonic(mnemonic: string): Uint8Array;
132
+
133
+ export { CredentialsKitError, ED25519_JWS_ALGS, JoseError, JsonObject, MAX_JWS_LENGTH, MAX_KEY_STRING_LENGTHS, base58btc, base64url, decodeJws, ed25519, ed25519SeedFromMnemonic, isEd25519JwsAlg, multibaseToRaw, publicJwkFromRaw, rawFromPublicJwk, rawToMultibase, signJws, signerFromEd25519Seed, verifyEd25519, verifyJws };
134
+ export type { DecodedJws, Ed25519JwsAlg, Ed25519PublicJwk, Ed25519Signer, JoseErrorCode, JwsHeader, Signer };
package/dist/jose.js ADDED
@@ -0,0 +1,4 @@
1
+ export { CredentialsKitError, ED25519_JWS_ALGS, JoseError, MAX_JWS_LENGTH, MAX_KEY_STRING_LENGTHS, base58btc, base64url, decodeJws, ed25519, ed25519SeedFromMnemonic, isEd25519JwsAlg, multibaseToRaw, publicJwkFromRaw, rawFromPublicJwk, rawToMultibase, signJws, signerFromEd25519Seed, verifyEd25519, verifyJws } from './chunk-VXKONZK4.js';
2
+ import './chunk-AQ3IINHC.js';
3
+ //# sourceMappingURL=jose.js.map
4
+ //# sourceMappingURL=jose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"jose.js"}