@distilled.cloud/acme 1.0.0-rc.16 → 1.0.0-rc.18

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.
@@ -0,0 +1,2 @@
1
+ import{i as e}from"../_chunks/_distilled-core_errors-CS3jP5s-.js";import{config$Redacted as t,config$String as n,config$all as r,config$option as i,config$withDefault as a}from"@distilled.cloud/core/_bundle/base";import*as o from"effect/Context";import*as s from"effect/Effect";import*as c from"effect/Layer";import*as l from"effect/Option";import"effect/Redacted";var u=Object.defineProperty;var __exportAll=(e,t)=>{let n={};for(var r in e){u(n,r,{get:e[r],enumerable:true})}if(!t){u(n,Symbol.toStringTag,{value:`Module`})}return n};const d={LetsEncrypt:`https://acme-v02.api.letsencrypt.org/directory`,LetsEncryptStaging:`https://acme-staging-v02.api.letsencrypt.org/directory`,ZeroSSL:`https://acme.zerossl.com/v2/DV90`,GoogleTrustServices:`https://dv.acme-v02.api.pki.goog/directory`,GoogleTrustServicesStaging:`https://dv.acme-v02.test-api.pki.goog/directory`};var Credentials=class extends (/*@__PURE__*/ o.Service()(`AcmeCredentials`)){};const f=/*@__PURE__*/ c.succeed(Credentials,/*@__PURE__*/ r({directoryUrl:/*@__PURE__*/ n(`ACME_DIRECTORY_URL`).pipe(/*@__PURE__*/ a(d.LetsEncrypt)),accountKey:/*@__PURE__*/ t(`ACME_ACCOUNT_KEY`),accountUrl:/*@__PURE__*/ i(/*@__PURE__*/ n(`ACME_ACCOUNT_URL`)),eabKid:/*@__PURE__*/ i(/*@__PURE__*/ n(`ACME_EAB_KID`)),eabHmac:/*@__PURE__*/ i(/*@__PURE__*/ t(`ACME_EAB_HMAC_KEY`))}).pipe(/*@__PURE__*/ s.mapError(()=>new e({message:`ACME_ACCOUNT_KEY (a private JWK) is required; ACME_DIRECTORY_URL, ACME_ACCOUNT_URL, ACME_EAB_KID and ACME_EAB_HMAC_KEY are optional`})),/*@__PURE__*/ s.map(({directoryUrl:e,accountKey:t,accountUrl:n,eabKid:r,eabHmac:i})=>({directoryUrl:e,accountKey:t,accountUrl:l.getOrUndefined(n),externalAccountBinding:l.isSome(r)&&l.isSome(i)?{keyId:r.value,hmacKey:i.value}:void 0}))));const layer=e=>c.succeed(Credentials,s.isEffect(e)?e:s.succeed(e));export{Credentials as credentials$Credentials,f as credentials$CredentialsFromEnv,d as credentials$Directories,layer as credentials$layer,__exportAll as t};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["ConfigError","ConfigError$1","Redacted","String","all","option","withDefault","Context","Effect","Layer","Option","__defProp","target","name","no_symbols","Directories","CredentialsFromEnv","accountUrl","eabKid","eabHmac","config"],"sources":["../../src/credentials.ts"],"mappings":"shBAsBA,MAAae,EAAc,CACzB,YAAa,iDACb,mBAAoB,yDACpB,QAAS,mCACT,oBAAqB,6CACrB,2BAA4B,iDAC9B,EA0BA,IAAa,YAAb,eACwB,gBAAQ,QAAyD,CAAC,CACtF,iBACF,EAAA,AAAE,CAAC,EAUL,MAAaC,EAAmC,gBAAM,QACpD,YACc,gBAAiB,CAC7B,aAA4B,gBAAoB,oBAAoB,CAAC,CAAC,KACtD,gBAAyBD,EAAY,WAAW,CAChE,EACA,WAA0B,gBAAsB,kBAAkB,EAClE,WAA0B,gBACV,gBAAoB,kBAAkB,CACtD,EACA,OAAsB,gBAAkC,gBAAoB,cAAc,CAAC,EAC3F,QAAuB,gBACP,gBAAsB,mBAAmB,CACzD,CACF,CAAC,CAAC,CAAC,KACa,gBAAO,aAEjB,IAAIf,EAAY,CACd,QACE,qIACJ,CAAC,CACL,EACc,gBAAO,KAClB,CAAE,eAAc,aAAY,aAAY,SAAQ,cAAuB,CACtE,eACA,aACA,WAAYU,EAAO,eAAeO,CAAU,EAC5C,uBACEP,EAAO,OAAOQ,CAAM,GAAKR,EAAO,OAAOS,CAAO,EAC1C,CAAE,MAAOD,EAAO,MAAO,QAASC,EAAQ,KAAM,EAC9C,IAAA,EACR,EACF,CACF,CACF,EAGA,MAAa,MAAS,GACpBV,EAAM,QAAQ,YAAaD,EAAO,SAASY,CAAM,EAAIA,EAASZ,EAAO,QAAQY,CAAM,CAAC"}
@@ -0,0 +1 @@
1
+ import{errors$API_ERRORS as e,errors$BadGateway as t,errors$BadRequest as n,errors$ConfigError as r,errors$Conflict as i,errors$DEFAULT_ERRORS as a,errors$Forbidden as o,errors$GatewayTimeout as s,errors$HTTP_STATUS_MAP as c,errors$InternalServerError as l,errors$Locked as u,errors$NotFound as d,errors$ServiceUnavailable as f,errors$TooManyRequests as p,errors$Unauthorized as m,errors$UnprocessableEntity as h}from"@distilled.cloud/core/_bundle/rest";export{i as a,s as c,u as d,d as f,h as g,m as h,r as i,c as l,p as m,t as n,a as o,f as p,n as r,o as s,e as t,l as u};
@@ -0,0 +1 @@
1
+ import{trait$Body as e,trait$FormDataFile as t,trait$Header as n,trait$Http as r,trait$HttpBody as i,trait$KeyDictionary as a,trait$Label as o,trait$Query as s,trait$ResponseCode as c,trait$UnionCases as l,trait$applyErrorMatchers as u,trait$bodySymbol as d,trait$errorMatchersSymbol as f,trait$formDataFileSymbol as p,trait$getErrorMatchers as m,trait$headerSymbol as h,trait$httpBodySymbol as g,trait$httpSymbol as _,trait$keyDictionarySymbol as v,trait$labelSymbol as y,trait$querySymbol as b,trait$responseCodeSymbol as x,trait$unionCasesSymbol as S}from"@distilled.cloud/core/_bundle/base";import{protocol_rest$RawResponse as C,protocol_rest$RawResponseRoot as w,protocol_rest$SensitiveValue as T,protocol_rest$rawResponseRootSymbol as E,protocol_rest$rawResponseSymbol as D,protocol_rest$sensitiveValueSymbol as O,protocol_rest$unwrapRedactedDeep as k}from"@distilled.cloud/core/_bundle/rest";export{k as A,S as C,E as D,T as E,D as O,x as S,w as T,g as _,i as a,y as b,s as c,u as d,d as f,h as g,m as h,r as i,O as k,c as l,p as m,t as n,a as o,f as p,n as r,o as s,e as t,l as u,_ as v,C as w,b as x,v as y};
@@ -1,3 +1,17 @@
1
+ /**
2
+ * ACME credentials -- hand-written.
3
+ *
4
+ * An ACME "credential" is the **account key**: a private JWK that signs
5
+ * every request. The CA is addressed by its **directory URL** (Let's
6
+ * Encrypt, ZeroSSL, Google Trust Services and Pebble differ only there),
7
+ * plus, for CAs that require it, an **External Account Binding** (key id +
8
+ * HMAC key from the CA's dashboard) presented once on `newAccount`.
9
+ *
10
+ * The `Credentials` service holds an *effect* that resolves the current
11
+ * credentials, so the protocol picks up a rotated key or a newly learned
12
+ * account URL per request.
13
+ */
14
+ import { ConfigError } from "@distilled.cloud/core/errors";
1
15
  import * as Context from "effect/Context";
