Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

519 B
Raw Blame
import { sha256 } from '@noble/hashes/sha256'

// Hash serialized bearer text, not decoded random bytes, to match the relay’s stored credential digest.
export function hashMobileRelayCredential(token: string): string {
  return encodeBase64Url(sha256(new TextEncoder().encode(token)))
}

function encodeBase64Url(value: Uint8Array): string {
  let binary = ''
  for (const byte of value) {
    binary += String.fromCharCode(byte)
  }
  return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
}