MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromBase64

Function fromBase64

packages/sql/pg/src/PgAuth.ts:70–76  ·  view source on GitHub ↗
(text: string, field: string)

Source from the content-addressed store, hash-verified

68const toBase64 = (bytes: Uint8Array): string => Base64.encode(bytes)
69
70const fromBase64 = (text: string, field: string): Uint8Array => {
71 const decoded = Base64.decode(text)
72 if (Result.isFailure(decoded)) {
73 return fail(`Invalid base64 in SCRAM attribute "${field}"`)
74 }
75 return decoded.success
76}
77
78const decodeUtf8 = (bytes: Uint8Array, what: string): string => {
79 try {

Callers 2

scramContinueUnsafeFunction · 0.85
scramFinishUnsafeFunction · 0.85

Calls 2

failFunction · 0.70
decodeMethod · 0.45

Tested by

no test coverage detected