code: public String getSignature(String path) {
      byte[] digest = getMac().doFinal(path.getBytes(UTF_8));
      return ByteString.of(digest).base64().replace('+', '-').replace('/', '_');
    }
docs: Generate url safe HmacSHA1 of a path.