@strimz/shared-crypto 0.1.0 → 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.
package/src/api-key.ts CHANGED
@@ -22,13 +22,13 @@ import { sha256Hex } from './hash.js'
22
22
  import { randomBase64Url } from './random.js'
23
23
 
24
24
  export interface GeneratedApiKey {
25
- /** The full plaintext key — display once then discard. */
25
+ /** The full plaintext key. Display once then discard. */
26
26
  secret: string
27
27
  /** Stored as the index. */
28
28
  hash: string
29
29
  /** Stored for display / log redaction. */
30
30
  prefix: string
31
- /** Stored for display — "my key ending in ...abcd". */
31
+ /** Stored for display, e.g. "my key ending in ...abcd". */
32
32
  lastFour: string
33
33
  kind: ApiKeyKind
34
34
  mode: ApiKeyMode
package/src/encoding.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Byte encoders that work in every JavaScript runtime we target.
3
- * No Node `Buffer`, no dependency on the DOM — just Uint8Array, strings, and
3
+ * No Node `Buffer`, no dependency on the DOM. Only Uint8Array, strings, and
4
4
  * the two TextEncoder/TextDecoder classes available everywhere.
5
5
  */
6
6
 
package/src/random.ts CHANGED
@@ -27,7 +27,7 @@ export function uuid(): string {
27
27
  if (c && typeof c.randomUUID === 'function') {
28
28
  return c.randomUUID()
29
29
  }
30
- // Fallback — RFC 4122 v4 from getRandomValues
30
+ // Fallback. RFC 4122 v4 from getRandomValues.
31
31
  const bytes = randomBytes(16)
32
32
  bytes[6] = ((bytes[6] as number) & 0x0f) | 0x40
33
33
  bytes[8] = ((bytes[8] as number) & 0x3f) | 0x80