2
16
  import * as Effect from "effect/Effect";
3
17
  import * as Layer from "effect/Layer";
@@ -32,7 +46,7 @@ export interface Config {
32
46
  /** EAB for CAs that require it (ZeroSSL, Google Trust Services). */
33
47
  readonly externalAccountBinding?: ExternalAccountBinding | undefined;
34
48
  }
35
- declare const Credentials_base: Context.ServiceClass<Credentials, "AcmeCredentials", Effect.Effect<Config, never, never>>;
49
+ declare const Credentials_base: Context.ServiceClass<Credentials, "AcmeCredentials", Effect.Effect<Config, ConfigError, never>>;
36
50
  export declare class Credentials extends /*@__PURE__*/ Credentials_base {
37
51
  }
38
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,mCAAmC;AACnC,eAAO,MAAM,WAAW;aACtB,WAAW,EAAE,gDAAgD;aAC7D,kBAAkB,EAAE,wDAAwD;aAC5E,OAAO,EAAE,kCAAkC;aAC3C,mBAAmB,EAAE,4CAA4C;aACjE,0BAA0B,EAAE,iDAAiD;CACrE,CAAC;AAEX,MAAM,WAAW,s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AC;AAEX,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,MAAM;IACrB,8BAA8B;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/C;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,oEAAoE;IACpE,QAAQ,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;CACtE;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAEN;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,wCAkC9B,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,KAAK,WAAY,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,2CAC2B,CAAC"}
@@ -1,63 +1 @@
1
- import * as EffectConfig from "@distilled.cloud/core/config";
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
- import { ConfigError } from "@distilled.cloud/core/errors";
16
- import * as Context from "effect/Context";
17
- import * as Effect from "effect/Effect";
18
- import * as Layer from "effect/Layer";
19
- import * as Option from "effect/Option";
20
- import * as Redacted from "effect/Redacted";
21
-
22
- export const Directories = {
23
- LetsEncrypt: "https://acme-v02.api.letsencrypt.org/directory",
24
- LetsEncryptStaging: "https://acme-staging-v02.api.letsencrypt.org/directory",
25
- ZeroSSL: "https://acme.zerossl.com/v2/DV90",
26
- GoogleTrustServices: "https://dv.acme-v02.api.pki.goog/directory",
27
- GoogleTrustServicesStaging: "https://dv.acme-v02.test-api.pki.goog/directory",
28
- };
29
- export class Credentials extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("AcmeCredentials") {
30
- }
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(Credentials,
40
- /*@__PURE__*/ EffectConfig.all({
41
- directoryUrl: /*@__PURE__*/ EffectConfig.String("ACME_DIRECTORY_URL").pipe(
42
- /*@__PURE__*/ EffectConfig.withDefault(Directories.LetsEncrypt)),
43
- accountKey: /*@__PURE__*/ EffectConfig.Redacted("ACME_ACCOUNT_KEY"),
44
- accountUrl: /*@__PURE__*/ EffectConfig.option(
45
- /*@__PURE__*/ EffectConfig.String("ACME_ACCOUNT_URL")),
46
- eabKid: /*@__PURE__*/ EffectConfig.option(/*@__PURE__*/ EffectConfig.String("ACME_EAB_KID")),
47
- eabHmac: /*@__PURE__*/ EffectConfig.option(
48
- /*@__PURE__*/ EffectConfig.Redacted("ACME_EAB_HMAC_KEY")),
49
- }).pipe(
50
- /*@__PURE__*/ Effect.mapError(() => new ConfigError({
51
- message: "ACME_ACCOUNT_KEY (a private JWK) is required; ACME_DIRECTORY_URL, ACME_ACCOUNT_URL, ACME_EAB_KID and ACME_EAB_HMAC_KEY are optional",
52
- })),
53
- /*@__PURE__*/ Effect.map(({ directoryUrl, accountKey, accountUrl, eabKid, eabHmac }) => ({
54
- directoryUrl,
55
- accountKey,
56
- accountUrl: Option.getOrUndefined(accountUrl),
57
- externalAccountBinding: Option.isSome(eabKid) && Option.isSome(eabHmac)
58
- ? { keyId: eabKid.value, hmacKey: eabHmac.value }
59
- : undefined,
60
- })), Effect.orDie));
61
-
62
- export const layer = (config) => Layer.succeed(Credentials, Effect.isEffect(config) ? config : Effect.succeed(config));
63
- //# sourceMappingURL=credentials.js.map
1
+ export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$Directories as Directories, credentials$layer as layer } from "./_bundle/sdk.js";
package/lib/errors.js CHANGED
@@ -1,50 +1,2 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
- export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
12
- import * as Category from "@distilled.cloud/core/category";
13
- import * as Schema from "@distilled.cloud/core/schema-lite-typed";
14
-
15
-
16
-
17
-
18
-
19
- export class UnknownAcmeError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("UnknownAcmeError", {
20
-
21
- type: /*@__PURE__*/ Schema.optional(Schema.String),
22
- message: /*@__PURE__*/ Schema.optional(Schema.String),
23
- status: /*@__PURE__*/ Schema.optional(Schema.Number),
24
- detail: /*@__PURE__*/ Schema.optional(Schema.String),
25
- subproblems: /*@__PURE__*/ Schema.optional(/*@__PURE__*/ Schema.Array(Schema.Unknown)),
26
- body: Schema.Unknown,
27
- }) {
28
- }
29
-
30
- export class AcmeParseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("AcmeParseError", {
31
- body: Schema.Unknown,
32
- cause: Schema.Unknown,
33
- }).pipe(Category.withParseError) {
34
- }
35
-
36
- export class JoseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("JoseError", {
37
- message: Schema.String,
38
- cause: /*@__PURE__*/ Schema.optional(Schema.Unknown),
39
- }).pipe(Category.withBadRequestError) {
40
- }
41
-
42
-
43
-
44
-
45
- export class DirectoryMissingResource extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("DirectoryMissingResource", {
46
- resource: Schema.String,
47
- directoryUrl: Schema.String,
48
- }).pipe(Category.withBadRequestError) {
49
- }
1
+ import{a as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./_chunks/_distilled-core_errors-CS3jP5s-.js";import{category$withBadRequestError as g,category$withParseError as _,category$withRetryableError as v,category$withThrottlingError as y,schema_lite_typed$Array as b,schema_lite_typed$Number as x,schema_lite_typed$String as S,schema_lite_typed$TaggedError as C,schema_lite_typed$Unknown as w,schema_lite_typed$optional as T}from"@distilled.cloud/core/_bundle/base";var UnknownAcmeError=class extends (/*@__PURE__*/ C()(`UnknownAcmeError`,{type:/*@__PURE__*/ T(S),message:/*@__PURE__*/ T(S),status:/*@__PURE__*/ T(x),detail:/*@__PURE__*/ T(S),subproblems:/*@__PURE__*/ T(/*@__PURE__*/ b(w)),body:w})){};var AcmeParseError=class extends (/*@__PURE__*/ C()(`AcmeParseError`,{body:w,cause:w}).pipe(_)){};var JoseError=class extends (/*@__PURE__*/ C()(`JoseError`,{message:S,cause:/*@__PURE__*/ T(w)}).pipe(g)){};var DirectoryMissingResource=class extends (/*@__PURE__*/ C()(`DirectoryMissingResource`,{resource:S,directoryUrl:S}).pipe(g)){};export{m as API_ERRORS,AcmeParseError,l as BadGateway,f as BadRequest,o as ConfigError,e as Conflict,u as DEFAULT_ERRORS,DirectoryMissingResource,p as Forbidden,t as GatewayTimeout,s as HTTP_STATUS_MAP,h as InternalServerError,JoseError,n as Locked,r as NotFound,d as ServiceUnavailable,c as TooManyRequests,a as Unauthorized,UnknownAcmeError,i as UnprocessableEntity,y as n,v as t};
50
2
  //# sourceMappingURL=errors.js.map
package/lib/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,QAA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G;AAE1C;;;GAGG;AACH,MAAM,OAAO,wBACX,SAAQ,aAAa,CAAb,aAAa,CAAC,MAAM,CAAC,WAAW,EAA4B,CAAC,0BAA0B,EAAE;IAC/F,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM;CAC5B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CAAG"}
1
+ {"version":3,"file":"errors.js","names":["Schema.String","Schema.Number","Schema.Unknown","Category.withParseError","Category.withBadRequestError","Conflict","GatewayTimeout","Locked","NotFound","UnprocessableEntity","Unauthorized","ConfigError","HTTP_STATUS_MAP","TooManyRequests","BadGateway","DEFAULT_ERRORS","ServiceUnavailable","BadRequest","Forbidden","API_ERRORS","InternalServerError","withBadRequestError","withParseError","withRetryableError","withThrottlingError","Array","Number","String","TaggedError","Unknown","optional"],"sources":["../src/errors.ts"],"mappings":"uhBA2CA,IAAa,iBAAb,eACwB,gBAAqC,CAAC,CAAC,mBAAoB,CAE/E,KAAoB,gBAAgBA,CAAa,EACjD,QAAuB,gBAAgBA,CAAa,EACpD,OAAsB,gBAAgBC,CAAa,EACnD,OAAsB,gBAAgBD,CAAa,EACnD,YAA2B,gBAA8B,gBAAaE,CAAc,CAAC,EACrF,KAAMA,CACR,CAAC,EAAA,AAAE,CAAC,EAGN,IAAa,eAAb,eACwB,gBAAmC,CAAC,CAAC,iBAAkB,CAC3E,KAAMA,EACN,MAAOA,CACT,CAAC,CAAC,CAAC,KAAKC,CAAuB,EAAA,AAAE,CAAC,EAGpC,IAAa,UAAb,eACwB,gBAA8B,CAAC,CAAC,YAAa,CACjE,QAASH,EACT,MAAqB,gBAAgBE,CAAc,CACrD,CAAC,CAAC,CAAC,KAAKE,CAA4B,EAAA,AAAE,CAAC,EAMzC,IAAa,yBAAb,eACwB,gBAA6C,CAAC,CAAC,2BAA4B,CAC/F,SAAUJ,EACV,aAAcA,CAChB,CAAC,CAAC,CAAC,KAAKI,CAA4B,EAAA,AAAE,CAAC"}
package/lib/index.js CHANGED
@@ -1,25 +1,3 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
1
  export * from "./credentials.js";
24
2
  export * from "./errors.js";
25
3
  export * as Jose from "./jose.js";
@@ -27,4 +5,3 @@ export * as T from "./traits.js";
27
5
  export * as Retry from "./retry.js";
28
6
  export { AcmeProtocol } from "./protocol.js";
29
7
  export * from "./services/index.js";
30
- //# sourceMappingURL=index.js.map
package/lib/jose.js CHANGED
@@ -1,121 +1,2 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
- import * as Effect from "effect/Effect";
10
- import * as Redacted from "effect/Redacted";
11
- import { JoseError } from "./errors.js";
12
- const encoder = /*@__PURE__*/ new TextEncoder();
13
- export const base64url = (bytes) => {
14
- const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
15
- let binary = "";
16
- for (const byte of view)
17
- binary += String.fromCharCode(byte);
18
- return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
19
- };
20
- export const base64urlDecode = (text) => {
21
- const padded = text.replaceAll("-", "+").replaceAll("_", "/");
22
- const binary = atob(padded + "=".repeat((4 - (padded.length % 4)) % 4));
23
- const out = new Uint8Array(binary.length);
24
- for (let i = 0; i < binary.length; i++)
25
- out[i] = binary.charCodeAt(i);
26
- return out;
27
- };
28
- const base64urlJson = (value) => base64url(encoder.encode(JSON.stringify(value)));
29
- const sha256 = (data) => Effect.promise(async () => {
30
- const bytes = typeof data === "string" ? encoder.encode(data) : data;
31
- return new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
32
- });
33
-
34
- export const algorithmOf = (jwk) => (jwk.kty === "RSA" ? "RS256" : "ES256");
35
- const importAlgorithm = (alg) => alg === "RS256"
36
- ? { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" }
37
- : { name: "ECDSA", namedCurve: "P-256" };
38
- const signAlgorithm = (alg) => alg === "RS256" ? { name: "RSASSA-PKCS1-v1_5" } : { name: "ECDSA", hash: "SHA-256" };
39
-
40
- export const generateAccountKey = (alg = "ES256") => Effect.promise(async () => {
41
- const pair = await crypto.subtle.generateKey(alg === "RS256"
42
- ? {
43
- name: "RSASSA-PKCS1-v1_5",
44
- modulusLength: 2048,
45
- publicExponent: new Uint8Array([1, 0, 1]),
46
- hash: "SHA-256",
47
- }
48
- : { name: "ECDSA", namedCurve: "P-256" }, true, ["sign", "verify"]);
49
- const jwk = await crypto.subtle.exportKey("jwk", pair.privateKey);
50
- return Redacted.make(JSON.stringify(jwk));
51
- });
52
-
53
- export const parseJwk = (key) => Effect.try({
54
- try: () => JSON.parse(Redacted.isRedacted(key) ? Redacted.value(key) : key),
55
- catch: (cause) => new JoseError({
56
- message: "The account key is not a JSON Web Key.",
57
- cause,
58
- }),
59
- });
60
-
61
- export const publicJwk = (jwk) => jwk.kty === "RSA"
62
- ? { e: jwk.e, kty: "RSA", n: jwk.n }
63
- : { crv: jwk.crv, kty: "EC", x: jwk.x, y: jwk.y };
64
-
65
- export const thumbprint = (jwk) => sha256(JSON.stringify(publicJwk(jwk))).pipe(Effect.map(base64url));
66
-
67
- export const keyAuthorization = (token, jwk) => thumbprint(jwk).pipe(Effect.map((print) => `${token}.${print}`));
68
-
69
- export const dnsChallengeValue = (token, jwk) => keyAuthorization(token, jwk).pipe(Effect.flatMap(sha256), Effect.map(base64url));
70
-
71
- export const signRequest = (options) => Effect.tryPromise({
72
- try: async () => {
73
- const alg = algorithmOf(options.jwk);
74
- const header = {
75
- alg,
76
- nonce: options.nonce,
77
- url: options.url,
78
- ...(options.kid !== undefined ? { kid: options.kid } : { jwk: publicJwk(options.jwk) }),
79
- };
80
- const protectedB64 = base64urlJson(header);
81
- const payloadB64 = options.payload === undefined ? "" : base64urlJson(options.payload);
82
- const key = await crypto.subtle.importKey("jwk", options.jwk, importAlgorithm(alg), false, ["sign"]);
83
- const signature = await crypto.subtle.sign(signAlgorithm(alg), key, encoder.encode(`${protectedB64}.${payloadB64}`));
84
- return {
85
- protected: protectedB64,
86
- payload: payloadB64,
87
- signature: base64url(signature),
88
- };
89
- },
90
- catch: (cause) => new JoseError({ message: "Signing the ACME request failed.", cause }),
91
- });
92
-
93
-
94
-
95
-
96
-
97
- export const signExternalAccountBinding = (options) => Effect.tryPromise({
98
- try: async () => {
99
- const raw = Redacted.isRedacted(options.hmacKey)
100
- ? Redacted.value(options.hmacKey)
101
- : options.hmacKey;
102
- const key = await crypto.subtle.importKey("raw", base64urlDecode(raw), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
103
- const protectedB64 = base64urlJson({
104
- alg: "HS256",
105
- kid: options.keyId,
106
- url: options.url,
107
- });
108
- const payloadB64 = base64urlJson(publicJwk(options.jwk));
109
- const signature = await crypto.subtle.sign("HMAC", key, encoder.encode(`${protectedB64}.${payloadB64}`));
110
- return {
111
- protected: protectedB64,
112
- payload: payloadB64,
113
- signature: base64url(signature),
114
- };
115
- },
116
- catch: (cause) => new JoseError({
117
- message: "Signing the External Account Binding failed.",
118
- cause,
119
- }),
120
- });
1
+ import{JoseError as e}from"./errors.js";import*as t from"effect/Effect";import*as n from"effect/Redacted";const r=/*@__PURE__*/ new TextEncoder;const base64url=e=>{const t=e instanceof Uint8Array?e:new Uint8Array(e);let n=``;for(const e of t)n+=String.fromCharCode(e);return btoa(n).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)};const base64urlDecode=e=>{const t=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`);const n=atob(t+`=`.repeat((4-t.length%4)%4));const r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r};const base64urlJson=e=>base64url(r.encode(JSON.stringify(e)));const sha256=e=>t.promise(async()=>{const t=typeof e===`string`?r.encode(e):e;return new Uint8Array(await crypto.subtle.digest(`SHA-256`,t))});const algorithmOf=e=>e.kty===`RSA`?`RS256`:`ES256`;const importAlgorithm=e=>e===`RS256`?{name:`RSASSA-PKCS1-v1_5`,hash:`SHA-256`}:{name:`ECDSA`,namedCurve:`P-256`};const signAlgorithm=e=>e===`RS256`?{name:`RSASSA-PKCS1-v1_5`}:{name:`ECDSA`,hash:`SHA-256`};const generateAccountKey=(e=`ES256`)=>t.promise(async()=>{const t=await crypto.subtle.generateKey(e===`RS256`?{name:`RSASSA-PKCS1-v1_5`,modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:`SHA-256`}:{name:`ECDSA`,namedCurve:`P-256`},true,[`sign`,`verify`]);const r=await crypto.subtle.exportKey(`jwk`,t.privateKey);return n.make(JSON.stringify(r))});const parseJwk=r=>t.try({try:()=>JSON.parse(n.isRedacted(r)?n.value(r):r),catch:t=>new e({message:`The account key is not a JSON Web Key.`,cause:t})});const publicJwk=e=>e.kty===`RSA`?{e:e.e,kty:`RSA`,n:e.n}:{crv:e.crv,kty:`EC`,x:e.x,y:e.y};const thumbprint=e=>sha256(JSON.stringify(publicJwk(e))).pipe(t.map(base64url));const keyAuthorization=(e,n)=>thumbprint(n).pipe(t.map(t=>`${e}.${t}`));const dnsChallengeValue=(e,n)=>keyAuthorization(e,n).pipe(t.flatMap(sha256),t.map(base64url));const signRequest=n=>t.tryPromise({try:async()=>{const e=algorithmOf(n.jwk);const t={alg:e,nonce:n.nonce,url:n.url,...n.kid!==void 0?{kid:n.kid}:{jwk:publicJwk(n.jwk)}};const i=base64urlJson(t);const a=n.payload===void 0?``:base64urlJson(n.payload);const o=await crypto.subtle.importKey(`jwk`,n.jwk,importAlgorithm(e),false,[`sign`]);const s=await crypto.subtle.sign(signAlgorithm(e),o,r.encode(`${i}.${a}`));return{protected:i,payload:a,signature:base64url(s)}},catch:t=>new e({message:`Signing the ACME request failed.`,cause:t})});const signExternalAccountBinding=i=>t.tryPromise({try:async()=>{const e=n.isRedacted(i.hmacKey)?n.value(i.hmacKey):i.hmacKey;const t=await crypto.subtle.importKey(`raw`,base64urlDecode(e),{name:`HMAC`,hash:`SHA-256`},false,[`sign`]);const a=base64urlJson({alg:`HS256`,kid:i.keyId,url:i.url});const o=base64urlJson(publicJwk(i.jwk));const s=await crypto.subtle.sign(`HMAC`,t,r.encode(`${a}.${o}`));return{protected:a,payload:o,signature:base64url(s)}},catch:t=>new e({message:`Signing the External Account Binding failed.`,cause:t})});export{algorithmOf,base64url,base64urlDecode,dnsChallengeValue,generateAccountKey,keyAuthorization,parseJwk,publicJwk,signExternalAccountBinding,signRequest,thumbprint};
121
2
  //# sourceMappingURL=jose.js.map
package/lib/jose.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"jose.js","sourceRoot":"","sources":["../src/jose.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAexC,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,WAAW,EAAE,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAA+B,EAAU,EAAE;IACnE,MAAM,IAAI,GAAG,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACzE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,IAAI;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAc,EAA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EACH,OAAO,CAAC,MAAM,CAAC,GAAG,YAAY,IAAI,UAAU,EAAE,CAAC,CAChD,CAAC;QACF,OAAO;YACL,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC;SAChC,CAAC;IACJ,CAAC;IACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,SAAS,CAAC;QACZ,OAAO,EAAE,8CAA8C;QACvD,KAAK;KACN,CAAC;CACL,CAAC,CAAC"}
1
+ {"version":3,"file":"jose.js","names":["Effect","Redacted","encoder","view","bytes","binary","byte","padded","text","out","i","value","data","jwk","alg","pair","key","JoseError","token","print","options","header","protectedB64","payloadB64","signature","raw"],"sources":["../src/jose.ts"],"mappings":"0GAyBA,MAAME,gBAAwB,IAAI,YAElC,MAAa,UAAa,GAA4C,CACpE,MAAMC,EAAOC,aAAiB,WAAaA,EAAQ,IAAI,WAAWA,CAAK,EACvE,IAAIC,EAAS,GACb,IAAK,MAAMC,KAAQH,EAAM,GAAU,OAAO,aAAaG,CAAI,EAC3D,OAAO,KAAKD,CAAM,CAAC,CAAC,WAAW,IAAK,GAAG,CAAC,CAAC,WAAW,IAAK,GAAG,CAAC,CAAC,QAAQ,MAAO,EAAE,CACjF,EAEA,MAAa,gBAAmB,GAA6B,CAC3D,MAAME,EAASC,EAAK,WAAW,IAAK,GAAG,CAAC,CAAC,WAAW,IAAK,GAAG,EAC5D,MAAMH,EAAS,KAAKE,EAAS,IAAI,QAAQ,EAAKA,EAAO,OAAS,GAAM,CAAC,CAAC,EACtE,MAAME,EAAM,IAAI,WAAWJ,EAAO,MAAM,EACxC,IAAK,IAAIK,EAAI,EAAGA,EAAIL,EAAO,OAAQ,IAAK,EAAIK,GAAKL,EAAO,WAAWK,CAAC,EACpE,OAAOD,CACT,EAEA,MAAM,cAAiB,GAA2B,UAAUP,EAAQ,OAAO,KAAK,UAAUS,CAAK,CAAC,CAAC,EAEjG,MAAM,O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