@macula-io/ts 0.18.0 → 0.20.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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,kEAAkE;AAClE,uEAAuE;AACvE,oEAAoE;AACpE,sEAAsE;AACtE,uBAAuB;AACvB,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,QAAQ;AACR,OAAO,EAAE,MAAM,EAAe,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAiC,MAAM,UAAU,CAAC;AAI7E,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,aAAa,GAId,MAAM,UAAU,CAAC;AAyClB,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C;;;;;;;;;;;;oEAYoE;AACpE,MAAM,UAAU,iBAAiB,CAAC,KAAyB;IACzD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,sEAAsE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACjH,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;AAyBD,MAAM,OAAO,OAAO;IAClB,OAAO,CAAgB;IACvB,gEAAgE;IAChE,oEAAoE;IACpE,oEAAoE;IACpE,2DAA2D;IAC3D,gEAAgE;IAChE,+DAA+D;IAC/D,kEAAkE;IAClE,iEAAiE;IACjE,+DAA+D;IAC/D,SAAS,CAAW;IACpB,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AClB,CAAC;IAED;;;;;;;;;;;;;;;;mEAgB+D;IAC/D,KAAK,CAAC,UAAU,CAAC,IAAY;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,CAAC;QAClF,IAAI,IAAI,KAAK,IAAI;YAAE,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,SAAS,YAAY,CAAC,GAAe;IACnC,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,oDAAoD,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC;AACH,CAAC"}
package/dist/ucan.d.ts DELETED
@@ -1,110 +0,0 @@
1
- import type { Identity } from "./identity.js";
2
- /** One entry in a UCAN token's capability list -- mirrors macula-go's
3
- * ucan.Capability (`with`/`can` json tags) exactly; this module doesn't
4
- * interpret `with`/`can` in any way, it only carries them. */
5
- export interface UcanCapability {
6
- readonly with: string;
7
- readonly can: string;
8
- }
9
- /** Arbitrary JSON value for a UCAN token's `fct` (facts) claim.
10
- * Deliberately DIFFERENT from rpc.ts's JsonValue: a UCAN token's payload
11
- * crosses this boundary as plain JSON (Go's encoding/json) over the
12
- * token's own base64url-encoded JWT body, never macula's CBOR mesh wire
13
- * -- so, unlike an RPC payload, a JSON boolean here is valid and is
14
- * NOT rejected (rpc.ts's "no bool on the wire" rule is about the CBOR
15
- * wire specifically, not about JSON in general). */
16
- export type UcanFactValue = string | number | boolean | null | UcanFactValue[] | {
17
- [key: string]: UcanFactValue;
18
- };
19
- /** Optional claims for Ucan.mint() -- mirrors macula-go's ucan.CreateOpts. */
20
- export interface UcanMintOptions {
21
- /** Unix seconds. Omit for a token with no expiry claim at all (never
22
- * expires, per ucan.IsExpired's own "no exp claim = never expired"
23
- * rule) -- NOT the same as passing an already-past timestamp. */
24
- expiresAt?: number;
25
- /** Unix seconds; the token is not valid before this instant. */
26
- notBefore?: number;
27
- /** An arbitrary nonce string, omitted from the token entirely if left
28
- * unset (matching ucan.CreateOpts.Nonce's own ""-means-absent rule --
29
- * there is no way to mint a token with an explicit empty-string nonce
30
- * claim, since macula-go's own Create() cannot express that either). */
31
- nonce?: string;
32
- /** Arbitrary application-defined facts, carried in the token's `fct`
33
- * claim (Go's `map[string]interface{}`, plain JSON -- see
34
- * UcanFactValue's own doc on why booleans are fine here specifically). */
35
- facts?: Record<string, UcanFactValue>;
36
- /** CIDs (Ucan.token's own ucan.ComputeCID shape) of parent tokens this
37
- * one delegates from. Not computed or validated by this module --
38
- * carried through as opaque strings. */
39
- proofs?: string[];
40
- }
41
- /** A decoded (never verified -- see this module's own doc) UCAN token:
42
- * its raw wire text plus every claim cabi/ucan.go's macula_ucan_decode
43
- * exposes. Both Ucan.mint() and Ucan.decode() return this same shape --
44
- * mint() mints via cabi/ucan.go's macula_ucan_mint, then decodes its own
45
- * freshly-minted token through the identical Decode path Ucan.decode()
46
- * uses, rather than duplicating the claims-JSON shape a second time on
47
- * the Go side. */
48
- export declare class Ucan {
49
- /** The raw token text: "header.payload.signature", base64url,
50
- * dot-joined -- what Session.callWithUcan actually attaches to a CALL,
51
- * and what a real macula peer/station would carry over the wire in a
52
- * `ucan_token` frame field. */
53
- readonly token: string;
54
- /** The `iss` claim -- an opaque DID string (see didFromNodeId's own
55
- * doc: not parsed or resolved by this module, carried through as-is). */
56
- readonly issuer: string;
57
- /** The `aud` claim: for a token Ucan.mint() wrote, the NodeID, as
58
- * lowercase hex, of the caller it is for. A gated provider accepts the
59
- * token only from that caller; this module and Session.callWithUcan
60
- * don't compare it with any local identity (see this module's own
61
- * doc). */
62
- readonly audience: string;
63
- readonly capabilities: readonly UcanCapability[];
64
- /** The `exp` claim, unix seconds, or `null` if this token has none
65
- * (never expires). */
66
- readonly expiresAt: number | null;
67
- /** The `nbf` claim, unix seconds, or `null` if absent. */
68
- readonly notBefore: number | null;
69
- /** The `nnc` claim, or `""` if absent (mirrors ucan.Payload.Nonce's
70
- * own "" -- absent convention; there is no way to distinguish an
71
- * explicit empty-string nonce from a wholly absent one, since
72
- * macula-go's own Decode can't either). */
73
- readonly nonce: string;
74
- /** The `fct` claim, or `null` if absent. */
75
- readonly facts: Readonly<Record<string, UcanFactValue>> | null;
76
- /** The `prf` claim -- CIDs of parent tokens this one delegates from. */
77
- readonly proofs: readonly string[];
78
- private constructor();
79
- /** Whether this token's `exp` claim is in the past. A token with no
80
- * `exp` claim at all (`expiresAt === null`) is never expired --
81
- * mirrors macula-go's `ucan.IsExpired` exactly, including its strict
82
- * `now > exp` comparison (computed here, not cached, so this reflects
83
- * the current instant on every read): a token expiring at exactly this
84
- * second is NOT YET expired. This is purely a local claims check, same
85
- * as `ucan.IsExpired` itself -- it does not verify the token's
86
- * signature (see this module's own doc: verification is out of
87
- * scope). */
88
- get isExpired(): boolean;
89
- /** Mints a fresh UCAN token, self-issued and signed by `issuer`'s own
90
- * private key (macula-go's `ucan.Create`) -- the resulting token
91
- * verifies against `issuer`'s own public key (NodeID), matching
92
- * `ucan.Create`'s documented convention. `iss` is written as
93
- * `did:macula:<hex NodeID>` (`didFromNodeId`) and `aud` as `audience`'s
94
- * lowercase hex (`audienceFromNodeId`), the form a gated provider
95
- * compares with the calling identity: pass the NodeID of the identity
96
- * that will present the token. There is no way to mint with custom
97
- * claim strings through this method.
98
- *
99
- * No network I/O -- this never touches a Session or a station; a
100
- * token can be minted entirely offline given only an `Identity`. */
101
- static mint(issuer: Identity, audience: Uint8Array, capabilities?: UcanCapability[], opts?: UcanMintOptions): Ucan;
102
- /** Decodes `token`'s claims WITHOUT verifying its signature or
103
- * checking expiration (macula-go's `ucan.Decode`) -- `isExpired`
104
- * above is a local claims check only, never use this (or any field on
105
- * the result) for an authorization decision; this module deliberately
106
- * does not expose `ucan.Verify` (see this module's own doc). Throws if
107
- * `token` isn't a well-formed `header.payload.signature` triple or its
108
- * payload isn't valid JSON (mirrors `ucan.ErrInvalidToken`). */
109
- static decode(token: string): Ucan;
110
- }
package/dist/ucan.js DELETED
@@ -1,140 +0,0 @@
1
- // UCAN (User Controlled Authorization Networks) tokens -- macula's
2
- // JWT-shaped capability tokens (header.payload.signature, base64url,
3
- // EdDSA over Ed25519, UCAN spec version "0.10.0" -- the older JWT-based
4
- // draft, NOT the current non-JWT/IPLD UCAN 1.0 spec; see macula-go's
5
- // ucan/ucan.go for why: no existing library implements 0.10.0, so
6
- // macula-go hand-rolls it to match the Erlang reference SDK and its Rust
7
- // NIF exactly). Minting (Ucan.mint) and decoding/inspecting (Ucan.decode)
8
- // are both pure local operations -- no network I/O, no station involved
9
- // -- reached through cabi/ucan.go's macula_ucan_mint/macula_ucan_decode.
10
- // Session.callWithUcan (session.ts) attaches a minted token to an
11
- // outgoing CALL, for invoking a procedure a provider has gated behind a
12
- // ucan.Policy.Required policy on its own side (macula-go's
13
- // connection.Session.CallWithUCAN).
14
- //
15
- // This module deliberately does NOT expose verification or
16
- // gate-enforcement -- macula-go's ucan.Verify and ucan.Policy (serving a
17
- // procedure gated behind a required issuer) are provider-side concerns,
18
- // out of scope for this slice. See README.md's "What's explicitly not
19
- // yet implemented" section.
20
- //
21
- // A provider gated with ucan.Required accepts a token only when it
22
- // verifies against the required issuer and its `aud` claim is the calling
23
- // identity's NodeID as lowercase hex. Ucan.mint() writes `audience` in
24
- // that form, so mint a token for the identity that will present it; any
25
- // 32-byte NodeID is accepted as the audience, related to the minting
26
- // identity or not. Session.callWithUcan (session.ts) attaches whatever
27
- // token it is given and leaves the check to the provider.
28
- import { native } from "./binding.js";
29
- /** The `iss` claim this module writes for a NodeID:
30
- * "did:macula:<lowercase hex NodeID>". macula-go's ucan package never
31
- * parses or resolves it (that's macula_did_nif's job on the Erlang
32
- * reference, out of scope for both SDKs) -- the cryptographic check a
33
- * relying party performs is keyed by a raw public key it already has out
34
- * of band (ucan.Verify's own `publicKey []byte` parameter,
35
- * ucan/policy.go's `Required(issuerPublicKey []byte)`), never by parsing
36
- * this string. */
37
- function didFromNodeId(nodeId) {
38
- return `did:macula:${Buffer.from(nodeId).toString("hex")}`;
39
- }
40
- /** The `aud` claim this module writes for a NodeID: its lowercase hex,
41
- * the form a gated provider compares with the calling identity
42
- * (macula-go's ucan.Policy.Check). */
43
- function audienceFromNodeId(nodeId) {
44
- return Buffer.from(nodeId).toString("hex");
45
- }
46
- /** A decoded (never verified -- see this module's own doc) UCAN token:
47
- * its raw wire text plus every claim cabi/ucan.go's macula_ucan_decode
48
- * exposes. Both Ucan.mint() and Ucan.decode() return this same shape --
49
- * mint() mints via cabi/ucan.go's macula_ucan_mint, then decodes its own
50
- * freshly-minted token through the identical Decode path Ucan.decode()
51
- * uses, rather than duplicating the claims-JSON shape a second time on
52
- * the Go side. */
53
- export class Ucan {
54
- /** The raw token text: "header.payload.signature", base64url,
55
- * dot-joined -- what Session.callWithUcan actually attaches to a CALL,
56
- * and what a real macula peer/station would carry over the wire in a
57
- * `ucan_token` frame field. */
58
- token;
59
- /** The `iss` claim -- an opaque DID string (see didFromNodeId's own
60
- * doc: not parsed or resolved by this module, carried through as-is). */
61
- issuer;
62
- /** The `aud` claim: for a token Ucan.mint() wrote, the NodeID, as
63
- * lowercase hex, of the caller it is for. A gated provider accepts the
64
- * token only from that caller; this module and Session.callWithUcan
65
- * don't compare it with any local identity (see this module's own
66
- * doc). */
67
- audience;
68
- capabilities;
69
- /** The `exp` claim, unix seconds, or `null` if this token has none
70
- * (never expires). */
71
- expiresAt;
72
- /** The `nbf` claim, unix seconds, or `null` if absent. */
73
- notBefore;
74
- /** The `nnc` claim, or `""` if absent (mirrors ucan.Payload.Nonce's
75
- * own "" -- absent convention; there is no way to distinguish an
76
- * explicit empty-string nonce from a wholly absent one, since
77
- * macula-go's own Decode can't either). */
78
- nonce;
79
- /** The `fct` claim, or `null` if absent. */
80
- facts;
81
- /** The `prf` claim -- CIDs of parent tokens this one delegates from. */
82
- proofs;
83
- constructor(token, payload) {
84
- this.token = token;
85
- this.issuer = payload.issuer;
86
- this.audience = payload.audience;
87
- this.capabilities = payload.capabilities;
88
- this.expiresAt = payload.expiresAt;
89
- this.notBefore = payload.notBefore;
90
- this.nonce = payload.nonce;
91
- this.facts = payload.facts;
92
- this.proofs = payload.proofs;
93
- }
94
- /** Whether this token's `exp` claim is in the past. A token with no
95
- * `exp` claim at all (`expiresAt === null`) is never expired --
96
- * mirrors macula-go's `ucan.IsExpired` exactly, including its strict
97
- * `now > exp` comparison (computed here, not cached, so this reflects
98
- * the current instant on every read): a token expiring at exactly this
99
- * second is NOT YET expired. This is purely a local claims check, same
100
- * as `ucan.IsExpired` itself -- it does not verify the token's
101
- * signature (see this module's own doc: verification is out of
102
- * scope). */
103
- get isExpired() {
104
- if (this.expiresAt === null)
105
- return false;
106
- return Math.floor(Date.now() / 1000) > this.expiresAt;
107
- }
108
- /** Mints a fresh UCAN token, self-issued and signed by `issuer`'s own
109
- * private key (macula-go's `ucan.Create`) -- the resulting token
110
- * verifies against `issuer`'s own public key (NodeID), matching
111
- * `ucan.Create`'s documented convention. `iss` is written as
112
- * `did:macula:<hex NodeID>` (`didFromNodeId`) and `aud` as `audience`'s
113
- * lowercase hex (`audienceFromNodeId`), the form a gated provider
114
- * compares with the calling identity: pass the NodeID of the identity
115
- * that will present the token. There is no way to mint with custom
116
- * claim strings through this method.
117
- *
118
- * No network I/O -- this never touches a Session or a station; a
119
- * token can be minted entirely offline given only an `Identity`. */
120
- static mint(issuer, audience, capabilities = [], opts = {}) {
121
- if (audience.length !== 32) {
122
- throw new Error(`macula-ts: UCAN audience NodeID must be exactly 32 bytes, got ${audience.length}`);
123
- }
124
- const token = native.ucanMint(issuer.handleForFfi(), didFromNodeId(issuer.nodeId), audienceFromNodeId(audience), JSON.stringify(capabilities ?? []), opts.expiresAt, opts.notBefore, opts.nonce ?? "", opts.facts !== undefined ? JSON.stringify(opts.facts) : undefined, opts.proofs !== undefined ? JSON.stringify(opts.proofs) : undefined);
125
- return Ucan.decode(token);
126
- }
127
- /** Decodes `token`'s claims WITHOUT verifying its signature or
128
- * checking expiration (macula-go's `ucan.Decode`) -- `isExpired`
129
- * above is a local claims check only, never use this (or any field on
130
- * the result) for an authorization decision; this module deliberately
131
- * does not expose `ucan.Verify` (see this module's own doc). Throws if
132
- * `token` isn't a well-formed `header.payload.signature` triple or its
133
- * payload isn't valid JSON (mirrors `ucan.ErrInvalidToken`). */
134
- static decode(token) {
135
- const json = native.ucanDecode(token);
136
- const payload = JSON.parse(json);
137
- return new Ucan(token, payload);
138
- }
139
- }
140
- //# sourceMappingURL=ucan.js.map
package/dist/ucan.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ucan.js","sourceRoot":"","sources":["../src/ucan.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qEAAqE;AACrE,wEAAwE;AACxE,qEAAqE;AACrE,kEAAkE;AAClE,yEAAyE;AACzE,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,kEAAkE;AAClE,wEAAwE;AACxE,2DAA2D;AAC3D,oCAAoC;AACpC,EAAE;AACF,2DAA2D;AAC3D,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AACtE,4BAA4B;AAC5B,EAAE;AACF,mEAAmE;AACnE,0EAA0E;AAC1E,uEAAuE;AACvE,wEAAwE;AACxE,qEAAqE;AACrE,uEAAuE;AACvE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AA2DtC;;;;;;;kBAOkB;AAClB,SAAS,aAAa,CAAC,MAAkB;IACvC,OAAO,cAAc,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED;;sCAEsC;AACtC,SAAS,kBAAkB,CAAC,MAAkB;IAC5C,OAA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