PaulMartrenchar commited on
Commit
1d31c73
·
1 Parent(s): 038b951

add permissions

Browse files
Files changed (2) hide show
  1. app.py +6 -1
  2. static/index.html +1 -0
app.py CHANGED
@@ -9,7 +9,7 @@ app = Flask(__name__, static_folder='static')
9
  app.secret_key = os.environ.get('SECRET_KEY', os.urandom(32))
10
 
11
  # Setup RP and user (for demo purposes, a fixed user)
12
- RP = RelyingParty(id="localhost", name="Demo RP", icon=None)
13
  USER = User(id=b"demo-user", name="demo@example.com", display_name="Demo User", icon=None)
14
 
15
  # Initialize and cache metadata (MDS blob)
@@ -56,5 +56,10 @@ def serve(path):
56
  print(f"requested path {path}")
57
  return send_from_directory('static', path or 'index.html')
58
 
 
 
 
 
 
59
  if __name__ == '__main__':
60
  app.run(host='0.0.0.0', port=7860, ssl_context=None)
 
9
  app.secret_key = os.environ.get('SECRET_KEY', os.urandom(32))
10
 
11
  # Setup RP and user (for demo purposes, a fixed user)
12
+ RP = RelyingParty(id="https://paulmartrenchar-fidotest.hf.space", name="Demo RP", icon=None)
13
  USER = User(id=b"demo-user", name="demo@example.com", display_name="Demo User", icon=None)
14
 
15
  # Initialize and cache metadata (MDS blob)
 
56
  print(f"requested path {path}")
57
  return send_from_directory('static', path or 'index.html')
58
 
59
+ @app.after_request
60
+ def add_permissions_policy_header(response):
61
+ response.headers['Permissions-Policy'] = 'publickey-credentials-create=(self)'
62
+ return response
63
+
64
  if __name__ == '__main__':
65
  app.run(host='0.0.0.0', port=7860, ssl_context=None)
static/index.html CHANGED
@@ -11,6 +11,7 @@
11
  }
12
  document.getElementById('btn').onclick = async () => {
13
  const opts = await fetch('/register/options').then(r=>r.json());
 
14
  opts.challenge = b64toArr(opts.challenge);
15
  opts.user.id = b64toArr(opts.user.id);
16
  opts.excludeCredentials?.forEach(c => c.id = b64toArr(c.id));
 
11
  }
12
  document.getElementById('btn').onclick = async () => {
13
  const opts = await fetch('/register/options').then(r=>r.json());
14
+ console.log("opts", opts);
15
  opts.challenge = b64toArr(opts.challenge);
16
  opts.user.id = b64toArr(opts.user.id);
17
  opts.excludeCredentials?.forEach(c => c.id = b64toArr(c.id));